public override bool Equals(object obj) { ReservationGuest toCompare = obj as ReservationGuest; if (toCompare == null) { return(false); } if (Object.Equals(ReservationGuestId, default(int)) && Object.Equals(toCompare.ReservationGuestId, default(int))) { return(ReferenceEquals(this, toCompare)); } if (!Object.Equals(ReservationGuestId, toCompare.ReservationGuestId)) { 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; }