public List <string> GetSizeByInventoryType(long inventoryTypeId) { List <string> sizes = new List <string>(); try { HttpClient client = new HttpClient(); //client.BaseAddress = new Uri("http://192.168.1.3:9000/"); client.BaseAddress = new Uri(((App)App.Current).LAN_Address); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("plain/text")); client.DefaultRequestHeaders.Add("EO-Header", User + " : " + Pwd); HttpResponseMessage httpResponse = client.GetAsync("api/Login/GetSizeByInventoryType?inventoryTypeid=" + inventoryTypeId.ToString()).Result; if (httpResponse.IsSuccessStatusCode) { string strData = httpResponse.Content.ReadAsStringAsync().Result; GetSizeResponse response = JsonConvert.DeserializeObject <GetSizeResponse>(strData); sizes = response.Sizes; } else { //MessageBox.Show("There was an error retreiving plant types"); } } catch (Exception ex) { Exception ex2 = new Exception("Admin - GetSizeByInventoryType", ex); ((App)App.Current).LogError(ex2.Message, "inventoryTypeId = " + inventoryTypeId.ToString()); } return(sizes); }
private void StoreSizes(GetSizeResponse response, List <KeyValuePair <long, string> > sizeList, bool showSizes = false) { sizeList.Clear(); //store the inventory type id value in the Key val of the size collection foreach (string s in response.Sizes) { sizeList.Add(new KeyValuePair <long, string>(response.InventoryTypeId, s)); } if (showSizes) { Device.BeginInvokeOnMainThread(() => { ObservableCollection <KeyValuePair <long, string> > list2 = new ObservableCollection <KeyValuePair <long, string> >(); list2.Add(new KeyValuePair <long, string>(0, "All sizes")); foreach (KeyValuePair <long, string> kvp in sizeList) { list2.Add(kvp); } Size.ItemsSource = list2; }); } }
public GetSizeResponse GetSizeByInventoryType(long inventoryTypeId) { GetSizeResponse response = new GetSizeResponse(); response.InventoryTypeId = inventoryTypeId; response.Sizes = inventoryManager.GetSizeByInventoryType(inventoryTypeId); return(response); }
public void ShowSizes(GetSizeResponse response) { ObservableCollection <KeyValuePair <long, string> > list2 = new ObservableCollection <KeyValuePair <long, string> >(); long index = 1; foreach (string size in response.Sizes) { list2.Add(new KeyValuePair <long, string>(index++, size)); } Device.BeginInvokeOnMainThread(() => { PlantSize.ItemsSource = list2; PlantSize.SelectedIndexChanged += PlantSize_SelectedIndexChanged; }); LoadPlants(); }
public async Task <GetSizeResponse> GetSizeByInventoryType(GenericGetRequest request) { GetSizeResponse response = await GetRequest <GetSizeResponse>(request); return(response); }