示例#1
0
        public async Task <resultListCP> getCustomPricesForCustomer(int customerId)
        {
            string url = "https://szgwdsfnutmhvnz.weclapp.com/webapp/api/v1/articlePrice?customerId-eq=" + customerId.ToString() + "&endDate-null&pageSize=1000";

            using (HttpResponseMessage response = await ApiHelper.ApiClient.GetAsync(url))
            {
                if (response.IsSuccessStatusCode)
                {
                    string result = await response.Content.ReadAsStringAsync();

                    resultListCP listCP = JsonConvert.DeserializeObject <resultListCP>(result);
                    return(listCP);
                }
                else
                {
                    throw new Exception(response.ReasonPhrase);
                }
            }
        }
示例#2
0
        public async Task <resultListCP> getCustomersWithCustomPricesList()
        {
            string url = "https://szgwdsfnutmhvnz.weclapp.com/webapp/api/v1/articlePrice?customerId-notnull&endDate-null&properties=customerId,endDate&page=2&pageSize=1000"; //&properties=articleId,articleNumber,customerId,price

            using (HttpResponseMessage response = await ApiHelper.ApiClient.GetAsync(url))
            {
                if (response.IsSuccessStatusCode)
                {
                    string result = await response.Content.ReadAsStringAsync();

                    resultListCP customersWithCustomPricesList = JsonConvert.DeserializeObject <resultListCP>(result);

                    return(customersWithCustomPricesList);
                }
                else
                {
                    throw new Exception(response.ReasonPhrase);
                }
            }
        }
示例#3
0
        private async Task <List <CustomerModel> > LoadCustomer(int customerid = 0)
        {
            ApiProcessor apiProcessor = new ApiProcessor();
            resultListCM customerList = await apiProcessor.getCustomers();

            //resultListCP customPricesList = await apiProcessor.getCustomersWithCustomPricesList();

            foreach (CustomerModel cm in customerList.result)
            {
                resultListCP prices = await apiProcessor.getCustomPricesForCustomer(cm.id);

                if (prices.result.Count > 0)
                {
                    cm.lCustomerPrices = prices.result;
                }
            }

            customerList.result.RemoveAll(item => item.lCustomerPrices == null);

            return(customerList.result);
        }