Esempio n. 1
0
        private void RefreshValidator()
        {
            this.messagePop.Reset();
            string notEmpty = " " + ValidatorResource.NotEmpty;

            if (!this.isFromFile)
            {
                //if (!this.ExistUser)
                //{
                //    this.messagePop.SetError(SystemRoleResource.ExistUser);
                //    return;
                //}

                //if (this.tlName.Equals(""))
                //    this.messagePop.SetError(SystemRoleResource.lblUsername + notEmpty);
                //if (this.currentUser.Password.Equals(""))
                //    this.messagePop.SetError(SystemRoleResource.Password + notEmpty);

                //if (this.currentUser.TLSUBBRID == null || this.currentUser.TLSUBBRID.Equals(""))
                //    this.messagePop.SetError(SystemRoleResource.Branch + notEmpty);

                if (this.currentUser.TLFullName == null || this.currentUser.TLFullName.Equals(""))
                {
                    this.messagePop.SetError(SystemRoleResource.TLFullName + notEmpty);
                }
                if (this.curBranchId == "" || this.curBranchId == null)
                {
                    this.messagePop.SetSingleError(SystemRoleResource.TLSUBBRID + notEmpty);
                }
                if (this.currentUser.EMAIL == null || this.currentUser.EMAIL.Equals(""))
                {
                    this.messagePop.SetError(SystemRoleResource.EMAIL + notEmpty);
                }
                else if (!ValidateTest.IsEmail(this.currentUser.EMAIL))
                {
                    this.messagePop.SetError(SystemRoleResource.EMAIL + " " + ValidatorResource.ErrorFormat);
                }
                if (this.currentUser.RoleName == null || this.currentUser.RoleName.Equals(""))
                {
                    this.messagePop.SetError(SystemRoleResource.lblRole + notEmpty);
                }

                if (this.isCheckedStatus == -1)
                {
                    this.isUpdate = true;
                    this.CheckUserName();
                    this.messagePop.SetError("Kiểm tra username?");
                }
                else if (this.isCheckedStatus == 0)
                {
                    this.messagePop.SetError("Username không tồn tại.");
                }

                //if (this.currentUser.PHONE == null || this.currentUser.PHONE.Equals(""))
                //    this.messagePop.SetError(SystemRoleResource.PHONE + notEmpty);
                //else if (!this.currentUser.PHONE.Equals("") && !ValidateTest.IsNumber(this.currentUser.PHONE))
                //    this.messagePop.SetError(SystemRoleResource.PHONE + " " + ValidatorResource.ErrorFormat);
            }
            else
            {
                if (this.FileName == null || this.FileName.Equals(""))
                {
                    this.messagePop.SetError(SystemRoleResource.lblFile + notEmpty);
                }

                if (this.roleName == null || this.roleName.Equals(""))
                {
                    this.messagePop.SetError(SystemRoleResource.lblRole + notEmpty);
                }
            }
        }