private bool TryUpdateFarePrice(FareInfo fare, HtmlNode html) { string scripts = html.SelectNodes("//script") .Select(s => s.InnerText) .Aggregate((a, b) => a + b); //could do a trycatch Match matcher = Regex.Match(scripts, $@"price_{fare.Id}.+'data-price','(\d+.\d+)'"); if (matcher.Success) { fare.Price = decimal.Parse(matcher.Groups[1].Value); Match recoMatch = Regex.Match(scripts, $@"recoHidden_{fare.Id}', '(\d+)'"); if (recoMatch.Success) { string reco = recoMatch.Groups[1].Value; Match taxMatch = Regex.Match(scripts, $@"'tax':'(\d+.\d+)'.+recommendation, "".*""{reco}""", RegexOptions.Multiline); fare.Taxes = taxMatch.Success ? decimal.Parse(taxMatch.Groups[2].Value) : -1; } return(true); } else { return(false); } }
/// <summary> /// Saves a record to the fare table. /// </summary> public virtual void Insert(FareInfo fareInfo) { try { new FareTFM().Insert(fareInfo); } catch (Exception ex) { //Provider.Log.Error(ex, "TFM.Biz.Implements.Fare - Insert" + ex.Message); throw; } }
/// <summary> /// Saves a record to the fare table. /// </summary> public virtual void Insert(FareInfo fareInfo) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@car_group", fareInfo.Car_group), new SqlParameter("@ticket_type", fareInfo.Ticket_type), new SqlParameter("@station", fareInfo.Station), new SqlParameter("@price", fareInfo.Price), new SqlParameter("@apply_date", fareInfo.Apply_date), new SqlParameter("@created_date", fareInfo.Created_date), new SqlParameter("@is_active", fareInfo.Is_active) }; fareInfo.Fareid = (int) SqlClientUtility.ExecuteScalar(connectionStringName, CommandType.StoredProcedure, "fare_Insert", parameters); }
private List <FareInfo> GetAvailableFares(HtmlNode node) { var fares = new List <FareInfo>(); var fareNodes = node.SelectNodes("td[contains(@class, 'fare')]"); foreach (var n in fareNodes) { FareInfo fare = new FareInfo(); Match matcher = Regex.Match(n.Id, @"^reco_(\d.+)$"); fare.Id = matcher.Groups[1].Value; bool success = TryUpdateFarePrice(fare, node); if (success) { fares.Add(fare); } } return(fares); }
private IEnumerable <FareInfo> ParseFareData(HtmlNode fareRow) { var fareInfo = fareRow.SelectNodes(".//td[contains(@class, 'fareselect')]"); var result = new List <FareInfo>(); foreach (var fl in fareInfo) { string value = fl.SelectSingleNode(".//input[@value]").Attributes["value"].Value; string priceText = fl.SelectSingleNode(".//label[@title='EUR']").InnerText; decimal price; if (Decimal.TryParse(priceText, out price) && !value.Equals("")) { var fare = new FareInfo { Price = price, Type = value }; result.Add(fare); } } return(result.Count() > 0 ? result : null); }
/// <summary> /// Constructor to add new vehicle type to the database /// </summary> /// <param name="name">Name of the type</param> /// <param name="fareInfo">Information of the fare</param> public VehicleType(string name, FareInfo fareInfo) { dbCommand = new SqlCommand("AddNewVehicleType", dbConnection); dbCommand.CommandType = System.Data.CommandType.StoredProcedure; dbCommand.Parameters.Add(new SqlParameter("@name", System.Data.SqlDbType.VarChar)).Value = name; dbCommand.Parameters.Add(new SqlParameter("@pickupFare", System.Data.SqlDbType.SmallMoney)).Value = fareInfo.PickUpFee; dbCommand.Parameters.Add(new SqlParameter("@dropoffFare", System.Data.SqlDbType.SmallMoney)).Value = fareInfo.DropOffFee; dbCommand.Parameters.Add(new SqlParameter("@gst", System.Data.SqlDbType.Decimal)).Value = fareInfo.Gst; dbCommand.Parameters.Add(new SqlParameter("@sCharges", System.Data.SqlDbType.Decimal)).Value = fareInfo.ServiceCharges; dbCommand.Parameters.Add(new SqlParameter("@distanceTravelledPerKmFee", System.Data.SqlDbType.SmallMoney)).Value = fareInfo.DistanceTravelledPerKmFee; dbCommand.Parameters.Add(new SqlParameter("@date", System.Data.SqlDbType.Date)).Value = DateTime.Now; dbConnection.Open(); try { id = Convert.ToInt32(dbCommand.ExecuteScalar()); } catch (SqlException ex) { dbConnection.Close(); throw new DbQueryProcessingFailedException("VehicleType->Constructor(string, FareInfo)", ex); } dbConnection.Close(); this.name = name; }
private AirPricingSolution AddAirPriceSolution(AirService.AirPricingSolution lowestPrice, AirService.AirItinerary airItinerary) { AirPricingSolution finalPrice = new AirPricingSolution() { Key = lowestPrice.Key, TotalPrice = lowestPrice.TotalPrice, BasePrice = lowestPrice.BasePrice, ApproximateTotalPrice = lowestPrice.ApproximateTotalPrice, ApproximateBasePrice = lowestPrice.ApproximateBasePrice, Taxes = lowestPrice.Taxes, ApproximateTaxes = lowestPrice.ApproximateTaxes, QuoteDate = lowestPrice.QuoteDate }; List <typeBaseAirSegment> finalSegments = new List <typeBaseAirSegment>(); List <AirPricingInfo> finalPriceInfo = new List <AirPricingInfo>(); foreach (var segmentRef in lowestPrice.AirSegmentRef) { foreach (var segment in airItinerary.AirSegment) { if (segmentRef.Key.CompareTo(segment.Key) == 0) { typeBaseAirSegment univSeg = new typeBaseAirSegment() { ArrivalTime = segment.ArrivalTime, AvailabilityDisplayType = segment.AvailabilityDisplayType, AvailabilitySource = segment.AvailabilitySource, Carrier = segment.Carrier, ChangeOfPlane = segment.ChangeOfPlane, ClassOfService = segment.ClassOfService, DepartureTime = segment.DepartureTime, Destination = segment.Destination, Distance = segment.Distance, Equipment = segment.Equipment, FlightNumber = segment.FlightNumber, FlightTime = segment.FlightTime, Group = segment.Group, Key = segment.Key, LinkAvailability = segment.LinkAvailability, OptionalServicesIndicator = segment.OptionalServicesIndicator, Origin = segment.Origin, ParticipantLevel = segment.ParticipantLevel, PolledAvailabilityOption = segment.PolledAvailabilityOption, ProviderCode = segment.ProviderCode, TravelTime = segment.TravelTime, }; finalSegments.Add(univSeg); break; } } } foreach (var priceInfo in lowestPrice.AirPricingInfo) { AirPricingInfo info = new AirPricingInfo() { ApproximateBasePrice = priceInfo.ApproximateBasePrice, ApproximateTotalPrice = priceInfo.ApproximateTotalPrice, BasePrice = priceInfo.BasePrice, ETicketability = (typeEticketability)priceInfo.ETicketability, IncludesVAT = priceInfo.IncludesVAT, Key = priceInfo.Key, LatestTicketingTime = priceInfo.LatestTicketingTime, //PlatingCarrier = priceInfo.PlatingCarrier, Optional but might be required for some carriers PricingMethod = (typePricingMethod)priceInfo.PricingMethod, ProviderCode = priceInfo.ProviderCode, Taxes = priceInfo.Taxes, TotalPrice = priceInfo.TotalPrice, }; List <FareInfo> fareInfoList = new List <FareInfo>(); List <ManualFareAdjustment> fareAdjustmentList = new List <ManualFareAdjustment>(); ManualFareAdjustment adjustment = new ManualFareAdjustment() { AdjustmentType = typeAdjustmentType.Amount, AppliedOn = typeAdjustmentTarget.Base, Value = +40, PassengerRef = "gr8AVWGCR064r57Jt0+8bA==" }; fareAdjustmentList.Add(adjustment); info.AirPricingModifiers = new AirPricingModifiers() { ManualFareAdjustment = fareAdjustmentList.ToArray() }; foreach (var fareInfo in priceInfo.FareInfo) { FareInfo createInfo = new FareInfo() { Amount = fareInfo.Amount, DepartureDate = fareInfo.DepartureDate, Destination = fareInfo.Destination, EffectiveDate = fareInfo.EffectiveDate, FareBasis = fareInfo.FareBasis, Key = fareInfo.Key, NotValidAfter = fareInfo.NotValidAfter, NotValidBefore = fareInfo.NotValidBefore, Origin = fareInfo.Origin, PassengerTypeCode = fareInfo.PassengerTypeCode, PrivateFare = (typePrivateFare)fareInfo.PrivateFare, PseudoCityCode = fareInfo.PseudoCityCode, FareRuleKey = new FareRuleKey() { FareInfoRef = fareInfo.FareRuleKey.FareInfoRef, ProviderCode = fareInfo.FareRuleKey.ProviderCode, Value = fareInfo.FareRuleKey.Value } }; List <Endorsement> endorsementList = new List <Endorsement>(); if (fareInfo.Endorsement != null) { foreach (var endorse in fareInfo.Endorsement) { Endorsement createEndorse = new Endorsement() { Value = endorse.Value }; endorsementList.Add(createEndorse); } createInfo.Endorsement = endorsementList.ToArray(); } fareInfoList.Add(createInfo); } info.FareInfo = fareInfoList.ToArray(); List <BookingInfo> bInfo = new List <BookingInfo>(); foreach (var bookingInfo in priceInfo.BookingInfo) { BookingInfo createBookingInfo = new BookingInfo() { BookingCode = bookingInfo.BookingCode, CabinClass = bookingInfo.CabinClass, FareInfoRef = bookingInfo.FareInfoRef, SegmentRef = bookingInfo.SegmentRef }; bInfo.Add(createBookingInfo); } info.BookingInfo = bInfo.ToArray(); List <typeTaxInfo> taxes = new List <typeTaxInfo>(); foreach (var tax in priceInfo.TaxInfo) { typeTaxInfo createTaxInfo = new typeTaxInfo() { Amount = tax.Amount, Category = tax.Category, Key = tax.Key }; taxes.Add(createTaxInfo); } info.TaxInfo = taxes.ToArray(); info.FareCalc = priceInfo.FareCalc; List <PassengerType> passengers = new List <PassengerType>(); /*foreach (var pass in priceInfo.PassengerType) * { * PassengerType passType = new PassengerType() * { * BookingTravelerRef = pass.BookingTravelerRef, * Code = pass.BookingTravelerRef * }; * * passengers.Add(passType); * }*/ passengers.Add(new PassengerType() { Code = "ADT", BookingTravelerRef = "gr8AVWGCR064r57Jt0+8bA==" }); info.PassengerType = passengers.ToArray(); if (priceInfo.ChangePenalty != null) { info.ChangePenalty = new typeFarePenalty() { Amount = priceInfo.ChangePenalty.Amount }; } List <BaggageAllowanceInfo> baggageInfoList = new List <BaggageAllowanceInfo>(); foreach (var allowanceInfo in priceInfo.BaggageAllowances.BaggageAllowanceInfo) { BaggageAllowanceInfo createBaggageInfo = new BaggageAllowanceInfo() { Carrier = allowanceInfo.Carrier, Destination = allowanceInfo.Destination, Origin = allowanceInfo.Origin, TravelerType = allowanceInfo.TravelerType }; List <URLInfo> urlInfoList = new List <URLInfo>(); foreach (var url in allowanceInfo.URLInfo) { URLInfo urlInfo = new URLInfo() { URL = url.URL }; urlInfoList.Add(urlInfo); } createBaggageInfo.URLInfo = urlInfoList.ToArray(); List <ConsoleApplication1.UniversalService.TextInfo> textInfoList = new List <UniversalService.TextInfo>(); foreach (var textData in allowanceInfo.TextInfo) { ConsoleApplication1.UniversalService.TextInfo textInfo = new UniversalService.TextInfo() { Text = textData.Text }; textInfoList.Add(textInfo); } createBaggageInfo.TextInfo = textInfoList.ToArray(); List <BagDetails> bagDetailsList = new List <BagDetails>(); foreach (var bagDetails in allowanceInfo.BagDetails) { BagDetails bag = new BagDetails() { ApplicableBags = bagDetails.ApplicableBags, ApproximateBasePrice = bagDetails.ApproximateBasePrice, ApproximateTotalPrice = bagDetails.ApproximateTotalPrice, BasePrice = bagDetails.BasePrice, TotalPrice = bagDetails.TotalPrice, }; List <BaggageRestriction> bagRestictionList = new List <BaggageRestriction>(); foreach (var restriction in bagDetails.BaggageRestriction) { List <ConsoleApplication1.UniversalService.TextInfo> restrictionTextList = new List <UniversalService.TextInfo>(); foreach (var bagResTextInfo in restriction.TextInfo) { ConsoleApplication1.UniversalService.TextInfo resText = new UniversalService.TextInfo() { Text = bagResTextInfo.Text }; restrictionTextList.Add(resText); } BaggageRestriction bagRes = new BaggageRestriction() { TextInfo = restrictionTextList.ToArray() }; bagRestictionList.Add(bagRes); } bag.BaggageRestriction = bagRestictionList.ToArray(); bagDetailsList.Add(bag); } createBaggageInfo.BagDetails = bagDetailsList.ToArray(); baggageInfoList.Add(createBaggageInfo); } List <CarryOnAllowanceInfo> carryOnAllowanceList = new List <CarryOnAllowanceInfo>(); foreach (var carryOnBag in priceInfo.BaggageAllowances.CarryOnAllowanceInfo) { CarryOnAllowanceInfo carryOn = new CarryOnAllowanceInfo() { Carrier = carryOnBag.Carrier, Destination = carryOnBag.Destination, Origin = carryOnBag.Origin }; carryOnAllowanceList.Add(carryOn); } List <BaseBaggageAllowanceInfo> embargoInfoList = new List <BaseBaggageAllowanceInfo>(); if (priceInfo.BaggageAllowances.EmbargoInfo != null) { foreach (AirService.BaseBaggageAllowanceInfo embargoInfo in priceInfo.BaggageAllowances.EmbargoInfo) { BaseBaggageAllowanceInfo embargo = new BaseBaggageAllowanceInfo() { Carrier = embargoInfo.Carrier, Destination = embargoInfo.Destination, Origin = embargoInfo.Origin }; List <URLInfo> embargoURLList = new List <URLInfo>(); foreach (var embargoUrl in embargoInfo.URLInfo) { URLInfo url = new URLInfo() { URL = embargoUrl.URL, Text = embargoUrl.Text }; embargoURLList.Add(url); } embargo.URLInfo = embargoURLList.ToArray(); List <ConsoleApplication1.UniversalService.TextInfo> embargoTextList = new List <UniversalService.TextInfo>(); foreach (var embargoText in embargoInfo.TextInfo) { ConsoleApplication1.UniversalService.TextInfo text = new UniversalService.TextInfo() { Text = embargoText.Text }; embargoTextList.Add(text); } embargo.TextInfo = embargoTextList.ToArray(); embargoInfoList.Add(embargo); } } info.BaggageAllowances = new BaggageAllowances() { BaggageAllowanceInfo = baggageInfoList.ToArray(), CarryOnAllowanceInfo = carryOnAllowanceList.ToArray(), EmbargoInfo = embargoInfoList.ToArray() }; finalPriceInfo.Add(info); break; } finalPrice.AirPricingInfo = finalPriceInfo.ToArray(); finalPrice.AirSegment = finalSegments.ToArray(); return(finalPrice); }
protected void CopyTo <T>(T dataItem) where T : BasePNRDataItem { dataItem.ID = ID; dataItem.IDInPNR = IDInPNR; dataItem.Type = Type; if (TravellerRef != null) { dataItem.TravellerRef = new RefList <int>(TravellerRef); } if (ServiceRef != null) { dataItem.ServiceRef = new RefList <int>(ServiceRef); } if (SegmentRef != null) { dataItem.SegmentRef = new RefList <int>(SegmentRef); } #region Клонирование внутренних элементов switch (Type) { case PNRDataItemType.Remark: dataItem.Remark = Remark?.Copy(); break; case PNRDataItemType.TL: dataItem.TimeLimits = TimeLimits?.Copy(); break; case PNRDataItemType.SSR: dataItem.SSR = SSR?.DeepCopy(); break; case PNRDataItemType.Commission: dataItem.Commission = Commission?.Copy(); break; case PNRDataItemType.FOP: dataItem.FOPInfo = FOPInfo?.Copy(); break; case PNRDataItemType.SourceInfo: dataItem.SourceInfo = SourceInfo?.Copy(); break; case PNRDataItemType.IDDocument: dataItem.Document = Document?.Copy(); break; case PNRDataItemType.ContactInfo: dataItem.ContactInfo = ContactInfo?.Copy(); break; case PNRDataItemType.LoyaltyCard: dataItem.LoyaltyCard = LoyaltyCard?.Copy(); break; case PNRDataItemType.Meal: dataItem.Meal = Meal?.DeepCopy(); break; case PNRDataItemType.ED: dataItem.ElectronicDocument = ElectronicDocument?.DeepCopy(); break; case PNRDataItemType.PD: dataItem.PaperDocument = PaperDocument?.Copy(); break; case PNRDataItemType.FE: dataItem.Endorsements = Endorsements?.Copy(); break; case PNRDataItemType.Visa: dataItem.Visa = Visa?.Copy(); break; case PNRDataItemType.ArrivalAddress: dataItem.ArrivalAddress = ArrivalAddress?.Copy(); break; case PNRDataItemType.BookedSeat: dataItem.BookedSeat = BookedSeat?.Copy(); break; case PNRDataItemType.ValidatingCompany: dataItem.ValidatingCompany = ValidatingCompany?.Copy(); break; case PNRDataItemType.TourCode: dataItem.TourCode = TourCode?.Copy(); break; case PNRDataItemType.Discount: dataItem.Discount = Discount?.Copy(); break; case PNRDataItemType.FareSourceCode: dataItem.FareSourceCode = FareSourceCode?.Copy(); break; case PNRDataItemType.AdditionalLocators: dataItem.AdditionalLocators = AdditionalLocators?.Copy(); break; case PNRDataItemType.OSI: dataItem.OSI = OSI?.Copy(); break; case PNRDataItemType.ReferencedBooks: dataItem.ReferencedBooks = ReferencedBooks?.Copy(); break; case PNRDataItemType.FareInfo: dataItem.FareInfo = FareInfo?.Copy(); break; case PNRDataItemType.DiscountDocument: dataItem.DiscountDocument = DiscountDocument?.Copy(); break; case PNRDataItemType.VoucherFile: dataItem.Voucher = Voucher?.Copy(); break; case PNRDataItemType.LinkedBooks: dataItem.LinkedBooks = LinkedBooks?.Copy(); break; } #endregion }
private AirPricingSolution AddAirPriceSolution(AirService.AirPricingSolution lowestPrice, AirService.AirItinerary airItinerary) { AirPricingSolution finalPrice = new AirPricingSolution() { Key = lowestPrice.Key, TotalPrice = lowestPrice.TotalPrice, BasePrice = lowestPrice.BasePrice, ApproximateTotalPrice = lowestPrice.ApproximateTotalPrice, ApproximateBasePrice = lowestPrice.ApproximateBasePrice, Taxes = lowestPrice.Taxes, ApproximateTaxes = lowestPrice.ApproximateTaxes, QuoteDate = lowestPrice.QuoteDate }; List<typeBaseAirSegment> finalSegments = new List<typeBaseAirSegment>(); List<AirPricingInfo> finalPriceInfo =new List<AirPricingInfo>(); foreach (var segmentRef in lowestPrice.AirSegmentRef) { foreach (var segment in airItinerary.AirSegment) { if (segmentRef.Key.CompareTo(segment.Key) == 0) { typeBaseAirSegment univSeg = new typeBaseAirSegment() { ArrivalTime = segment.ArrivalTime, AvailabilityDisplayType = segment.AvailabilityDisplayType, AvailabilitySource = segment.AvailabilitySource, Carrier = segment.Carrier, ChangeOfPlane = segment.ChangeOfPlane, ClassOfService = segment.ClassOfService, DepartureTime = segment.DepartureTime, Destination = segment.Destination, Distance = segment.Distance, Equipment = segment.Equipment, FlightNumber = segment.FlightNumber, FlightTime = segment.FlightTime, Group = segment.Group, Key = segment.Key, LinkAvailability = segment.LinkAvailability, OptionalServicesIndicator = segment.OptionalServicesIndicator, Origin = segment.Origin, ParticipantLevel = segment.ParticipantLevel, PolledAvailabilityOption = segment.PolledAvailabilityOption, ProviderCode = segment.ProviderCode, TravelTime = segment.TravelTime, }; finalSegments.Add(univSeg); break; } } } foreach (var priceInfo in lowestPrice.AirPricingInfo) { AirPricingInfo info = new AirPricingInfo() { ApproximateBasePrice = priceInfo.ApproximateBasePrice, ApproximateTotalPrice = priceInfo.ApproximateTotalPrice, BasePrice = priceInfo.BasePrice, ETicketability = (typeEticketability)priceInfo.ETicketability, IncludesVAT = priceInfo.IncludesVAT, Key = priceInfo.Key, LatestTicketingTime = priceInfo.LatestTicketingTime, //PlatingCarrier = priceInfo.PlatingCarrier, Optional but might be required for some carriers PricingMethod = (typePricingMethod)priceInfo.PricingMethod, ProviderCode = priceInfo.ProviderCode, Taxes = priceInfo.Taxes, TotalPrice = priceInfo.TotalPrice, }; List<FareInfo> fareInfoList = new List<FareInfo>(); List<ManualFareAdjustment> fareAdjustmentList = new List<ManualFareAdjustment>(); ManualFareAdjustment adjustment = new ManualFareAdjustment() { AdjustmentType = typeAdjustmentType.Amount, AppliedOn = typeAdjustmentTarget.Base, Value = +40, PassengerRef = "gr8AVWGCR064r57Jt0+8bA==" }; fareAdjustmentList.Add(adjustment); info.AirPricingModifiers = new AirPricingModifiers() { ManualFareAdjustment = fareAdjustmentList.ToArray() }; foreach (var fareInfo in priceInfo.FareInfo) { FareInfo createInfo = new FareInfo() { Amount = fareInfo.Amount, DepartureDate = fareInfo.DepartureDate, Destination = fareInfo.Destination, EffectiveDate = fareInfo.EffectiveDate, FareBasis = fareInfo.FareBasis, Key = fareInfo.Key, NotValidAfter = fareInfo.NotValidAfter, NotValidBefore = fareInfo.NotValidBefore, Origin = fareInfo.Origin, PassengerTypeCode = fareInfo.PassengerTypeCode, PrivateFare = (typePrivateFare)fareInfo.PrivateFare, PseudoCityCode = fareInfo.PseudoCityCode, FareRuleKey = new FareRuleKey() { FareInfoRef = fareInfo.FareRuleKey.FareInfoRef, ProviderCode = fareInfo.FareRuleKey.ProviderCode, Value = fareInfo.FareRuleKey.Value } }; List<Endorsement> endorsementList = new List<Endorsement>(); if (fareInfo.Endorsement != null) { foreach (var endorse in fareInfo.Endorsement) { Endorsement createEndorse = new Endorsement() { Value = endorse.Value }; endorsementList.Add(createEndorse); } createInfo.Endorsement = endorsementList.ToArray(); } fareInfoList.Add(createInfo); } info.FareInfo = fareInfoList.ToArray(); List<BookingInfo> bInfo = new List<BookingInfo>(); foreach (var bookingInfo in priceInfo.BookingInfo) { BookingInfo createBookingInfo = new BookingInfo() { BookingCode = bookingInfo.BookingCode, CabinClass = bookingInfo.CabinClass, FareInfoRef = bookingInfo.FareInfoRef, SegmentRef = bookingInfo.SegmentRef }; bInfo.Add(createBookingInfo); } info.BookingInfo = bInfo.ToArray(); List<typeTaxInfo> taxes = new List<typeTaxInfo>(); foreach (var tax in priceInfo.TaxInfo) { typeTaxInfo createTaxInfo = new typeTaxInfo() { Amount = tax.Amount, Category = tax.Category, Key = tax.Key }; taxes.Add(createTaxInfo); } info.TaxInfo = taxes.ToArray(); info.FareCalc = priceInfo.FareCalc; List<PassengerType> passengers = new List<PassengerType>(); /*foreach (var pass in priceInfo.PassengerType) { PassengerType passType = new PassengerType() { BookingTravelerRef = pass.BookingTravelerRef, Code = pass.BookingTravelerRef }; passengers.Add(passType); }*/ passengers.Add(new PassengerType() { Code = "ADT", BookingTravelerRef = "gr8AVWGCR064r57Jt0+8bA==" }); info.PassengerType = passengers.ToArray(); if (priceInfo.ChangePenalty != null) { info.ChangePenalty = new typeFarePenalty() { Amount = priceInfo.ChangePenalty.Amount }; } List<BaggageAllowanceInfo> baggageInfoList = new List<BaggageAllowanceInfo>(); foreach (var allowanceInfo in priceInfo.BaggageAllowances.BaggageAllowanceInfo) { BaggageAllowanceInfo createBaggageInfo = new BaggageAllowanceInfo() { Carrier = allowanceInfo.Carrier, Destination = allowanceInfo.Destination, Origin = allowanceInfo.Origin, TravelerType = allowanceInfo.TravelerType }; List<URLInfo> urlInfoList = new List<URLInfo>(); foreach (var url in allowanceInfo.URLInfo) { URLInfo urlInfo = new URLInfo() { URL = url.URL }; urlInfoList.Add(urlInfo); } createBaggageInfo.URLInfo = urlInfoList.ToArray(); List<ConsoleApplication1.UniversalService.TextInfo> textInfoList = new List<UniversalService.TextInfo>(); foreach (var textData in allowanceInfo.TextInfo) { ConsoleApplication1.UniversalService.TextInfo textInfo = new UniversalService.TextInfo() { Text = textData.Text }; textInfoList.Add(textInfo); } createBaggageInfo.TextInfo = textInfoList.ToArray(); List<BagDetails> bagDetailsList = new List<BagDetails>(); foreach (var bagDetails in allowanceInfo.BagDetails) { BagDetails bag = new BagDetails() { ApplicableBags = bagDetails.ApplicableBags, ApproximateBasePrice = bagDetails.ApproximateBasePrice, ApproximateTotalPrice = bagDetails.ApproximateTotalPrice, BasePrice = bagDetails.BasePrice, TotalPrice = bagDetails.TotalPrice, }; List<BaggageRestriction> bagRestictionList = new List<BaggageRestriction>(); foreach (var restriction in bagDetails.BaggageRestriction) { List<ConsoleApplication1.UniversalService.TextInfo> restrictionTextList = new List<UniversalService.TextInfo>(); foreach (var bagResTextInfo in restriction.TextInfo) { ConsoleApplication1.UniversalService.TextInfo resText = new UniversalService.TextInfo() { Text = bagResTextInfo.Text }; restrictionTextList.Add(resText); } BaggageRestriction bagRes = new BaggageRestriction() { TextInfo = restrictionTextList.ToArray() }; bagRestictionList.Add(bagRes); } bag.BaggageRestriction = bagRestictionList.ToArray(); bagDetailsList.Add(bag); } createBaggageInfo.BagDetails = bagDetailsList.ToArray(); baggageInfoList.Add(createBaggageInfo); } List<CarryOnAllowanceInfo> carryOnAllowanceList = new List<CarryOnAllowanceInfo>(); foreach (var carryOnBag in priceInfo.BaggageAllowances.CarryOnAllowanceInfo) { CarryOnAllowanceInfo carryOn = new CarryOnAllowanceInfo() { Carrier = carryOnBag.Carrier, Destination = carryOnBag.Destination, Origin = carryOnBag.Origin }; carryOnAllowanceList.Add(carryOn); } List<BaseBaggageAllowanceInfo> embargoInfoList = new List<BaseBaggageAllowanceInfo>(); if(priceInfo.BaggageAllowances.EmbargoInfo != null) { foreach(AirService.BaseBaggageAllowanceInfo embargoInfo in priceInfo.BaggageAllowances.EmbargoInfo) { BaseBaggageAllowanceInfo embargo = new BaseBaggageAllowanceInfo() { Carrier = embargoInfo.Carrier, Destination = embargoInfo.Destination, Origin = embargoInfo.Origin }; List<URLInfo> embargoURLList = new List<URLInfo>(); foreach(var embargoUrl in embargoInfo.URLInfo){ URLInfo url = new URLInfo() { URL = embargoUrl.URL, Text = embargoUrl.Text }; embargoURLList.Add(url); } embargo.URLInfo = embargoURLList.ToArray(); List<ConsoleApplication1.UniversalService.TextInfo> embargoTextList = new List<UniversalService.TextInfo>(); foreach(var embargoText in embargoInfo.TextInfo){ ConsoleApplication1.UniversalService.TextInfo text = new UniversalService.TextInfo() { Text = embargoText.Text }; embargoTextList.Add(text); } embargo.TextInfo = embargoTextList.ToArray(); embargoInfoList.Add(embargo); } } info.BaggageAllowances = new BaggageAllowances() { BaggageAllowanceInfo = baggageInfoList.ToArray(), CarryOnAllowanceInfo = carryOnAllowanceList.ToArray(), EmbargoInfo = embargoInfoList.ToArray() }; finalPriceInfo.Add(info); break; } finalPrice.AirPricingInfo = finalPriceInfo.ToArray(); finalPrice.AirSegment = finalSegments.ToArray(); return finalPrice; }
/// <summary> /// Method to update fare information about the vehicle type /// </summary> /// <param name="fareInfo">Information about fare</param> /// <returns></returns> public Fare UpdateFare(FareInfo fareInfo) { return(new Fare(fareInfo.PickUpFee, fareInfo.DropOffFee, fareInfo.Gst, fareInfo.ServiceCharges, fareInfo.DistanceTravelledPerKmFee, DateTime.Now, this)); }
/// <summary> /// Saves a record to the fare table. /// </summary> public virtual void Update(FareInfo fareInfo) { try { new FareTFM().Update(fareInfo); } catch (Exception ex) { //Log error by TFM framwork here //Provider.Log.Error(ex, "TFM.Biz.Implements.Fare - Update" + ex.Message); throw; } }
/// <summary> /// Creates a new instance of the fare class and populates it with data from the specified SqlDataReader. /// </summary> protected virtual FareInfo MakeFareInfo(SqlDataReader dataReader) { FareInfo fareInfo = new FareInfo(); fareInfo.Fareid = SqlClientUtility.GetInt32(dataReader,DbConstants.FARE.FAREID, 0); fareInfo.Car_group = SqlClientUtility.GetInt32(dataReader,DbConstants.FARE.CAR_GROUP, 0); fareInfo.Ticket_type = SqlClientUtility.GetInt32(dataReader,DbConstants.FARE.TICKET_TYPE, 0); fareInfo.Station = SqlClientUtility.GetInt32(dataReader,DbConstants.FARE.STATION, 0); fareInfo.Price = SqlClientUtility.GetString(dataReader,DbConstants.FARE.PRICE, String.Empty); fareInfo.Apply_date = SqlClientUtility.GetInt32(dataReader,DbConstants.FARE.APPLY_DATE, 0); fareInfo.Created_date = SqlClientUtility.GetInt32(dataReader,DbConstants.FARE.CREATED_DATE, 0); fareInfo.Is_active = SqlClientUtility.GetInt32(dataReader,DbConstants.FARE.IS_ACTIVE, 0); return fareInfo; }