示例#1
0
        private async Task <bool> GetDataFromMystifly(List <Domain.IssueTicketEntity> list, Models.IssueTickettModel model)
        {
            var supplierAgencyDetails = supplierAgencyServices.GetSupplierRouteBySupplierCodeAndAgencyCode(model.ticketCreateTSTFromPricing.AgencyCode
                                                                                                           , model.ticketCreateTSTFromPricing.SupplierCode, "issueticket");
            //code to add supplier details in to request
            var allSupplierBasicDetails = await supplierAgencyServices.GetSupplierAgencyBasicDetailswithsuppliercode(model.ticketCreateTSTFromPricing.AgencyCode, "T", model.ticketCreateTSTFromPricing.SupplierCode);

            model.SupplierAgencyDetails = allSupplierBasicDetails;

            model.ticketCreateTSTFromPricing.AgencyCode   = "";
            model.ticketCreateTSTFromPricing.SupplierCode = "";


            var result = await partnerClient.GetIssueTicketflight(supplierAgencyDetails.BaseUrl, supplierAgencyDetails.RequestUrl, model);

            string strData = JsonConvert.SerializeObject(result.Data);

            Domain.IssueTicketEntity partnerResponseEntity = JsonConvert.DeserializeObject <Domain.IssueTicketEntity>(strData);
            if (partnerResponseEntity != null)
            {
                if (partnerResponseEntity.TripDetailsResult.ItineraryInformation.Length > 0)
                {
                    //update details here strat
                    await supplierAgencyServices.UpdateTblBooking(partnerResponseEntity.TripDetailsResult.BookingId.ToString(), partnerResponseEntity.TripDetailsResult.ReservationItem[0].AirlinePNR);

                    await supplierAgencyServices.InsertIntotblBookingHistory(partnerResponseEntity.TripDetailsResult.BookingId.ToString(), model.ticketCreateTSTFromPricing.UserID.ToString(), "OK");

                    await supplierAgencyServices.UpdateTblAirpassemgersafterIssuedTicket(partnerResponseEntity.TripDetailsResult.BookingId.ToString(), partnerResponseEntity.TripDetailsResult.ReservationItem[0].AirlinePNR, partnerResponseEntity.TripDetailsResult.ItineraryInformation);

                    //update details here end
                }
                list.Add(partnerResponseEntity);
                return(true);
            }
            return(false);
        }
示例#2
0
        private async Task <bool> GetDataFromMystifly(List <Domain.IssueTicketEntity> list, Models.IssueTickettModel model)
        {
            var supplierAgencyDetails = supplierAgencyServices.GetSupplierRouteBySupplierCodeAndAgencyCode(model.ticketCreateTSTFromPricing.AgencyCode
                                                                                                           , model.ticketCreateTSTFromPricing.SupplierCode, "issueticket");
            List <SupplierAgencyDetails> SupplierAgencyDetailslist = new List <SupplierAgencyDetails>()
            {
                supplierAgencyDetails
            };

            model.SupplierAgencyDetails = SupplierAgencyDetailslist;
            //code to add supplier details in to request
            //var allSupplierBasicDetails = await supplierAgencyServices.GetSupplierAgencyBasicDetailswithsuppliercode(model.ticketCreateTSTFromPricing.AgencyCode, "T", model.ticketCreateTSTFromPricing.SupplierCode);
            // model.SupplierAgencyDetails = allSupplierBasicDetails;

            string req    = JsonConvert.SerializeObject(model);
            var    result = await partnerClient.GetIssueTicketflight(supplierAgencyDetails.BaseUrl, supplierAgencyDetails.RequestUrl, model);

            string strData     = JsonConvert.SerializeObject(result.Data);
            string requestStr  = JsonConvert.SerializeObject(model);
            string resposneStr = JsonConvert.SerializeObject(result);
            string agencyCode  = model.ticketCreateTSTFromPricing.AgencyCode;
            await supplierAgencyServices.SaveLog("issue-Flight", agencyCode, requestStr, resposneStr);

            if (strData != "null")
            {
                Domain.IssueTicketEntity partnerResponseEntity = null;
                partnerResponseEntity = JsonConvert.DeserializeObject <Domain.IssueTicketEntity>(strData);

                if (partnerResponseEntity != null)
                {
                    if (partnerResponseEntity.TripDetailsResult.ItineraryInformation.Length > 0)
                    {
                        string bookingStatus = partnerResponseEntity.TripDetailsResult.BookingStatus;
                        //update details here strat
                        await bookingServices.UpdateAirBookingAfterIssuedTicket(partnerResponseEntity.TripDetailsResult.ItineraryInformation,
                                                                                long.Parse(model.ticketCreateTSTFromPricing.BookingRefID),
                                                                                long.Parse(model.ticketCreateTSTFromPricing.UserID),
                                                                                partnerResponseEntity.TripDetailsResult.ReservationItem[0].AirlinePNR,
                                                                                bookingStatus);

                        //update details here end
                        partnerResponseEntity.TripDetailsResult.BookingId = model.ticketCreateTSTFromPricing.BookingRefID;
                        list.Add(partnerResponseEntity);
                    }
                    else
                    {
                        list.Add(partnerResponseEntity);
                    }

                    return(true);
                }
            }
            else
            {
                Tkerror error = new Tkerror()
                {
                    Code     = "0000",
                    Meassage = "Supplier not responding"
                };
                Tkerror[] errors = new Tkerror[] { error };
                Domain.IssueTicketEntity partnerResponseEntity = new IssueTicketEntity();
                Itineraryinformation[]   Itineraryinformations = new Itineraryinformation[0];
                Triptotalfare            triptotalfare         = new Triptotalfare()
                {
                    Currency  = "",
                    EquiFare  = "",
                    Tax       = "",
                    TotalFare = ""
                };
                Domain.Reservationitem[] reservationitems  = new Domain.Reservationitem[0];
                Tripdetailsresult        tripdetailsresult = new Tripdetailsresult()
                {
                    BookingId            = model.ticketCreateTSTFromPricing.BookingRefID,
                    Success              = "false",
                    Target               = model.ticketCreateTSTFromPricing.Target,
                    UniqueID             = model.ticketCreateTSTFromPricing.UniqueID,
                    ItineraryInformation = Itineraryinformations,
                    ReservationItem      = reservationitems,
                    TripTotalFare        = triptotalfare,
                    BookingStatus        = "",
                    TicketStatus         = "",
                    TKErrors             = errors
                };
                partnerResponseEntity.TripDetailsResult          = tripdetailsresult;
                partnerResponseEntity.TripDetailsResult.TKErrors = errors;
                list.Add(partnerResponseEntity);
                return(true);
            }
            return(false);
        }