private void btnLogin_Click(object sender, EventArgs e) { string posstaff = "", idstaff = ""; DataSet staff = dbLogin.GetIDStaff(this.txtUsername.Text, this.txtPassword.Text); if (staff.Tables[0].Rows.Count > 0) { idstaff = staff.Tables[0].Rows[0][0].ToString(); posstaff = dbStaff.GetPosAndNameStaff(idstaff).Tables[0].Rows[0][1].ToString(); } if (dbLogin.CheckAccount(this.txtUsername.Text, this.txtPassword.Text, ref err) == true) { if (posstaff == "Giám Đốc") { FrmManage frmmain = new FrmManage(dbStaff.GetPosAndNameStaff(idstaff).Tables[0].Rows[0][0].ToString()); this.Hide(); frmmain.ShowDialog(); txtPassword.ResetText(); this.cbShow.Checked = false; this.txtPassword.UseSystemPasswordChar = true; this.Show(); this.txtPassword.Focus(); } else { if (posstaff == "Nhân Viên") { FormStaff formstaff = new FormStaff(dbStaff.GetPosAndNameStaff(idstaff).Tables[0].Rows[0][0].ToString()); this.Hide(); formstaff.ShowDialog(); txtPassword.ResetText(); this.cbShow.Checked = false; this.txtPassword.UseSystemPasswordChar = true; this.Show(); this.txtPassword.Focus(); } else { MessageBox.Show("UserName or Password incorrected"); this.txtPassword.Focus(); } } } else { MessageBox.Show("UserName or Password incorrected"); this.txtPassword.Focus(); } }