Form3.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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.Windows.Forms;
  9. namespace WindowsFormsAppGrishina
  10. {
  11. public partial class Form3 : Form
  12. {
  13. public Form3()
  14. {
  15. InitializeComponent();
  16. }
  17. private void textBox1_TextChanged(object sender, EventArgs e)
  18. {
  19. }
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22. if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text))
  23. {
  24. MessageBox.Show("Введите логин и пароль");
  25. return;
  26. }
  27. using (var db = new grishinaEntities())
  28. {
  29. var user = db.grishinaDataSet
  30. .AsNoTracking()
  31. .FirstOrDefault(u => u.Login == TextBox1.Text && u.Pass == TextBox2.Text);
  32. if (user == null)
  33. {
  34. MessageBox.Show("Пользователь с такими данными не найден");
  35. return;
  36. }
  37. MessageBox.Show("Пользователь найден");
  38. }
  39. }
  40. private void label1_Click(object sender, EventArgs e)
  41. {
  42. }
  43. private void label2_Click(object sender, EventArgs e)
  44. {
  45. }
  46. private void PasswordBox_TextChanged(object sender, EventArgs e)
  47. {
  48. }
  49. private void button2_Click(object sender, EventArgs e)
  50. {
  51. }
  52. }
  53. }