Пример #1
0
        public ApiCompanyViewModel GetCompanyDetail(string inSyndicateCode)
        {
            ApiCompanyViewModel response = null;
            var request = Utility.WebUtility.CreateRequest(RequestAddress.GetCompanyDetail, inSyndicateCode, null,
                                                           WebRequestMethods.Http.Get);
            HttpWebResponse webResponse = null;

            try
            {
                webResponse = (HttpWebResponse)request.GetResponse();
                var responseStream = new StreamReader(webResponse.GetResponseStream());
                response = JsonUtility.Deserialize <ApiCompanyViewModel>(responseStream.ReadToEnd());
            }
            catch (WebException we)
            {
                webResponse = (HttpWebResponse)we.Response;
                HandleExceptions(webResponse);
            }
            finally
            {
                if (webResponse != null)
                {
                    webResponse.Close();
                }
            }
            return(response);
        }
Пример #2
0
        CompanyInfo CreateCompanyInfo(ApiCompanyViewModel inComapnyInfo)
        {
            var result = new CompanyInfo();

            result.TierLevels                 = CreateTierLevelInfoList(inComapnyInfo.TierLevels);
            result.Discounts                  = CreateDiscountInfoList(inComapnyInfo.Discounts);
            result.HasGiftCardsAvailable      = inComapnyInfo.HasGiftCardsAvailable;
            result.HasPocketVouchersAvailable = inComapnyInfo.HasPocketVouchersAvailable;
            return(result);
        }