Пример #1
0
        private string GetValidationError(string propertyName)
        {
            if (Array.IndexOf(ValidatedProperties, propertyName) < 0)
            {
                return(null);
            }

            string error = null;

            switch (propertyName)
            {
            case "Phone":
                error = StringValidation.ValidatePhone(Phone, true);
                break;

            case "Message":
                error = StringValidation.ValidateRequired(propertyName, this.Message);
                break;

            default:
                Debug.Fail("Unexpected property being validated on SMSContent: " + propertyName);
                break;
            }

            return(error);
        }
Пример #2
0
        private string GetValidationError(string propertyName)
        {
            //Check if property is in validation list.
            //If not, then it's not require to be validated.
            if (Array.IndexOf(ValidatedProperties, propertyName) < 0)
            {
                return(null);
            }

            string error = null;

            switch (propertyName)
            {
            case "FirstName":
                error = StringValidation.ValidateRequired(propertyName, FirstName);
                break;

            case "Mobile":
                error = StringValidation.ValidatePhone(Mobile, false);
                break;

            case "PhoneHome":
                error = StringValidation.ValidatePhone(PhoneHome, false);
                break;

            case "PhoneWork":
                error = StringValidation.ValidatePhone(PhoneWork, false);
                break;

            case "FaxHome":
                error = StringValidation.ValidatePhone(FaxHome, false);
                break;

            case "FaxWork":
                error = StringValidation.ValidatePhone(FaxWork, false);
                break;

            case "Email":
                error = StringValidation.ValidateEmail(Email, false);
                break;

            case "URL":
                error = StringValidation.ValidateUrl(URL, false);
                break;

            case "BirthDay":
                error = StringValidation.ValidateBirthday(BirthDay);
                break;

            default:
                Debug.Fail("Unexpected property being validated on vCardContent: " + propertyName);
                break;
            }

            return(error);
        }
Пример #3
0
 private string GetValidationError()
 {
     return(StringValidation.ValidatePhone(Phone, true));
 }