Ejemplo n.º 1
0
        private async void DoShowComments(object obj)
        {
            try
            {
                Loading8085Comments = true;
                S8580CommentsView   = null;
                if (FromBatch != null)
                {
                    var result = await RestHub.S8580Comments(SelectedDeliveryBatch.Id, FromCategory.Value);

                    if (result.HttpCode == System.Net.HttpStatusCode.OK)
                    {
                        List <S8580CommentsDTO> dtos = (List <S8580CommentsDTO>)result.UserObject;
                        S8580Comments = new ObservableCollection <S8580CommentsVM>();
                        foreach (var dto in dtos)
                        {
                            S8580Comments.Add(new S8580CommentsVM
                            {
                                TanNumber   = dto.TanNumber,
                                TanCategory = dto.TanCategory,
                                Comment     = dto.Comment,
                                CommentType = dto.CommentType,
                                UserComment = dto.UserComment
                            });
                        }
                        S8580CommentsView = new ListCollectionView(S8580Comments);
                        S8580CommentsView.SortDescriptions.Add(new SortDescription("TanNumber", ListSortDirection.Ascending));
                    }
                    else
                    {
                        MessageBox.Show(result.StatusMessage);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.This(ex);
                AppErrorBox.ShowErrorMessage("Error while loading 8580 Comments", ex.ToString());
            }
            finally
            {
                Loading8085Comments = false;
            }
        }