public override bool Equals(object obj) { Itinerary toCompare = obj as Itinerary; if (toCompare == null) { return(false); } if (Object.Equals(ItineraryId, default(int)) && Object.Equals(toCompare.ItineraryId, default(int))) { return(ReferenceEquals(this, toCompare)); } if (!Object.Equals(ItineraryId, toCompare.ItineraryId)) { return(false); } return(true); }
private Itinerary ConstructItinerary() { var itinerary = new Itinerary() { ItineraryNumber = "IT0001-ABCD" }; var itineraryGuest = new ItineraryGuest() { Itinerary = itinerary, FirstName = "Alex", LastName = "Lobakov" }; itinerary.ItineraryGuests.Add(itineraryGuest); var reservation = new Reservation() { Itinerary = itinerary, ReservationNumber = "R0001-000A" }; itinerary.Reservations.Add(reservation); var resGuest = new ReservationGuest() { Reservation = reservation, ItineraryGuest = itineraryGuest }; reservation.ReservationGuests.Add(resGuest); itineraryGuest.ReservationGuests.Add(resGuest); for (var date = DateTime.Now.Date; date < DateTime.Now.Date.AddDays(10); date = date.AddDays(1)) { var day = new ReservationDay() { Reservation = reservation, BusinessDate = date, QuotedRate = 100m }; reservation.ReservationDays.Add(day); var dayPrice = new ReservationDayPrice() { Reservation = reservation, ReservationDay = day, Price = 100m }; reservation.ReservationDayPrices.Add(dayPrice); day.ReservationDayPrices.Add(dayPrice); var dayShare = new ReservationDayShare() { ReservationGuest = resGuest, ReservationDay = day, ShareValue = 100m }; resGuest.ReservationDayShares.Add(dayShare); day.ReservationDayShares.Add(dayShare); } return(itinerary); }
private Itinerary ConstructItinerary() { var itinerary = new Itinerary() { ItineraryNumber = "IT0001-ABCD" }; var itineraryGuest = new ItineraryGuest() { Itinerary = itinerary, FirstName = "Alex", LastName = "Lobakov" }; itinerary.ItineraryGuests.Add(itineraryGuest); var reservation = new Reservation() { Itinerary = itinerary, ReservationNumber = "R0001-000A" }; itinerary.Reservations.Add(reservation); var resGuest = new ReservationGuest() { Reservation = reservation, ItineraryGuest = itineraryGuest }; reservation.ReservationGuests.Add(resGuest); itineraryGuest.ReservationGuests.Add(resGuest); for (var date = DateTime.Now.Date; date < DateTime.Now.Date.AddDays(10); date = date.AddDays(1)) { var day = new ReservationDay() { Reservation = reservation, BusinessDate = date, QuotedRate = 100m }; reservation.ReservationDays.Add(day); var dayPrice = new ReservationDayPrice() { Reservation = reservation, ReservationDay = day, Price = 100m }; reservation.ReservationDayPrices.Add(dayPrice); day.ReservationDayPrices.Add(dayPrice); var dayShare = new ReservationDayShare() { ReservationGuest = resGuest, ReservationDay = day, ShareValue = 100m }; resGuest.ReservationDayShares.Add(dayShare); day.ReservationDayShares.Add(dayShare); } return itinerary; }