Пример #1
0
        private async Task <Domain.Rootobject> GetDataFromPartnerOne(List <Domain.Rootobject> list)
        {
            string baseUri = "http://localhost:18313/";
            //string reqUri = "partnerone/all/async";
            string reqUri = "mystifly-partner/rootobject";
            var    result = await partnerClient.GetPartnerData(baseUri, reqUri);

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

            Domain.Rootobject partnerResponseEntity = JsonConvert.DeserializeObject <Domain.Rootobject>(strData);
            list.Add(partnerResponseEntity);
            return(partnerResponseEntity);
        }
        private async Task <bool> GetDataFromMystifly(List <Domain.Rootobject> list, Models.Rootobject model, List <SupplierAgencyDetails> allSupplierAgencyDetails, string key)
        {
            AddSupplierDetailsToRequestObject(model, allSupplierAgencyDetails, SupplierCodeMystyfly);

            // JavaScriptSerializer serializer = new JavaScriptSerializer();
            // string jsonString = serializer.Serialize(model);
            string strData = string.Empty;
            string baseUri = ConficBase.GetConfigAppValue(BaseUrlMystyfly);
            string reqUri  = ConficBase.GetConfigAppValue(ReqUrlMystyfly);

            bool isFetchedFromDb = false;

            strData = await GetSupplierResponseFromDb(model, ConficBase.GetConfigAppValue(SupplierCodeMystyfly), 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(SupplierCodeMystyfly), key);
                    }
                    // CreateJSONDoc(strData, model.CommonRequestSearch.AgencyCode, ConficBase.GetConfigAppValue(SupplierCodeMystyfly), key);
                    return(true);
                }
            }

            return(false);
        }