private void btn_login_masterLogin_Click(object sender, EventArgs e) { bool isVisible = tb_login_masterPass.Visible; if (isVisible) { string password = tb_login_masterPass.Text.ToString().Trim(); if (!string.IsNullOrEmpty(password)) { UserControls userControl = new UserControls(); string name = userControl.AuthenticateUser("master", password, "master"); if (!string.IsNullOrEmpty(name)) { DatabaseHelper.name = name; this.Hide(); new Dashboard().Show(); } else { MessageBox.Show("Incorrect Master Password."); } } else { MessageBox.Show("Please Enter Master Password."); } } else { tb_login_masterPass.Visible = true; lbl_login_masterPass.Visible = true; btn_login_masterLogin.Text = "Submit"; } }
private void btn_login_login_Click(object sender, EventArgs e) { string user_name = tb_userName_login.Text.ToString().Trim(); string password = tb_pass_login.Text.ToString().Trim(); if (!string.IsNullOrEmpty(user_name) && !string.IsNullOrEmpty(password)) { UserControls users = new UserControls(); string name = users.AuthenticateUser(user_name, password, "admin"); if (!string.IsNullOrEmpty(name)) { DatabaseHelper.name = name; this.Hide(); new Dashboard().Show(); } else { MessageBox.Show("No user found with this user name and passsword."); } } else { MessageBox.Show("Please Enter All Values."); } }