using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Lyahov_Ekzamen { public partial class Form1 : Form { Lyahov_EkzamenEntities1 db = new Lyahov_EkzamenEntities1(); public Form1() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text)) { MessageBox.Show("Введите данные для входа"); return; } var user = db.lp.AsNoTracking().FirstOrDefault(A => A.login == textBox1.Text && A.Password == textBox2.Text); if (user == null) MessageBox.Show("Пользователь не найден"); else { Form4 f = new Form4(); f.Show(); this.Hide(); } } private void button1_Click(object sender, EventArgs e) { Form2 f = new Form2(); f.Show(); this.Hide(); } } }