Пример #1
0
        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;
            }
        }
Пример #2
0
     private void FixupFareTypeName(FareTypeName previousValue)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (previousValue != null && previousValue.FareTypeNameVehicles.Contains(this))
         {
             previousValue.FareTypeNameVehicles.Remove(this);
         }
 
         if (FareTypeName != null)
         {
             if (!FareTypeName.FareTypeNameVehicles.Contains(this))
             {
                 FareTypeName.FareTypeNameVehicles.Add(this);
             }
 
             FareTypeNameId = FareTypeName.Id;
         }
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("FareTypeName")
                 && (ChangeTracker.OriginalValues["FareTypeName"] == FareTypeName))
             {
                 ChangeTracker.OriginalValues.Remove("FareTypeName");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("FareTypeName", previousValue);
             }
             if (FareTypeName != null && !FareTypeName.ChangeTracker.ChangeTrackingEnabled)
             {
                 FareTypeName.StartTracking();
             }
         }
     }
Пример #3
0
     public bool Equals(FareTypeName 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;
     }