private void usrIssuedBooksBtnBack_Click(object sender, EventArgs e) { this.Hide(); userBookSearch ubs = new userBookSearch(); ubs.Show(); }
private void LoginBtnSubmit_Click(object sender, EventArgs e) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd = new SqlCommand("select * from users where user_id = @user_id and password = @password", con); cmd.Parameters.AddWithValue("@user_id", loginTbxUserId.Text); cmd.Parameters.AddWithValue("@password", loginTbxPassword.Text); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); Session.userid = Int32.Parse(loginTbxUserId.Text.ToString()); if (dt.Rows.Count > 0) { // successfully logged in pass userid and pwd userid = Convert.ToInt32(loginTbxUserId.Text); password = loginTbxPassword.Text; if (Convert.ToString(dt.Rows[0][1]) == "False") { this.Hide(); userBookSearch ubs = new userBookSearch(); ubs.Show(); } else { this.Hide(); admStartPage asp = new admStartPage(); asp.Show(); } } else { MessageBox.Show("The entered USER ID or PASSWORD is WRONG.\nPlease check and try again.\nIf you have forgotten the password then go to the librarian to create a new one."); clear(); } }