Exemplo n.º 1
0
        private async void DoMoveToDelivery(object obj)
        {
            try
            {
                WorkInProgress = true;
                if (BatchTans != null && SelectedTans != null && SelectedTans.Count() > 0)
                {
                    var InValidTans = SelectedTans.Where(t => (((BatchTanVM)t).TanState.HasValue && S.UnDelivarableTanStates.Contains(((BatchTanVM)t).TanState.Value)) || ((BatchTanVM)t).IsDoubtRaised.ToLower().Equals("true")).ToList();
                    if (InValidTans.Any())
                    {
                        AppInfoBox.ShowInfoMessage("Selected Tan Contains NotAssigned/Curation In progress/Doubt Raised tans.");
                        return;
                    }
                    if (DeliveryBatch != null)
                    {
                        var moveTansDto = new MoveTansDTO();
                        moveTansDto.TanIds         = SelectedTans.Select(t => ((BatchTanVM)t).Id).ToList();
                        moveTansDto.TargetCategory = DeliveryBatch.Id;
                        var status = await RestHub.MoveToDelivery(moveTansDto);

                        if (status.HttpCode == System.Net.HttpStatusCode.OK)
                        {
                            SearchTans.Execute(this);
                            var result = MessageBox.Show(status.StatusMessage, "Status", MessageBoxButton.OKCancel);
                        }
                        else
                        {
                            AppErrorBox.ShowErrorMessage("Can't Move TANs To Delivery . .", status.HttpResponse);
                        }
                    }
                    else
                    {
                        AppInfoBox.ShowInfoMessage("Delivery Batch Not Selected.");
                    }
                }
                else
                {
                    AppInfoBox.ShowInfoMessage("Please Load and Select TANs To Proceed . .");
                }
                WorkInProgress = false;
            }
            catch (Exception ex)
            {
                Log.This(ex);
                AppErrorBox.ShowErrorMessage("Can't Move TANs To Delivery . .", ex.ToString());
            }
            finally
            {
                WorkInProgress = false;
            }
        }