public override bool Equals(object obj) { if ((obj == null) || !this.GetType().Equals(obj.GetType())) { return(false); } else { DriverNIF driverNIF = (DriverNIF)obj; return(this.nif.Equals(driverNIF.nif)); } }
public CitizenCard(string driverName, string birthDate, long citizenCardNumber, long driverNIF) { if (StringValidator.isStringEmptyOrNull(driverName)) { throw new BusinessRuleValidationException(driverName + " invalid: Driver Name: can't be null or empty."); } if (StringValidator.isStringEmptyOrNull(birthDate)) { throw new BusinessRuleValidationException(birthDate + " invalid: Driver Birth Date: can't be null or empty."); } this.Id = new CitizenCardId(Guid.NewGuid()); this.driverName = new Name(driverName); this.birthDate = new BirthDate(birthDate); this.citizenCardNumber = new CitizenCardNumber(citizenCardNumber); this.driverNIF = new DriverNIF(driverNIF); }