Beispiel #1
0
        private bool IsValidMember()
        {
            bool isValid = true;

            NewMember.ErrorNames    = string.IsNullOrEmpty(NewMember.Names) ? AppResources.NameRequired : string.Empty;
            NewMember.ErrorSurnames = string.IsNullOrEmpty(NewMember.Surnames) ? AppResources.SunamesRequired : string.Empty;

            if (NewMember.IsVisiblePersonalData)
            {
                if (string.IsNullOrEmpty(NewMember.Email))
                {
                    NewMember.ErrorEmail = AppResources.MailRequired;
                }
                else
                {
                    NewMember.ErrorEmail = ValidatorHelper.IsValidEmail(NewMember.Email) ? string.Empty : AppResources.WriteValidEmail;
                }

                if (string.IsNullOrEmpty(NewMember.Phone))
                {
                    NewMember.ErrorPhone = AppResources.CellPhoneRequired;
                }
                else
                {
                    NewMember.ErrorPhone = ValidatorHelper.IsValidCellPhone(NewMember.Phone) ? string.Empty : AppResources.InvalidPhone;
                }
                isValid = string.IsNullOrEmpty(NewMember.ErrorEmail) && string.IsNullOrEmpty(NewMember.ErrorPhone);
            }

            return(isValid && string.IsNullOrEmpty(NewMember.ErrorNames) && string.IsNullOrEmpty(NewMember.ErrorSurnames));
        }
Beispiel #2
0
        private bool ValidateData()
        {
            ErrorOldEmail     = string.IsNullOrEmpty(OldEmail) ? AppResources.MailRequired : string.Empty;
            ErrorNewEmail     = string.IsNullOrEmpty(NewEmail) ? AppResources.MailRequired : string.Empty;
            ErrorConfirmEmail = string.IsNullOrEmpty(ConfirmEmail) ? AppResources.MailRequired : string.Empty;

            if (string.IsNullOrEmpty(ErrorOldEmail) &&
                string.IsNullOrEmpty(ErrorNewEmail) &&
                string.IsNullOrEmpty(ErrorConfirmEmail))
            {
                ErrorOldEmail     = ValidatorHelper.IsValidEmail(OldEmail) ? string.Empty : AppResources.WriteValidEmail;
                ErrorNewEmail     = ValidatorHelper.IsValidEmail(NewEmail) ? string.Empty : AppResources.WriteValidEmail;
                ErrorConfirmEmail = ValidatorHelper.IsValidEmail(ConfirmEmail) ? string.Empty : AppResources.WriteValidEmail;

                if (string.IsNullOrEmpty(ErrorOldEmail))
                {
                    ErrorOldEmail = OldEmail.Equals(ServiceLocator.Current.GetInstance <ILoginViewModel>().User.UserName) ? string.Empty : AppResources.EmailCurrentError;
                }

                if (string.IsNullOrEmpty(ErrorNewEmail) && string.IsNullOrEmpty(ErrorConfirmEmail))
                {
                    ErrorConfirmEmail = ConfirmEmail.Equals(NewEmail) ? string.Empty : AppResources.EmailEqualError;
                }
            }
            else
            {
                return(false);
            }

            return(string.IsNullOrEmpty(ErrorOldEmail) &&
                   string.IsNullOrEmpty(ErrorNewEmail) &&
                   string.IsNullOrEmpty(ErrorConfirmEmail));
        }
Beispiel #3
0
        public async Task <object> Validation(object param)
        {
            _enableNext = true;

            if (string.IsNullOrEmpty(txtLogin.Text) || string.IsNullOrEmpty(txtEmail.Text) || string.IsNullOrEmpty(txtCompany.Text))
            {
                _enableNext = false;
                MessageBox.Show("Por favor preencha todos os campos.", "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }

            if (!ValidatorHelper.IsValidEmail(txtEmail.Text))
            {
                MessageBox.Show("Email com formato inválido ou o servidor do email informado não esta respondendo", "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }

            var callback = await _userService.RecoverPassword(txtCompany.Text, txtLogin.Text, txtEmail.Text);

            if (callback.IsFailure)
            {
                _enableNext = false;
                MessageBox.Show("Os dados informados não são correspondentes a uma conta.", "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }

            return(new TokenSolicitationVO
            {
                Company = txtCompany.Text,
                Login = txtLogin.Text,
                Email = txtEmail.Text,
                RecoverSolicitationCode = callback.Success
            });
        }
 private void ValidateEmail()
 {
     if (string.IsNullOrEmpty(Email))
     {
         ErrorEmail = AppResources.MailRequired;
         return;
     }
     ErrorEmail = ValidatorHelper.IsValidEmail(Email) ? string.Empty : AppResources.WriteValidEmail;
 }
Beispiel #5
0
        private bool ValidatePerson()
        {
            ErrorNames    = string.IsNullOrEmpty(Names) ? AppResources.NameRequired : string.Empty;
            ErrorSurnames = string.IsNullOrEmpty(Surnames) ? AppResources.SunamesRequired : string.Empty;

            if (IsVisiblePersonalData)
            {
                ErrorEmail = ValidatorHelper.IsValidEmail(Email) ? string.Empty : AppResources.WriteValidEmail;
                ErrorPhone = ValidatorHelper.IsValidCellPhone(Phone) ? string.Empty : AppResources.InvalidPhone;
            }

            return(string.IsNullOrEmpty(ErrorNames) && string.IsNullOrEmpty(ErrorSurnames) && string.IsNullOrEmpty(ErrorPhone) && string.IsNullOrEmpty(ErrorEmail));
        }
        private bool ValidateData()
        {
            ErrorCellPhone = string.IsNullOrEmpty(CellPhoneNumber) ? AppResources.CellPhoneRequired : string.Empty;
            ErrorEmail     = string.IsNullOrEmpty(Email) ? AppResources.MailRequired : string.Empty;
            ErrorPhone     = string.IsNullOrEmpty(Email) ? AppResources.PhoneRequired : string.Empty;

            if (string.IsNullOrEmpty(ErrorCellPhone) && string.IsNullOrEmpty(ErrorEmail))
            {
                ErrorEmail     = ValidatorHelper.IsValidEmail(Email) ? string.Empty : AppResources.WriteValidEmail;
                ErrorCellPhone = ValidatorHelper.IsValidCellPhone(CellPhoneNumber) ? string.Empty : AppResources.InvalidPhone;
                //ErrorPhone = ValidatorHelper.IsValidPhone(Phone) ? string.Empty : AppResources.InvalidPhone;
            }

            return(string.IsNullOrEmpty(ErrorEmail) && string.IsNullOrEmpty(ErrorCellPhone));
        }
Beispiel #7
0
        /// <summary>
        /// Obtiene las reglas de validacion de la entidad
        /// </summary>
        /// <returns><list type="RuleViolation">Lista de reglas de validacion violadas</list></returns>
        public IEnumerable <RuleValidation> GetRuleViolations()
        {
            if (string.IsNullOrEmpty(this.UserName))
            {
                yield return(new RuleValidation("El Nombre de usuario es requerido", "UserName"));
            }

            if (!ValidatorHelper.IsValidEmail(this.Email))
            {
                yield return(new RuleValidation("El Email ingresado es inválido", "Email"));
            }
            if (string.IsNullOrEmpty(this.Password) || this.Password.Length < 6)
            {
                yield return(new RuleValidation("La contraseña ingresada es inválida, debe tener al menos 6 caracteres", "Password"));
            }

            if (!Pendiente)
            {
                if (string.IsNullOrEmpty(this.Apellido))
                {
                    yield return(new RuleValidation("El Apellido es requerido", "Apellido"));
                }
                if (string.IsNullOrEmpty(this.Nombre))
                {
                    yield return(new RuleValidation("El Nombre es requerido", "Nombre"));
                }

                if (string.IsNullOrEmpty(this.Sexo))
                {
                    yield return(new RuleValidation("El Sexo es requerido", "Sexo"));
                }

                if (!string.IsNullOrEmpty(this.Sexo) && (!this.Sexo.Equals("M") && !this.Sexo.Equals("F")))
                {
                    yield return(new RuleValidation("El Sexo ingresado es inválido", "Sexo"));
                }

                if (this.FechaNacimiento > DateTime.Now.AddYears(-18))
                {
                    yield return(new RuleValidation("Debe ser mayor de 18 años", "Edad"));
                }
            }


            yield break;
        }
        private void ValidateEmails()
        {
            if (string.IsNullOrEmpty(Email))
            {
                ErrorEmail = AppResources.MailRequired;
                return;
            }

            ErrorEmail = ValidatorHelper.IsValidEmail(Email) ? string.Empty : AppResources.WriteValidEmail;

            if (string.IsNullOrEmpty(ConfirmationEmail))
            {
                ErrorConfirmationEmail = AppResources.MailRequired;
                return;
            }

            ErrorConfirmationEmail = ValidatorHelper.IsValidEmail(ConfirmationEmail) ? string.Empty : AppResources.WriteValidEmail;
            ErrorConfirmationEmail = ValidatorHelper.IsEqualData(Email, ConfirmationEmail) ? ErrorConfirmationEmail : AppResources.DifferentEmail;
        }
        private void ValidateEmail()
        {
            if (OtherEmail)
            {
                ErrorEmail = AsociatedUserSelected == null ? "Seleccione correo electrónico válido." : string.Empty;
            }

            if (string.IsNullOrEmpty(Email))
            {
                ErrorEmail = AppResources.EmailOrPhoneRequired;
                return;
            }
            bool isNumeric = double.TryParse(Email, out double phoneNumber);

            if (isNumeric)
            {
                ErrorEmail = (Email.Length == 1 || Email.Length != 9) || Email.Substring(0, 2) != "09"  ? AppResources.PhoneValidate : string.Empty;
            }
            else
            {
                ErrorEmail = ValidatorHelper.IsValidEmail(Email) ? string.Empty : AppResources.WriteValidEmail;
            }
        }