//ПРОВЕРКА ЛОГИНА И ПАРОЛЯ ЗАПРОС private void BAuto_Click(object sender, EventArgs e) { if (TBLogin.Text == "" || TBPassword.Text == "") { return; } using (var context = new MyDbContext()) { var query = context.Clients.Where(x => x.login == TBLogin.Text && x.password == TBPassword.Text); if (TBLogin.Text == "RedMark" && TBPassword.Text == "markmark") { AdminMenu adminmenu = new AdminMenu(); adminmenu.Show(); this.Visible = false; } else if (query.ToList().Count > 0) { sendDate.login = TBLogin.Text; sendDate.password = TBPassword.Text; UserMenu usermenu = new UserMenu(); usermenu.Show(); this.Visible = false; } else { TBError.Text = "Вы ввели логин/пароль неправильно"; TBError.Visible = true; } } }
//ОТКРЫТИЕ ФОРМ private void Test_Click(object sender, EventArgs e) { AdminMenu adminmenu = new AdminMenu(); adminmenu.Show(); }