private void Button4_Click(object sender, EventArgs e) { ActiveForm.Hide(); CoordinatorMenu reg = new CoordinatorMenu(); reg.ShowDialog(); Close(); }
public void Login(string email, string password, Login lg) { string connStr = "Server=localhost;user=root;database=ketrar;password="******"SELECT Password, Email,Roleid FROM user"; MySqlCommand command = new MySqlCommand(sql, conn); MySqlDataReader reader = command.ExecuteReader(); bool pas = false; bool ema = false; while (reader.Read()) { if (reader[1].ToString() == email) { ema = true; pas = true; if (reader[0].ToString() == password) { if (reader[2].ToString() == "R") { lg.Hide(); Form9 reg = new Form9(); reg.ShowDialog(); lg.Close(); } else { if (reader[2].ToString() == "A") { lg.Hide(); AdministratorMenu reg = new AdministratorMenu(); reg.ShowDialog(); lg.Close(); } else { if (reader[2].ToString() == "C") { lg.Hide(); CoordinatorMenu reg = new CoordinatorMenu(); reg.ShowDialog(); lg.Close(); } } } } } } if (ema = false) { MessageBox.Show("Неверный Email"); } else { if (pas = false) { MessageBox.Show("Неверный пароль"); } } }