Form1.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 BB_Azizova
  11. {
  12. public partial class FAvtoriz : Form
  13. {
  14. public FAvtoriz()
  15. {
  16. InitializeComponent();
  17. }
  18. private void b1Vhod_Click(object sender, EventArgs e)
  19. {
  20. {
  21. if (string.IsNullOrEmpty(LogintextBox1.Text) || string.IsNullOrEmpty(PasswordtextBox2.Text))
  22. {
  23. MessageBox.Show("Введите логин и пароль!");
  24. }
  25. using (var db = new BB_AzizovaEntities())
  26. {
  27. var user = db.Administrator
  28. .AsNoTracking()
  29. .FirstOrDefault(u => u.Login == LogintextBox1.Text && u.Password == PasswordtextBox2.Text);
  30. if (user == null)
  31. {
  32. MessageBox.Show("Пользователь с такими данными не найден!");
  33. return;
  34. }
  35. F2Client f = new F2Client();
  36. f.Show();
  37. this.Hide();
  38. }
  39. }
  40. }
  41. private void b2Vahod_Click(object sender, EventArgs e)
  42. {
  43. this.Close();
  44. }
  45. }
  46. }