Exemplo n.º 1
0
        private async void OnPostFinalResultCommandExecuted()
        {
            try
            {
                InventoryViabilityData last = InventoryViabilityDataList.OrderByDescending(x => x.CountDate).FirstOrDefault();
                InventoryViability.PercentViable = Math.Round(last.NormalCount / (decimal)last.ReplicationCount * 100, 2);
                InventoryViability.TestedDate    = last.CountDate;

                string result = await _restService.UpdateInventoryViabilityAsync(InventoryViability);

                //await _pageDialogService.DisplayAlertAsync("Message", result, "OK");

                var navigationParams = new NavigationParameters();
                navigationParams.Add("InventoryViability", InventoryViability);
                await NavigationService.GoBackAsync(navigationParams);
            }
            catch (Exception e)
            {
                await _pageDialogService.DisplayAlertAsync("Error", e.Message, "OK");
            }
        }
Exemplo n.º 2
0
        private async void OnNewCommandExecuted()
        {
            try
            {
                int maxCountNumber;
                if (InventoryViabilityDataList.Count > 0)
                {
                    maxCountNumber = InventoryViabilityDataList.Max(obj => obj.CountNumber);
                }
                else
                {
                    maxCountNumber = 0;
                }

                for (int i = 0; i < ReplicationCount; i++)
                {
                    InventoryViabilityDataList.Insert(0, new InventoryViabilityData()
                    {
                        InventoryViabilityDataId = -1,
                        InventoryViabilityId     = InventoryViabilityId,
                        CounterCooperatorId      = 48,
                        CountDate         = DateTime.Now,
                        CountNumber       = maxCountNumber + 1,
                        ReplicationCount  = InventoryViability.TotalTestedCount / InventoryViability.ReplicationCount,
                        ReplicationNumber = (ReplicationCount - i),
                        AbnormalCount     = 0,
                        NormalCount       = 0,
                        Note = ""
                    });
                }
            }
            catch (Exception e)
            {
                await _pageDialogService.DisplayAlertAsync("Error", e.Message, "OK");
            }
        }