Esempio n. 1
0
        private async Task <bool> AddSupplierDetailsToRequestObject(Models.Rootobject model, string supplierCode)
        {
            bool isAdded = false;
            List <SupplierAgencyDetails> supplierAgencyDetails = new List <SupplierAgencyDetails>();
            SupplierAgencyDetails        supplierDetails       = await supplierAgencyServices.GetSupplierAgencyBasicDetails(model.CommonRequestSearch.AgencyCode, "T", supplierCode);

            supplierAgencyDetails.Add(supplierDetails);
            if (supplierDetails != null)
            {
                model.SupplierAgencyDetails = supplierAgencyDetails;
                isAdded = true;
            }
            return(isAdded);
        }
        private static void AddSupplierDetailsToRequestObject(Models.Rootobject model, List <SupplierAgencyDetails> allSupplierAgencyDetails, string supplierCodeKey)
        {
            List <SupplierAgencyDetails> supplierAgencyDetails = new List <SupplierAgencyDetails>();
            string supplierCode = ConficBase.GetConfigAppValue(supplierCodeKey);
            SupplierAgencyDetails supplierDetails = allSupplierAgencyDetails.FirstOrDefault(x => x.SupplierCode == supplierCode);
            string amaurl = ConficBase.GetConfigAppValue(amadeusjsonurl);

            supplierDetails.BaseUrl = amaurl;
            supplierAgencyDetails.Add(supplierDetails);

            if (supplierDetails != null)
            {
                model.SupplierAgencyDetails = supplierAgencyDetails;
            }
        }
Esempio n. 3
0
        private async Task <bool> GetDataFromAmadeus(List <Domain.Rootobject> list, Models.Rootobject model, string key)
        {
            string strData = string.Empty;

            //bool isAdded = await AddSupplierDetailsToRequestObject(model, this._SupplierCodeAmadeous);
            try
            {
                SupplierAgencyDetails supplierDetails = await agenciesBasicDetails.GeBasicDetailsOfSupplier(model.CommonRequestSearch.AgencyCode, SupplierCode.AMA001.ToString(), "T");

                if (supplierDetails != null)
                {
                    supplierDetails.AgencyCode = model.CommonRequestSearch.AgencyCode;
                    List <SupplierAgencyDetails> supplierAgencyDetails = new List <SupplierAgencyDetails>();
                    supplierAgencyDetails.Add(supplierDetails);
                    // model.SupplierAgencyDetails = supplierAgencyDetails;


                    SearchFlightsAmadeous requestModel = new SearchFlightsAmadeous();
                    requestModel.cabin = model.cabin;
                    requestModel.CommonRequestSearch          = model.CommonRequestSearch;
                    requestModel.Currency                     = model.Currency;
                    requestModel.IsRefundable                 = model.IsRefundable;
                    requestModel.Maxstopquantity              = model.Maxstopquantity;
                    requestModel.NonStop                      = model.NonStop;
                    requestModel.OriginDestinationInformation = model.OriginDestinationInformation;
                    requestModel.PassengerTypeQuantity        = model.PassengerTypeQuantity;
                    requestModel.PreferenceLevel              = model.PreferenceLevel;
                    requestModel.PreferredAirline             = model.PreferredAirline;
                    requestModel.PricingSource                = model.PricingSource;
                    requestModel.RequestOption                = model.RequestOption;
                    requestModel.Target   = model.Target;
                    requestModel.Triptype = model.Triptype;
                    requestModel.SupplierAgencyDetails = supplierAgencyDetails;
                    string baseUri = supplierDetails.BaseUrl;

                    string reqUri          = ConficBase.GetConfigAppValue(ReqUrlAmadeous);
                    bool   isFetchedFromDb = false;
                    strData = await GetSupplierResponseFromDb(model, SupplierCode.AMA001.ToString(), key);

                    if (string.IsNullOrEmpty(strData))
                    {
                        // string jsonData = JsonConvert.SerializeObject(model);
                        var result = await partnerClient.GetAmadeusData(baseUri, reqUri, requestModel);

                        strData         = JsonConvert.SerializeObject(result.Data);
                        isFetchedFromDb = true;
                    }
                    Domain.Rootobject partnerResponseEntity = JsonConvert.DeserializeObject <Domain.Rootobject>(strData);
                    if (partnerResponseEntity != null)
                    {
                        if (partnerResponseEntity.fareMasterPricerTravelBoardSearchReply.flightIndex != null &&
                            partnerResponseEntity.fareMasterPricerTravelBoardSearchReply.flightIndex.ToList().Count() > 0)
                        {
                            list.Add(partnerResponseEntity);
                            if (isFetchedFromDb)
                            {
                                AddSearchDetails(model, strData, ConficBase.GetConfigAppValue(SupplierCodeAmadeous), key);
                            }

                            return(true);
                        }
                    }
                }
            }catch (Exception ex)
            {
                throw ex;
            }

            return(false);
        }