public async Task CheckBins(AsyncCancelationDispatcher acd) { try { List <BinViewModel> list = BinViewModels.ToList(); foreach (BinViewModel bvm in list) { bvm.IsChecked = false; NAVFilter navfilter = new NAVFilter { LocationCodeFilter = LocationCode, BinCodeFilter = bvm.Code }; List <Bin> binsexist = await NAV.GetBinList(navfilter, ACD.Default).ConfigureAwait(true); if (binsexist.Count > 0) { bvm.IsExist = true; Bin bin = binsexist.First(); //Place in new rack bin.RackNo = bvm.RackNo; bin.Section = bvm.Section; bin.Level = bvm.Level; bin.Depth = bvm.Depth; bin.SectionSpan = bvm.SectionSpan; bin.LevelSpan = bvm.LevelSpan; bin.DepthSpan = bvm.DepthSpan; bvm.FillFields(bin); } else { bvm.IsExist = false; } bvm.IsChecked = true; } } catch (OperationCanceledException e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; } }
public async Task LoadBins(AsyncCancelationDispatcher acd) { BinViewModelsDispose(); try { LoadedBinsQuantity = 0; SearchBinsQuantity = 0; NAVFilter navfilter = new NAVFilter { LocationCodeFilter = LocationCode, ZoneCodeFilter = ZoneCode, RackCodeFilter = RackNo }; List <Bin> bins = await NAV.GetBinList(navfilter, ACD.Default).ConfigureAwait(true); if (!IsDisposed) { if (bins.Count > 0) { LoadedBinsQuantity = bins.Count; foreach (Bin bin in bins) { BinViewModel bvm = new BinViewModel(Navigation, bin); bvm.IsContent = !bin.Empty; bvm.Color = Color.FromHex("#e2dacf"); bvm.OnTap += Bvm_OnTap; ExistInSearch(bvm); ExistInUDS(bvm); BinViewModels.Add(bvm); } } MessagingCenter.Send <BinsViewModel>(this, "BinsIsLoaded"); } } catch (OperationCanceledException e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; } }
public async Task CheckBin(BinViewModel bvm, AsyncCancelationDispatcher acd) { try { bvm.IsChecked = false; NAVFilter navfilter = new NAVFilter { LocationCodeFilter = LocationCode, BinCodeFilter = bvm.Code }; List <Bin> binsexist = await NAV.GetBinList(navfilter, acd.Default).ConfigureAwait(true); if ((NotDisposed) && (binsexist.Count > 0)) { bvm.IsExist = true; Bin bin = binsexist.First(); bin.RackID = bvm.RackID; bin.Section = bvm.Section; bin.Level = bvm.Level; bin.Depth = bvm.Depth; bin.SectionSpan = bvm.SectionSpan; bin.LevelSpan = bvm.LevelSpan; bin.DepthSpan = bvm.DepthSpan; bvm.FillFields(bin); } else { bvm.IsExist = false; } bvm.IsChecked = true; } catch (OperationCanceledException e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; } }
public async Task DeleteRack(object obj) { if (NotNetOrConnection) { return; } RackViewModel rvm = (RackViewModel)obj; string variant1 = String.Format(AppResources.RacksPlanViewModel_DeleteRack, rvm.No); string variant2 = String.Format(AppResources.RacksPlanViewModel_DeleteRack2, rvm.No); string variant3 = String.Format(AppResources.RacksPlanViewModel_DeleteRackAndBins, rvm.No); var action = await App.Current.MainPage.DisplayActionSheet( AppResources.RacksPlanViewModel_DeleteQuestion, AppResources.RacksPlanViewModel_DeleteCancel, null, variant1, variant2, variant3); if ((action != null) && (action != AppResources.RacksPlanViewModel_DeleteCancel)) { if (action == variant1) { try { await rvm.SaveToRackSchemeVisible(false); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; State = ModelState.Error; } } if (action == variant2) { try { await NAV.DeleteRack(rvm.ID, ACD.Default).ConfigureAwait(true); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; State = ModelState.Error; } } if (action == variant3) { try { State = ModelState.Loading; LoadAnimation = true; await NAV.DeleteRack(rvm.ID, ACD.Default).ConfigureAwait(true); NAVFilter navfilter = new NAVFilter { LocationCodeFilter = rvm.LocationCode, ZoneCodeFilter = rvm.ZoneCode, RackIDFilter = rvm.ID.ToString() }; string bindeleteerrors = ""; List <Bin> binsinrack = await NAV.GetBinList(navfilter, ACD.Default).ConfigureAwait(true); if (NotDisposed) { foreach (Bin bin in binsinrack) { try { LoadingText = bin.Code; await NAV.DeleteBin(bin.LocationCode, bin.Code, ACD.Default).ConfigureAwait(true); } catch (Exception exp) { bindeleteerrors += bin.Code + " : " + exp.InnerException.Message + Environment.NewLine + Environment.NewLine; } } } if (string.IsNullOrEmpty(bindeleteerrors)) { State = ModelState.Normal; } else { ErrorText = AppResources.RacksPlanViewModel_DeleteBinErrors + " " + Environment.NewLine + bindeleteerrors; State = ModelState.Error; } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; State = ModelState.Error; } } await Load(); } }