示例#1
0
        public async Task SaveChanges()
        {
            State         = ModelState.Loading;
            LoadAnimation = true;
            Rack modifiedrack = new Rack();

            SaveFields(modifiedrack);
            try
            {
                LoadingText = AppResources.RackEditPage_SaveProcessText + " " + modifiedrack.No;
                int rackid = await NAV.ModifyRack(modifiedrack, ACD.Default).ConfigureAwait(true);

                int result = await NAV.DeleteBinsFromRack(modifiedrack, ACD.Default).ConfigureAwait(true);

                int index = 0;
                int count = BinsViewModel.BinViewModels.Count;
                foreach (BinViewModel bvm in BinsViewModel.BinViewModels)
                {
                    index++;
                    await SaveBinChanges(bvm, index, count).ConfigureAwait(true);
                }
                LoadAnimation = false;
                State         = ModelState.Normal;
                await Navigation.PopAsync();
            }
            catch (Exception e)
            {
                LoadAnimation = false;
                State         = ModelState.Error;
                ErrorText     = e.Message;
            }
        }
示例#2
0
        public override async void SaveChangesAsync()
        {
            if (NotNetOrConnection)
            {
                return;
            }

            List <RackViewModel> list = RackViewModels.ToList().FindAll(x => x.IsSelected == true);

            foreach (RackViewModel rvm in list)
            {
                try
                {
                    Rack rack = new Rack();
                    rvm.SaveFields(rack);
                    await NAV.ModifyRack(rack, ACD.Default).ConfigureAwait(true);
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e.Message);
                    ErrorText = e.Message;
                }
            }

            UpdateMinSizes();
        }
示例#3
0
 private async Task ModifyRack(Rack newrack, int rackexist)
 {
     if (rackexist > 0)
     {
         if (ConflictRackChange)
         {
             newrack.PrevNo = newrack.No;
             await NAV.ModifyRack(newrack, ACD.Default).ConfigureAwait(true);
         }
         else
         {
             State     = ModelState.Error;
             ErrorText = AppResources.RackNewPage_Error_RackAlreadyExist;
         }
     }
     else
     {
         await NAV.CreateRack(newrack, ACD.Default).ConfigureAwait(true);
     }
 }