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; } }
private async void DoMoveToCategory(object obj) { try { WorkInProgress = true; if (BatchTans != null && SelectedTans != null && SelectedTans.Count() > 0) { if (FromBatch != null && ToCategory != null) { var moveTansDto = new MoveTansDTO(); moveTansDto.TanIds = SelectedTans.Select(t => ((BatchTanVM)t).Id).ToList(); moveTansDto.TargetCategory = ToCategory.Value; var status = await RestHub.MoveToCategory(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 Category . .", status.HttpResponse); } } else { AppInfoBox.ShowInfoMessage("From Batch, To Category Should Be Selected, And Must Be Different To Proceed. ."); } } else { AppInfoBox.ShowInfoMessage("Please Load and Select TANs To Proceed . ."); } } catch (Exception ex) { Log.This(ex); AppErrorBox.ShowErrorMessage("Can't Move TANs To Category . .", ex.ToString()); } finally { WorkInProgress = false; } }