public async void Add_Click() { App.Current.Properties["Action"] = "Add"; ItemLocationAdd _II = new ItemLocationAdd(); _II.Show(); }
public async void Edit_ItemLoc() { try { if (SelectItemLocation.ITEM_NAME != null && SelectItemLocation.ITEM_NAME != "") { App.Current.Properties["itemName"] = null; App.Current.Properties["barcode"] = null; App.Current.Properties["ItemLocAdd"] = null; dataItem = null; App.Current.Properties["Action"] = "Edit"; HttpClient client = new HttpClient(); client.BaseAddress = new Uri(GlobalData.gblApiAdress); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); client.Timeout = new TimeSpan(500000000000); HttpResponseMessage response = client.GetAsync("api/ItemAPI/GetEditItem1?id=" + SelectItemLocation.ITEM_ID + "").Result; if (response.IsSuccessStatusCode) { dataItem = JsonConvert.DeserializeObject <ItemModel[]>(await response.Content.ReadAsStringAsync()); if (dataItem.Length == 0) { SelectItemLocation.ITEM_NAME = SelectItemLocation.ITEM_NAME; SelectItemLocation.BARCODE = SelectItemLocation.BARCODE; } if (dataItem.Length > 0) { //int x = 0; for (int i = 0; i < dataItem.Length; i++) { SelectItemLocation.ITEM_NAME = dataItem[i].ITEM_NAME; SelectItemLocation.BARCODE = dataItem[i].BARCODE; SelectItemLocation.ITEM_LOCATION_NAME = dataItem[i].ITEM_LOCATION_NAME; SelectItemLocation.SORT_INDEX = dataItem[i].SORT_INDEX; } } App.Current.Properties["ItemLocEdit"] = SelectItemLocation; ItemLocationAdd _IA = new ItemLocationAdd(); _IA.Show(); ItemLocationAdd.ItemSortReff.IsEnabled = false; ItemLocationAdd.ItemLocReff.IsEnabled = false; } } else { MessageBox.Show("Select Item first", "Item Selection", MessageBoxButton.OK, MessageBoxImage.Error); return; } } catch (Exception ex) { throw; } }