private void btn_back_Click(object sender, EventArgs e) { if (c) { if (u == "admin") { frm_adm_Block f1 = new frm_adm_Block(); f1.Show(); this.Hide(); } else if (u == "supervisor") { frm_spr_Block f1 = new frm_spr_Block(); f1.Show(); this.Hide(); } else { if (u == "guard") { frm_grd_Block f1 = new frm_grd_Block(); f1.Show(); this.Hide(); } } } else { frm_visit_mpl f1 = new frm_visit_mpl(u); f1.Show(); this.Hide(); } }
private void btn_login_Click(object sender, EventArgs e) { con.Open(); OleDbCommand cmd = new OleDbCommand(); cmd.Connection = con; cmd.CommandText = "Select * from LOGIN where User_Type='" + label1.Text + "' and Password='******' "; OleDbDataReader read = cmd.ExecuteReader(); int count = 0; while (read.Read()) { count++; } if (count == 1) { MessageBox.Show("Welcome to Prison Management System"); frm_grd_Block f2 = new frm_grd_Block(); f2.Show(); con.Dispose(); this.Hide(); } else { MessageBox.Show("Password is not correct..."); } con.Close(); }