Ejemplo n.º 1
0
 private void btn_resetMatKhau_Click(object sender, EventArgs e)
 {
     if (txt_tenDangNhap.Text.Trim() == "")
     {
         XtraMessageBox.Show("Chưa nhập tên đăng nhập!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         if (tkBUS.CheckUsername(txt_tenDangNhap.Text.Trim()) != 1)
         {
             XtraMessageBox.Show("Tên đăng nhập không tồn tại!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             if (tkDTO != null)
             {
                 int kq = tkBUS.ResetPassword(txt_tenDangNhap.Text.Trim());
                 if (kq == 1)
                 {
                     XtraMessageBox.Show("Reset mật khẩu thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     lb_nhapMKM.Visible       = true;
                     txt_matKhauMoi.Visible   = true;
                     txt_tenDangNhap.ReadOnly = true;
                     btn_resetMatKhau.SendToBack();
                 }
                 else
                 {
                     XtraMessageBox.Show("Reset mật khẩu thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void btn_luuTaiKhoan_Click(object sender, EventArgs e)
        {
            if (txt_taoTenDangNhap.Text == "" || txt_taoMatKhau.Text == "")

            {
                XtraMessageBox.Show("Chưa điền đầy đủ thông tin!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (tkBUS.CheckUsername(txt_taoTenDangNhap.Text) == 1)
                {
                    XtraMessageBox.Show("Tên đăng nhập đã tồn tại!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    if (txt_taoMatKhau.Text != txt_nhapLaiMK.Text)
                    {
                        XtraMessageBox.Show("Mật khẩu không khớp!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        if (tkDTO != null)
                        {
                            GetDetail();

                            int kq = tkBUS.AddTK(tkDTO);
                            if (kq == 1)
                            {
                                XtraMessageBox.Show("Tạo tài khoản thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                string manv = txt_manv.Text;
                                tkBUS.UpdateNVChuaCoTK(manv);
                                nvBUS.danhsachNVChuaCoTaiKhoan();
                                frmThemTaiKhoan.LoadDSNVChuaCoTaiKhoan();
                                this.Dispose();
                            }
                            else
                            {
                                XtraMessageBox.Show("Tạo không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }
                }
            }
        }