private void button1_Click(object sender, EventArgs e) { DBConnection.Authorization(txtLogin.Text, txtPassword.Text); switch (DBConnection.Role) { case "R": DBConnection.GetEmail = txtLogin.Text; tr = true; this.Close(); RunnerMenu Form = new RunnerMenu(); Form.Show(); break; case "A": tr = true; this.Close(); AdminMenu AdminMenuFrm = new AdminMenu(); AdminMenuFrm.Show(); break; case "c": tr = true; this.Close(); CoordinatorMenu coordinatorMenu = new CoordinatorMenu(); coordinatorMenu.Show(); break; case null: MessageBox.Show("Неверные данные"); break; } }
private void button4_Click(object sender, EventArgs e) { tr = true; this.Close(); CoordinatorMenu Form = new CoordinatorMenu(); Form.Show(); }
private void Button1_Click(object sender, EventArgs e) { try { Connection.connection.Open(); string sqlExp = "select [Email], [Password],[RoleId] from [dbo].[User] where [Email]=@login"; SqlCommand cmd = new SqlCommand(sqlExp, Connection.connection); cmd.Parameters.AddWithValue("@login", textBox_email.Text); SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { reader.Read(); if ((string)reader[1] == textBox_password.Text) { Connection.userLogin = textBox_email.Text; switch ((string)reader[2]) { case "R": RunnerMenu mr = new RunnerMenu(); mr.Show(); this.Close(); break; case "C": CoordinatorMenu mc = new CoordinatorMenu(); mc.Show(); this.Close(); break; case "A": AdminMenu ma = new AdminMenu(); ma.Show(); this.Close(); break; default: MessageBox.Show("Нет такой роли"); break; } } else { MessageBox.Show("Неверный пароль"); } } else { MessageBox.Show("Неверный логин"); } reader.Close(); } catch (SqlException ex) { MessageBox.Show(ex.Message); } Connection.connection.Close(); }