예제 #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)
        {
            if (Array.IndexOf(ValidatedProperties, propertyName) < 0)
            {
                return(null);
            }

            string error = null;

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

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

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

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

            return(error);
        }
예제 #3
0
        private string GetValidationError(string propertyName)
        {
            if (Array.IndexOf(ValidatedProperties, propertyName) < 0)
            {
                return(null);
            }

            string error = null;

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

            case "StartTime":
                error = this.ValidateStartTime();
                break;

            case "EndTime":
                error = this.ValidateEndTime();
                break;

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

            return(error);
        }
예제 #4
0
 internal static string ValidateRequired(string propertyName, string propertyValue)
 {
     if (StringValidation.IsStringMissing(propertyValue))
     {
         return(propertyName + Resources.Error_Missing_Required_Field);
     }
     return(null);
 }
예제 #5
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);
        }
예제 #6
0
 internal static string ValidateBirthday(DateTime?bdayValue)
 {
     if (StringValidation.IsDateTimeMissing(bdayValue))
     {
         return(null);
     }
     else if (!StringValidation.IsBirthday(bdayValue))
     {
         return(Resources.Error_Invalid_Birthday);
     }
     return(null);
 }
예제 #7
0
 internal static string ValidateUrl(string urlValue, bool isRequired)
 {
     if (StringValidation.IsStringMissing(urlValue))
     {
         return(isRequired ? Resources.Error_MissingUrl : null);
     }
     else if (!StringValidation.IsValidUrl(urlValue))
     {
         return(Resources.Error_InvalidUrl);
     }
     return(null);
 }
예제 #8
0
 internal static string ValidateEmail(string emailValue, bool isRequired)
 {
     if (StringValidation.IsStringMissing(emailValue))
     {
         return(isRequired ? Resources.Error_Missing_Email : null);
     }
     else if (!StringValidation.IsValidEmail(emailValue))
     {
         return(Resources.Error_Invalid_Email_Format);
     }
     return(null);
 }
예제 #9
0
 internal static string ValidatePhone(string phoneValue, bool isRequired)
 {
     if (StringValidation.IsStringMissing(phoneValue))
     {
         return(isRequired ? Resources.Error_Missing_Phone : null);
     }
     else if (!StringValidation.IsValidPhone(phoneValue))
     {
         return(Resources.Error_Invalid_Phone);
     }
     return(null);
 }
예제 #10
0
 private string ValidateEndTime()
 {
     if (StringValidation.IsDateTimeMissing(EndTime))
     {
         return("End Time" + Resources.Error_Missing_Required_Field);
     }
     else if (!StringValidation.IsDateTimeMissing(StartTime) && StringValidation.IsATimeBiggerThanBTime(StartTime, EndTime))
     {
         return(Resources.Error_iCal_StartTime_Bigger);
     }
     return(null);
 }
예제 #11
0
 private string GetValidationError()
 {
     return(StringValidation.ValidateUrl(this.Url, true));
 }
예제 #12
0
 private string GetValidationError()
 {
     return(StringValidation.ValidatePhone(Phone, true));
 }