示例#1
0
        private bool Validation()
        {
            if (string.IsNullOrEmpty(txtNewPassword.Password))
            {
                LMessage.ShowMessage("M.QuanTriHeThong.NhomNSD.ucResetPassword.ThieuMatKhau", LMessage.MessageBoxType.Warning);
                txtNewPassword.Focus();
                return(false);
            }

            // Kiểm tra độ dài mật khẩu
            UtilitiesProcess utilitiesProcess = new UtilitiesProcess();

            Presentation.Process.UtilitiesServiceRef.HT_TSO htTso = utilitiesProcess.LayThamSo(BusinessConstant.LoaiThamSo.TW, BusinessConstant.MaThamSo.TW_DODAI_MATKHAU, ClientInformation.MaDonViQuanLy);
            if (htTso != null)
            {
                string giaTriThamSo = htTso.GIA_TRI;
                if (giaTriThamSo != null && giaTriThamSo != "")
                {
                    if (txtNewPassword.Password.Length < Int32.Parse(giaTriThamSo))
                    {
                        LMessage.ShowMessage("Độ dài mật khẩu không hợp lệ, giá trị tối thiểu là: " + giaTriThamSo, LMessage.MessageBoxType.Warning);
                        txtNewPassword.Focus();
                        return(false);
                    }
                }
            }

            return(true);
        }
示例#2
0
        private bool Validation()
        {
            if (string.IsNullOrEmpty(txtOldPassword.Password))
            {
                LMessage.ShowMessage("M.ZAMainApp.ChangePassword.ThieuMatKhauCu", LMessage.MessageBoxType.Warning);
                txtOldPassword.Focus();
                return(false);
            }

            else if (string.IsNullOrEmpty(txtNewPassword.Password))
            {
                LMessage.ShowMessage("M.ZAMainApp.ChangePassword.ThieuMatKhauMoi", LMessage.MessageBoxType.Warning);
                txtOldPassword.Focus();
                return(false);
            }

            else if (txtOldPassword.Password.Equals((txtNewPassword.Password)))
            {
                LMessage.ShowMessage("M.ZAMainApp.ChangePassword.MatKhauMoiPhaiKhacMatKhauCu", LMessage.MessageBoxType.Warning);
                txtOldPassword.Focus();
                return(false);
            }

            else if (string.IsNullOrEmpty(txtNewPasswordConfirm.Password))
            {
                LMessage.ShowMessage("M.ZAMainApp.ChangePassword.ThieuXacNhanMatKhauMoi", LMessage.MessageBoxType.Warning);
                txtOldPassword.Focus();
                return(false);
            }

            else if (!txtNewPasswordConfirm.Password.Equals((txtNewPassword.Password)))
            {
                LMessage.ShowMessage("M.ZAMainApp.ChangePassword.XacNhanMatKhauMoiKhongChinhXac", LMessage.MessageBoxType.Warning);
                txtOldPassword.Focus();
                return(false);
            }

            // Kiểm tra độ dài mật khẩu
            UtilitiesProcess utilitiesProcess = new UtilitiesProcess();

            Presentation.Process.UtilitiesServiceRef.HT_TSO htTso = utilitiesProcess.LayThamSo(BusinessConstant.LoaiThamSo.TW, BusinessConstant.MaThamSo.TW_DODAI_MATKHAU, ClientInformation.MaDonViQuanLy);
            if (htTso != null)
            {
                string giaTriThamSo = htTso.GIA_TRI;
                if (giaTriThamSo != null && giaTriThamSo != "")
                {
                    if (txtNewPassword.Password.Length < Int32.Parse(giaTriThamSo))
                    {
                        LMessage.ShowMessage("Độ dài mật khẩu không hợp lệ, giá trị tối thiểu là: " + giaTriThamSo, LMessage.MessageBoxType.Warning);
                        txtNewPassword.Focus();
                        return(false);
                    }
                }
            }

            return(true);
        }