Пример #1
0
        public async Task <mdlfarequoteApi> FareQuote([FromServices] IBooking booking, mdlFareQuotRequest mdl)
        {
            mdlfarequoteApi mdlfarequote = new mdlfarequoteApi();

            if (ModelState.IsValid)
            {
                try
                {
                    booking.CustomerId    = _customerId;
                    booking.UserId        = _userId;
                    mdlfarequote.mdlQuote = await booking.FareQuoteAsync(mdl);

                    mdlfarequote.StatusCode    = 1;
                    mdlfarequote.StatusMessage = "Success";
                }
                catch (Exception ex)
                {
                    mdlfarequote.StatusCode    = 0;
                    mdlfarequote.StatusMessage = ex.Message;
                }
            }
            return(mdlfarequote);
        }
Пример #2
0
        public async Task LoadFareQuotationAsync(int CustomerId, IBooking _booking, IMarkup _markup, DBContext _context)
        {
            _booking.CustomerId   = CustomerId;
            this.FareQuotResponse = new List <mdlFareQuotResponse>();
            this.FareRule         = new List <mdlFareRuleResponse>();
            //Check Is Flight is Already Booked Coreponding to this TraceID
            if (_context.tblFlightBookingSegmentMaster.Where(p => p.TraceId == FareQuoteRequest.TraceId && p.BookingStatus != enmBookingStatus.Pending).Count() > 0)
            {
                throw new Exception("Flight Ticket is already Booked");
            }

            this.FareQuotResponse.AddRange(await _booking.FareQuoteAsync(FareQuoteRequest));
            foreach (var md in FareQuotResponse)
            {
                if (md.Results != null)
                {
                    _markup.CustomerId = CustomerId;
                    _markup.CustomerMarkup(md.Results, CustomerId);
                    _markup.WingMarkupAmount(md.Results, md.SearchQuery.AdultCount, md.SearchQuery.ChildCount, md.SearchQuery.InfantCount);
                    if (this.travellerInfo == null)
                    {
                        this.travellerInfo = new List <mdlTravellerinfo>();
                        for (int i = 0; i < md.SearchQuery.AdultCount; i++)
                        {
                            this.travellerInfo.Add(new mdlTravellerinfo()
                            {
                                Title         = "MR",
                                passengerType = enmPassengerType.Adult,
                                FirstName     = string.Empty,
                                LastName      = string.Empty,
                                cabinclass    = md.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.ADULT.CabinClass.ToString(),
                                bookingclass  = md.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.ADULT.ClassOfBooking.ToString(),
                                farebasis     = md.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.ADULT.FareBasis.ToString()
                            });
                        }
                        for (int i = 0; i < md.SearchQuery.ChildCount; i++)
                        {
                            this.travellerInfo.Add(new mdlTravellerinfo()
                            {
                                Title         = "MASTER",
                                passengerType = enmPassengerType.Child,
                                FirstName     = string.Empty,
                                LastName      = string.Empty,
                                cabinclass    = md.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.CHILD.CabinClass.ToString(),
                                bookingclass  = md.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.CHILD.ClassOfBooking.ToString(),
                                farebasis     = md.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.CHILD.FareBasis.ToString()
                            });
                        }
                        for (int i = 0; i < md.SearchQuery.InfantCount; i++)
                        {
                            this.travellerInfo.Add(new mdlTravellerinfo()
                            {
                                Title         = "MASTER",
                                passengerType = enmPassengerType.Infant,
                                FirstName     = string.Empty,
                                LastName      = string.Empty,
                                cabinclass    = md.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.INFANT.CabinClass.ToString(),
                                bookingclass  = md.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.INFANT.ClassOfBooking.ToString(),
                                farebasis     = md.Results?.FirstOrDefault()?.FirstOrDefault()?.TotalPriceList?.FirstOrDefault()?.INFANT.FareBasis.ToString()
                            });
                        }
                    }
                    _markup.WingConvenienceAmount(md, this.travellerInfo);
                    _markup.WingDiscountAmount(md, this.travellerInfo);
                    _markup.CalculateTotalPriceAfterMarkup(md.Results, md.SearchQuery.AdultCount, md.SearchQuery.ChildCount, md.SearchQuery.InfantCount, "review");
                }
            }
            await _booking.CustomerFlightDetailSave(FareQuoteRequest.TraceId, FareQuotResponse);
        }