private void btnCapNhatTK_Click(object sender, EventArgs e)
 {
     txtUsernameTK.Text = cbbTenNhanVienTK.SelectedValue.ToString();
     DTO.DangNhapDTO dangNhap = null;
     if (cbbQuyenHanTK.Text == "Admin")
     {
         dangNhap = new DTO.DangNhapDTO(txtUsernameTK.Text, txtPasswordTK.Text, true);
     }
     else if (cbbQuyenHanTK.Text == "User")
     {
         dangNhap = new DTO.DangNhapDTO(txtUsernameTK.Text, txtPasswordTK.Text, false);
     }
     if (txtPasswordTK.Text != "" && cbbQuyenHanTK.Text != "")
     {
         BLL.DangNhapBLL taiKhoan = new BLL.DangNhapBLL();
         if (taiKhoan.Update(dangNhap) == true)
         {
             MessageBox.Show("Cập nhật Tài khoản thành công");
             LoadTK();
             LamMoiTaiKhoan();
         }
         else
         {
             MessageBox.Show("Lỗi xảy ra trong quá trình thực hiện");
         }
     }
 }
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            string userName = txtUserName.Text;
            string passWord = txtPassWord.Text;

            if (Login(userName, passWord))
            {
                BLL.DangNhapBLL acc     = new BLL.DangNhapBLL();
                DTO.DangNhapDTO account = acc.GetAccountByUserName(userName);
                frmManager      f       = new frmManager(account);
                this.Hide();
                f.ShowDialog();
                txtPassWord.Text = "";
                txtPassWord.Focus();
                this.Show();
            }
            else
            {
                if (txtPassWord.Text.Length == 0 || txtUserName.Text.Length == 0)
                {
                    MessageBox.Show("Bạn Chưa Nhập Tài Khoản Hoặc Mật Khẩu !!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtPassWord.Text = "";
                    txtUserName.Text = "";
                    txtUserName.Focus();
                }
                else
                {
                    MessageBox.Show("Bạn Đã Nhập Sai Tài Khoản Hoặc Mật Khẩu !!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtPassWord.Text = "";
                    txtPassWord.Focus();
                }
            }
        }
Exemplo n.º 3
0
 public bool Insert(string userName, string passWord, bool quyenHan)
 {
     DTO.DangNhapDTO taiKhoan = new DTO.DangNhapDTO(userName, passWord, quyenHan);
     return(DAL.DangNhapDAL.Instance.Insert(taiKhoan));
 }
Exemplo n.º 4
0
 public bool Update(DTO.DangNhapDTO data)
 {
     return(DAL.DangNhapDAL.Instance.Update(data));
 }