Form1.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 Lyahov_Ekzamen
  11. {
  12. public partial class Form1 : Form
  13. {
  14. Lyahov_EkzamenEntities1 db = new Lyahov_EkzamenEntities1();
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19. private void button2_Click(object sender, EventArgs e)
  20. {
  21. if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text))
  22. {
  23. MessageBox.Show("Введите данные для входа");
  24. return;
  25. }
  26. var user = db.lp.AsNoTracking().FirstOrDefault(A => A.login == textBox1.Text && A.Password == textBox2.Text);
  27. if (user == null)
  28. MessageBox.Show("Пользователь не найден");
  29. else
  30. {
  31. Form4 f = new Form4();
  32. f.Show();
  33. this.Hide();
  34. }
  35. }
  36. private void button1_Click(object sender, EventArgs e)
  37. {
  38. Form2 f = new Form2();
  39. f.Show();
  40. this.Hide();
  41. }
  42. }
  43. }