Example #1
0
        public List <ContainerTypeDTO> GetContainerTypes()
        {
            List <ContainerTypeDTO> containerTypes = new List <ContainerTypeDTO>();

            try
            {
                HttpClient client = new HttpClient();
                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/GetContainerTypes").Result;
                if (httpResponse.IsSuccessStatusCode)
                {
                    string strData = httpResponse.Content.ReadAsStringAsync().Result;
                    GetContainerTypeResponse response = JsonConvert.DeserializeObject <GetContainerTypeResponse>(strData);
                    containerTypes = response.ContainerTypeList;
                }
                else
                {
                    MessageBox.Show("There was an error retreiving container types");
                }
            }
            catch (Exception ex)
            {
                Exception ex2 = new Exception("Admin - GetContainerTypes", ex);
                ((App)App.Current).LogError(ex2.Message, String.Empty);
            }
            return(containerTypes);
        }
Example #2
0
        public async Task <GetContainerTypeResponse> GetContainerTypes()
        {
            GenericGetRequest        request  = new GenericGetRequest("GetContainerTypes", String.Empty, 0);
            GetContainerTypeResponse response = await GetRequest <GetContainerTypeResponse>(request);

            return(response);
        }
        private void ContainerTypesLoaded(long inventoryTypeId, ObservableCollection <KeyValuePair <long, string> > list1, GetContainerTypeResponse types)
        {
            containerTypes = types.ContainerTypeList;

            Device.BeginInvokeOnMainThread(() =>
            {
                foreach (ContainerTypeDTO container in containerTypes)
                {
                    list1.Add(new KeyValuePair <long, string>(container.ContainerTypeId, container.ContainerTypeName));
                }

                Type.ItemsSource = list1;

                LoadListData(inventoryTypeId);
            });
        }