public static void CreateOrUpdateBookingFareInfoItems(BookingFareInfo bookingFareInfo, decimal price, CountryFareType[] countryFareTypes, FareTypeName[] farePromotions, double[] fareMargins) { for (int i = 0; i < 5; i++) { BookingFareInfoItem item; if (bookingFareInfo.Items.Count > i) item = bookingFareInfo.Items[i]; else { item = new BookingFareInfoItem(); bookingFareInfo.Items.Add(item); } item.FareType = (FareType)(i + 1); item.Margin = fareMargins[i]; if (farePromotions[i] == null) item.Name = countryFareTypes[i].Name; else { item.Name = farePromotions[i].Name; if (item.Margin != 0.0) item.PromotionId = farePromotions[i].Id; } item.Price = (decimal)Math.Round((double)price * fareMargins[i] / 100.0, 4); item.Rule = countryFareTypes[i].Rule; } }
public bool Equals(BookingFareInfoItem other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; if (other.Id == 0 && Id == 0) return false; else return other.Id == Id; }
public FareTypeInfoItemViewModel(BookingFareInfoItem i, bool isSelected) { FareInfoItem = i; IsSelected = isSelected; }