示例#1
0
        private async void DoSaveRsns(object obj)
        {
            try
            {
                LoadingRSNs = true;
                if (ExtractedRsns != null && MessageBox.Show("Confirm Update . .", "Confirm Save", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    List <FreeTextUpdateDto> dtos = new List <FreeTextUpdateDto>();
                    foreach (var rsn in ExtractedRsns)
                    {
                        dtos.Add(new FreeTextUpdateDto {
                            Id = rsn.Id, FreeText = rsn.FreeText
                        });
                    }
                    FreeTextBulkDto bulkDto = new FreeTextBulkDto();
                    bulkDto.BatchId    = SelectedDeliveryBatch.Id;
                    bulkDto.CategoryId = FromCategory.Value;
                    bulkDto.Dtos       = dtos;
                    var status = await RestHub.UpdateFreeTextBulk(bulkDto);

                    if (status.HttpCode == System.Net.HttpStatusCode.OK)
                    {
                        ExtractRsns.Execute(this);
                        var result = MessageBox.Show("RSNs Updated Successfully . .", "Status", MessageBoxButton.OKCancel);
                    }
                    else
                    {
                        AppErrorBox.ShowErrorMessage("Can't Update RSNs . .", status.HttpResponse);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.This(ex);
                AppErrorBox.ShowErrorMessage("Error while Updating RSNs", ex.ToString());
            }
            finally
            {
                LoadingRSNs = false;
            }
        }