Form1.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace Sseessiioonn1
  11. {
  12. public partial class Main_Form : Form
  13. {
  14. public Main_Form()
  15. {
  16. InitializeComponent();
  17. }
  18. private void button2_Click(object sender, EventArgs e)
  19. {
  20. this.Close();
  21. }
  22. private void button1_Click(object sender, EventArgs e)
  23. {
  24. string username = Textbox_login.Text;
  25. string password = Textbox_password.Text;
  26. if (INUserAuthenticated(username, password))
  27. {
  28. MessageBox.Show("Авторизация прошла успешно");
  29. Glavnoya_form frm = new Glavnoya_form();
  30. frm.Show();
  31. this.Hide();
  32. }
  33. else
  34. {
  35. MessageBox.Show("Ошибка авторизации!");
  36. }
  37. }
  38. private bool INUserAuthenticated(string username, string password)
  39. {
  40. if (username == "admin" && password == "admin")
  41. {
  42. return true;
  43. }
  44. else
  45. {
  46. return false;
  47. }
  48. }
  49. }
  50. }