コード例 #1
0
        private async Task <bool> GetDataFromAmadeus(List <Domain.Rootobject> list, Models.Rootobject model, List <SupplierAgencyDetails> allSupplierAgencyDetails, string key)
        {
            string strData = string.Empty;

            AddSupplierDetailsToRequestObject(model, allSupplierAgencyDetails, SupplierCodeAmadeous);

            string baseUri         = ConficBase.GetConfigAppValue(BaseUrlAmadeous);
            string reqUri          = ConficBase.GetConfigAppValue(ReqUrlAmadeous);
            bool   isFetchedFromDb = false;

            //  strData = await GetSupplierResponseFromDb(model, ConficBase.GetConfigAppValue(SupplierCodeAmadeous), key);
            if (string.IsNullOrEmpty(strData))
            {
                var result = await partnerClient.GetPartnerData(baseUri, reqUri, model);

                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);
                    }
                    //CreateJSONDoc(strData, model.CommonRequestSearch.AgencyCode, ConficBase.GetConfigAppValue(SupplierCodeAmadeous), key);

                    return(true);
                }
            }
            return(false);
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        private async Task <bool> GetDataFromGTA(List <SearchInsuranceResponseEntity> list, SearchInsuranceModel model)
        {
            InsuranceSupplierCredentials supplierCredentials = await insuranceSupplierDetails.GeBasicDetailsOfIsuranceSupplier("GTA001", SupplierCode.MIS001.ToString(), "T");

            if (supplierCredentials != null)
            {
                //supplierCredentials.AgencyCode = model.SightseeingSearchRequest.AgencyCode;
                List <InsuranceSupplierCredentials> supplierAgencyDetails = new List <InsuranceSupplierCredentials>();
                supplierAgencyDetails.Add(supplierCredentials);

                //string baseUri = model.SupplierAgencyDetails.FirstOrDefault().BaseUrl;
                SearchInsuranceModel requestModel = new SearchInsuranceModel();

                string baseUri = supplierCredentials.BaseUrl;

                string strData = string.Empty;

                string reqUri          = ConficBase.GetConfigAppValue(ReqUrlGTA);
                bool   isFetchedFromDb = false;

                string req = JsonConvert.SerializeObject(model);
                if (string.IsNullOrEmpty(strData))
                {
                    // var result = await partnerClient.GetMystiflyData(baseUri, reqUri, model);
                    var result = await insurancePartnerClient.GetGTASearchData(baseUri, reqUri, requestModel);

                    strData         = JsonConvert.SerializeObject(result.Data);
                    isFetchedFromDb = true;
                }
                SearchInsuranceResponseEntity partnerResponseEntity = JsonConvert.DeserializeObject <SearchInsuranceResponseEntity>(strData);
                if (partnerResponseEntity != null)
                {
                    list.Add(partnerResponseEntity);
                    return(true);
                }
            }
            return(false);
        }
コード例 #4
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);
        }