internal void FillUserFields(User user) { user.NickName = !string.IsNullOrEmpty(NickName) ? NickName : NickName2.EndsWith(Id.ToString(CultureInfo.InvariantCulture)) ? string.Empty : NickName2; if (!string.IsNullOrEmpty(DateOfBirth)) { var dateMothYear = DateOfBirth.Split('.').Select(x => Convert.ToInt32(x)).ToArray(); if (dateMothYear.Length == 3) { user.DateOfBirth = new DateTime(dateMothYear[2], dateMothYear[1], dateMothYear[0]); } } switch (SexId) { case 1: user.Sex = Sex.Female; break; case 2: user.Sex = Sex.Male; break; default: user.Sex = Sex.NotSet; break; } }
public bool Validate() { if (String.IsNullOrEmpty(FirstName) || String.IsNullOrEmpty(Surname) || AcademicYearOfStudies <= 0 || String.IsNullOrEmpty(CitizenshipDictCode) || String.IsNullOrEmpty(DateOfBirth) || DateOfBirth.Split('-').ToArray().Count() != 3 || String.IsNullOrEmpty(CourseDictKey) || String.IsNullOrEmpty(GenderDictKey) || String.IsNullOrEmpty(EmailAdress) || IsValidEmail() || String.IsNullOrEmpty(CollegeId) || String.IsNullOrEmpty(IndexNumber) || String.IsNullOrEmpty(CourseYearDictKey) || String.IsNullOrEmpty(NumberOfBedDictKey)) { return(false); } return(true); }
public DateTime GetBirthDate() { var split = DateOfBirth.Split('.'); return(new DateTime(int.Parse(split[2]), int.Parse(split[1]), int.Parse(split[0]))); }