public void SetFareQuoteCondtion() { if (FareQuoteCondition == null) { FareQuoteCondition = new mdlFareQuoteCondition() { dob = new mdlDobCondition() { adobr = FareQuotResponse.Any(p => p.FareQuoteCondition?.dob?.adobr ?? false), cdobr = FareQuotResponse.Any(p => p.FareQuoteCondition?.dob?.cdobr ?? false), idobr = FareQuotResponse.Any(p => p.FareQuoteCondition?.dob?.idobr ?? false), }, GstCondition = new mdlGstCondition() { IsGstMandatory = FareQuotResponse.Any(p => p.FareQuoteCondition?.GstCondition?.IsGstMandatory ?? false), IsGstApplicable = FareQuotResponse.Any(p => p.FareQuoteCondition?.GstCondition?.IsGstApplicable ?? false), }, IsHoldApplicable = FareQuotResponse.All(p => p.FareQuoteCondition?.IsHoldApplicable ?? false), PassportCondition = new mdlPassportCondition() { IsPassportExpiryDate = FareQuotResponse.Any(p => p.FareQuoteCondition?.PassportCondition?.IsPassportExpiryDate ?? false), isPassportIssueDate = FareQuotResponse.Any(p => p.FareQuoteCondition?.PassportCondition?.isPassportIssueDate ?? false), isPassportRequired = FareQuotResponse.Any(p => p.FareQuoteCondition?.PassportCondition?.isPassportRequired ?? false), }, IsLCC = FareQuotResponse.All(p => p.FareQuoteCondition?.IsLCC ?? false), }; } }
public void SetFareAmount() { AdultTotalBaseFare = FareQuotResponse.Select(p => p.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.ADULT?.FareComponent?.BaseFare ?? 0).Sum(); ChildTotalBaseFare = FareQuotResponse.Select(p => p.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.CHILD?.FareComponent?.BaseFare ?? 0).Sum(); InfantTotalBaseFare = FareQuotResponse.Select(p => p.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.INFANT?.FareComponent?.BaseFare ?? 0).Sum(); if (AdultCount > 0) { AdultBaseFare = AdultTotalBaseFare; AdultTotalBaseFare = AdultBaseFare * AdultCount; } if (ChildCount > 0) { ChildBaseFare = ChildTotalBaseFare; ChildTotalBaseFare = ChildBaseFare * ChildCount; } if (InfantCount > 0) { InfantBaseFare = InfantTotalBaseFare; InfantTotalBaseFare = InfantBaseFare * InfantCount; } TotalBaseFare = AdultTotalBaseFare + ChildTotalBaseFare + InfantTotalBaseFare; TotalFare = FareQuotResponse.Select(p => p.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.TotalPrice ?? 0).Sum(); FeeSurcharge = TotalFare - TotalBaseFare; OtherCharge = 0; Convenience = FareQuotResponse.Select(p => p.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.Convenience ?? 0).Sum(); TotalOtherCharge = OtherCharge + Convenience; NetFare = TotalOtherCharge + TotalFare; }
public void BookingRequestDefaultData() { if (FareQuotResponse == null || FareQuotResponse.Count == 0) { return; } if (travellerInfo == null) { travellerInfo = new List <mdlTravellerinfo>(); int AdultCount = FareQuotResponse?.FirstOrDefault()?.SearchQuery?.AdultCount ?? 0; int ChildCount = FareQuotResponse?.FirstOrDefault()?.SearchQuery?.ChildCount ?? 0; int InfantCount = FareQuotResponse?.FirstOrDefault()?.SearchQuery?.InfantCount ?? 0; this.AdultCount = AdultCount; this.ChildCount = ChildCount; this.InfantCount = InfantCount; while (AdultCount > 0) { travellerInfo.Add(new mdlTravellerinfo() { passengerType = enmPassengerType.Adult }); AdultCount--; } while (ChildCount > 0) { travellerInfo.Add(new mdlTravellerinfo() { passengerType = enmPassengerType.Child }); ChildCount--; } while (InfantCount > 0) { travellerInfo.Add(new mdlTravellerinfo() { passengerType = enmPassengerType.Infant }); InfantCount--; } } else { this.AdultCount = FareQuotResponse?.FirstOrDefault()?.SearchQuery?.AdultCount ?? 0; this.ChildCount = FareQuotResponse?.FirstOrDefault()?.SearchQuery?.ChildCount ?? 0; this.InfantCount = FareQuotResponse?.FirstOrDefault()?.SearchQuery?.InfantCount ?? 0; } SetFareQuoteCondtion(); SetFareAmount(); }