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); }
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); }
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); }
internal static string ValidateRequired(string propertyName, string propertyValue) { if (StringValidation.IsStringMissing(propertyValue)) { return(propertyName + Resources.Error_Missing_Required_Field); } return(null); }
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); }
internal static string ValidateBirthday(DateTime?bdayValue) { if (StringValidation.IsDateTimeMissing(bdayValue)) { return(null); } else if (!StringValidation.IsBirthday(bdayValue)) { return(Resources.Error_Invalid_Birthday); } return(null); }
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); }
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); }
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); }
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); }
private string GetValidationError() { return(StringValidation.ValidateUrl(this.Url, true)); }
private string GetValidationError() { return(StringValidation.ValidatePhone(Phone, true)); }