public override bool IsValid(InputTypes type)
        {
            if (type == InputTypes.Username || type == InputTypes.Password)
            {
                return(base.IsValid(type));
            }
            Regex re = new Regex(InputTypeValue.Value(type));

            switch (type)
            {
            case InputTypes.FirstName:
                return(re.IsMatch(user.GetFirstName()));

            case InputTypes.LastName:
                return(re.IsMatch(user.GetLastName()));

            case InputTypes.Email:
                return(RegexUtilities.IsValidEmail(user.GetEmail()));

            case InputTypes.FullAddress:
                return(AddressAPI.IsAddressValid(user));

            default:
                return(false);
            }
        }
Exemplo n.º 2
0
        public virtual bool IsValid(InputTypes type)
        {
            Regex re = new Regex(InputTypeValue.Value(type));

            switch (type)
            {
            case InputTypes.Username:
                return(newUser ? re.IsMatch(user.GetUserName()) : CheckDatabase(type));

            case InputTypes.Password:
                return(newUser ? re.IsMatch(user.GetPassword()) : CheckDatabase(type));

            default: return(false);
            }
        }
Exemplo n.º 3
0
        public virtual bool IsValid(InputTypes type)
        {
            if (!newUser)
            {
                CheckDatabase();
            }

            Regex re = new Regex(InputTypeValue.Value(type));

            switch (type)
            {
            case InputTypes.Email:
                return(RegexUtilities.IsValidEmail(user.GetEmail()));

            case InputTypes.Password:
                return(re.IsMatch(user.GetPassword()));

            default: return(false);
            }
        }