示例#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);
                 }
             }
         }
     }
 }