public string ToFriendlyErrorMessage() { string errorMessage = null; if (this.ErrorMessage.Contains("not recognized as a valid DateTime")) { errorMessage = "date is not a valid format."; } else if (this.ErrorMessage.Contains("not in a correct format.")) { errorMessage = "entered value is not the correct data type."; } else { //TODO add more tests here errorMessage = this.ErrorMessage; } string propertyName = null; if (this.PropertyName.Contains(".")) { propertyName = CamelCaseString.GetWords(this.PropertyName.Substring(this.PropertyName.LastIndexOf(".") + 1)); } else { propertyName = CamelCaseString.GetWords(this.PropertyName); } return(string.Concat(propertyName, " ", errorMessage)); }
public string ToErrorMessage() { return(string.Concat(CamelCaseString.GetWords(this.PropertyName), " ", this.ErrorMessage)); }