示例#1
0
        private async void DoShow8000NameLocations(object obj)
        {
            try
            {
                Loading8000Data       = true;
                S8000NameLocationView = null;
                var result = await RestHub.S8000NameLocations(SelectedDeliveryBatch.Id, FromCategory.Value);

                if (result.HttpCode == System.Net.HttpStatusCode.OK)
                {
                    List <S8000NameLocationDTO> dtos = (List <S8000NameLocationDTO>)result.UserObject;
                    S8000NameLocations = new ObservableCollection <S8000NameLocationVM>();
                    foreach (var dto in dtos)
                    {
                        S8000NameLocations.Add(new S8000NameLocationVM
                        {
                            TanNumber         = dto.TanNumber,
                            TanSeries         = dto.TanSeries,
                            TanCategory       = dto.TanCategory,
                            SubstanceName     = dto.SubstanceName,
                            SubstanceLocation = dto.SubstanceLocation
                        });
                    }
                    S8000NameLocationView = new ListCollectionView(S8000NameLocations);
                    S8000NameLocationView.SortDescriptions.Add(new SortDescription("TanNumber", ListSortDirection.Ascending));
                }
                else
                {
                    MessageBox.Show(result.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                Log.This(ex);
                AppErrorBox.ShowErrorMessage("Error while loading 8000 names", ex.ToString());
            }
            finally
            {
                Loading8000Data = false;
            }
        }