public override int GetHashCode() { return(Surname.GetHashCode() ^ Patronimic.GetHashCode() * 17 ^ Name.GetHashCode() * 19 * BirthYear.GetHashCode()); }
public int CompareTo(Student student2) { if (student2 is null) { return(1); } int result = string.CompareOrdinal(Surname, student2.Surname); if (result != 0) { return(result); } result = string.CompareOrdinal(Name, student2.Name); if (result != 0) { return(result); } result = string.CompareOrdinal(Patronimic, student2.Patronimic); if (result != 0) { return(result); } return(BirthYear.CompareTo(student2.BirthYear)); }
public void Validate() { if (!String.IsNullOrEmpty(Gender) && Gender != "m" && Gender != "f") { throw new ArgumentException("Gender"); } BirthYear.ValidateOptional("BirthYear"); Country.ValidateOptional("Country"); State.ValidateOptional("State"); FirstDayOfWeek.ValidateOptional("FirstDayOfWeek"); Languages.ValidateOptional <Language>("Languages"); }
public override int GetHashCode() { unchecked { int hash = 23; hash = hash * 37 + (Number != null ? Number.GetHashCode() : 0); hash = hash * 37 + (Name != null ? Name.GetHashCode() : 0); hash = hash * 37 + (BirthYear != null ? BirthYear.GetHashCode() : 0); hash = hash * 37 + (Height != null ? Height.GetHashCode() : 0); hash = hash * 37 + (Role != null ? Role.GetHashCode() : 0); return(hash); } }
private bool ValidateField(KeyValuePair <string, string> kvp) { var(key, value) = kvp; return(key switch { "byr" => BirthYear.IsValid(value), "iyr" => IssueYear.IsValid(value), "eyr" => ExpirationYear.IsValid(value), "hgt" => Height.IsValid(value), "hcl" => HairColour.IsValid(value), "ecl" => EyeColour.IsValid(value), "pid" => PassportId.IsValid(value), "cid" => true, _ => false });
public override int GetHashCode() { unchecked { int hash = 23; hash = hash * 37 + Id.GetHashCode(); hash = hash * 37 + (Number != null ? Number.GetHashCode() : 0); hash = hash * 37 + (FullName != null ? FullName.GetHashCode() : 0); hash = hash * 37 + (NationalityCode != null ? NationalityCode.GetHashCode() : 0); hash = hash * 37 + (Nationality != null ? Nationality.GetHashCode() : 0); hash = hash * 37 + (BirthYear != null ? BirthYear.GetHashCode() : 0); hash = hash * 37 + (Position != null ? Position.GetHashCode() : 0); hash = hash * 37 + (Height != null ? Height.GetHashCode() : 0); return(hash); } }
public UserModel(TblUser row) { Id = row.Id; Name = row.Name; LastName = row.LastName; TelNumber = row.TelNumber; Email = row.Email; Active = row.Active; ClubId = row.ClubId; TrainerId = row.TrainerId; BirthYear = row.BirthYear; Lytis = row.Lytis; Name2 = Name + " " + LastName; if (BirthYear.ToString().Length == 22) { BirthYear2 = BirthYear.ToString().Substring(0, 10); } else if (BirthYear.ToString().Length == 20) { BirthYear2 = BirthYear.ToString().Substring(0, 8); } else { BirthYear2 = BirthYear.ToString().Substring(0, 9); } String[] datearray = BirthYear2.Split('/'); BirthYear2 = datearray[2] + "-"; if (datearray[0].Length == 1) { BirthYear2 += "0" + datearray[0] + "-"; } else { BirthYear2 += datearray[0] + "-"; } if (datearray[1].Length == 1) { BirthYear2 += "0" + datearray[1]; } else { BirthYear2 += datearray[1]; } }
public int?Age() { return(BirthYear.Age(DeathYear ?? new Year(DateTime.Now))); }
private bool IsBirthYearValid() => BirthYear.IsDigitWithLength(4, out var birthYear) && birthYear.IsBetween(1920, 2002);
get => _bdate ?? (_bdate = new DateTime(BirthYear, BirthMonth, BirthDay));
public override string ToString() { return (FirstName.PadRight(20) + LastName.PadRight(20) + LicensedDriver.ToString().PadRight(20) + BirthYear.ToString().PadRight(20) + FavoriteColor.ToString().PadRight(20)); }
public override string ToString() { return($"{Color} animal was born in {BirthYear.ToString("dd/MM/yyyy")}, his age is {GetAge(BirthYear)}, he say - " + Voice()); }