public EmployeeValidateEnum ValidateDateOfBirth(string s) { DateTime date; EmployeeValidateEnum validateEnum = EmployeeValidateEnum.success; if (String.IsNullOrWhiteSpace(s)) { validateEnum = EmployeeValidateEnum.nullValue; throw new EmployeeException(validateEnum); } if (DateTime.TryParse(s, out date)) { } else { validateEnum = EmployeeValidateEnum.notDate; throw new EmployeeException(validateEnum); } return(validateEnum); }
public EmployeeValidateEnum ValidatePhone(string s) { EmployeeValidateEnum validateEnum = EmployeeValidateEnum.success; if (String.IsNullOrWhiteSpace(s)) { validateEnum = EmployeeValidateEnum.nullValue; throw new EmployeeException(validateEnum); } if (new PhoneAttribute().IsValid(s) == false) { validateEnum = EmployeeValidateEnum.notPhone; throw new EmployeeException(validateEnum); } return(validateEnum); }
public EmployeeValidateEnum ValidateLastName(string s) { EmployeeValidateEnum validateEnum = EmployeeValidateEnum.success; if (String.IsNullOrWhiteSpace(s)) { validateEnum = EmployeeValidateEnum.nullValue; throw new EmployeeException(validateEnum); } else { foreach (var item in s) { if (char.IsNumber(item)) { validateEnum = EmployeeValidateEnum.containsNumber; throw new EmployeeException(validateEnum); } } } if (s[0].ToString() == " ") { validateEnum = EmployeeValidateEnum.startsSpace; throw new EmployeeException(validateEnum); } if (s.Length < 2) { validateEnum = EmployeeValidateEnum.tooShort; throw new EmployeeException(validateEnum); } if (s.Length > 49) { validateEnum = EmployeeValidateEnum.tooLong; throw new EmployeeException(validateEnum); } return(validateEnum); }
public EmployeeException(EmployeeValidateEnum ValidateEnum) : base() { this.ValidateEnum = ValidateEnum; }