示例#1
0
 private void btnDoiMK_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtMKCu.Text.Trim().Length == 0)
         {
             MsgboxUtil.Exclamation("Vui lòng nhập mật khẩu cũ của bạn!");
             txtMKCu.Focus();
             return;
         }
         if (txtMKMoi.Text.Trim().Length == 0)
         {
             MsgboxUtil.Exclamation("Vui lòng nhập mật khẩu mới của bạn!");
             txtMKMoi.Focus();
             return;
         }
         if (txtNhapLai.Text.Trim().Length == 0)
         {
             MsgboxUtil.Exclamation("Vui lòng xác minh mật khẩu mới!");
             txtNhapLai.Focus();
             return;
         }
         if (txtMKMoi.Text.Trim() != txtNhapLai.Text.Trim())
         {
             MsgboxUtil.Exclamation("Xác minh mật khẩu không đúng. Vui lòng xác minh lại!");
             txtMKMoi.ResetText();
             txtNhapLai.ResetText();
             txtMKMoi.Focus();
             return;
         }
         if (NguoiDungBUS.DoiMatKhau(StaticClass.User.TenDangNhap, txtMKCu.Text, txtMKMoi.Text))
         {
             StaticClass.Log.GhiFile("Đổi mật khẩu");
             MsgboxUtil.Success("Mật khẩu của bạn đã được thay đổi");
             this.Close();
         }
     }
     catch (Exception ex)
     {
         ExceptionUtil.ThrowMsgBox(ex.Message);
     }
 }
 protected void btnDMK_Click(object sender, EventArgs e)
 {
     try
     {
         NguoiDungDTO ndDTO = new NguoiDungDTO();
         ndDTO.Username = txtTK.Text;
         ndDTO.Pass     = txtMKcu.Text;
         ndDTO.Newpass  = txtMKmoi.Text;
         if (NguoiDungBUS.ktraDangNhap(ndDTO) == true)
         {
             NguoiDungBUS.DoiMatKhau(ndDTO);
             lblThongBao.Text = "Đổi thành công";
         }
         else
         {
             lblThongBao.Text = "Đổi thất bại";
         }
     }
     catch
     { }
 }