/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + IdReservation.GetHashCode(); if (Car != null) { hashCode = hashCode * 59 + Car.GetHashCode(); } hashCode = hashCode * 59 + Days.GetHashCode(); hashCode = hashCode * 59 + Price.GetHashCode(); if (ReservationNr != null) { hashCode = hashCode * 59 + ReservationNr.GetHashCode(); } if (PickUpDate != null) { hashCode = hashCode * 59 + PickUpDate.GetHashCode(); } hashCode = hashCode * 59 + IsLease.GetHashCode(); if (Customer != null) { hashCode = hashCode * 59 + Customer.GetHashCode(); } return(hashCode); } }
public override string ToString() { //Retourne en String tous les champs return (" IdReservationRoom: " + IdRoomReservation.ToString() + " IdReservation: " + IdReservation.ToString() + " IdRoom: " + IdRoom.ToString() + " PriceIncreased" + PriceIncreased.ToString()); }
public override string ToString() { //Retourne en String tous les champs return (" IdReservation: " + IdReservation.ToString() + " ClientLastName: " + ClientLastName + " ClientFirstName: " + ClientFirstName + " CheckIn: " + CheckIn.ToString() + " CheckOut: " + CheckOut.ToString()); }
/// <summary> /// Returns true if Reservation instances are equal /// </summary> /// <param name="other">Instance of Reservation to be compared</param> /// <returns>Boolean</returns> public bool Equals(Reservation other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( IdReservation == other.IdReservation || IdReservation.Equals(other.IdReservation) ) && ( Car == other.Car || Car != null && Car.Equals(other.Car) ) && ( Days == other.Days || Days.Equals(other.Days) ) && ( Price == other.Price || Price.Equals(other.Price) ) && ( ReservationNr == other.ReservationNr || ReservationNr != null && ReservationNr.Equals(other.ReservationNr) ) && ( PickUpDate == other.PickUpDate || PickUpDate != null && PickUpDate.Equals(other.PickUpDate) ) && ( IsLease == other.IsLease || IsLease.Equals(other.IsLease) ) && ( Customer == other.Customer || Customer != null && Customer.Equals(other.Customer) )); }
/// <summary> /// Reserves the specified number of Ids for a given system. /// </summary> /// <param name="systemName">The name of the system. This should be unique across Id sets.</param> /// <param name="amount">The number of Ids to reserve.</param> /// <returns>An object containing Id reservation details.</returns> public static IdReservation ReserveIds(string systemName, int amount) { // Ids haven't been reserved yet. Do that now. if (!_systemReservedIdCount.ContainsKey(systemName)) { _systemReservedIdCount[systemName] = new IdReservation(); _systemReservedIdCount[systemName].Count = amount; _systemReservedIdCount[systemName].StartId = ReservedIdCount; _systemReservedIdCount[systemName].EndId = ReservedIdCount + amount - 1; ReservedIdCount += amount; } return(_systemReservedIdCount[systemName]); }