Exemple #1
0
// Send to Excel Implementation


        public async Task Send2Excel()
        {
            IEnumerable <ContainerType> lst = null;

            using (var ctx = new ContainerTypeRepository())
            {
                lst = await ctx.GetContainerTypesByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false);
            }
            if (lst == null || !lst.Any())
            {
                MessageBox.Show("No Data to Send to Excel");
                return;
            }
            var s = new ExportToExcel <ContainerTypeExcelLine, List <ContainerTypeExcelLine> >
            {
                dataToPrint = lst.Select(x => new ContainerTypeExcelLine
                {
                    ContainerCode = x.ContainerCode,


                    ContainerTypeDescription = x.ContainerTypeDescription
                }).ToList()
            };

            using (var sta = new StaTaskScheduler(numberOfThreads: 1))
            {
                await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false);
            }
        }
 internal async void OnCurrentContainerTypeIDChanged(object sender, NotificationEventArgs <string> e)
 {
     using (ContainerTypeRepository ctx = new ContainerTypeRepository())
     {
         CurrentContainerType = await ctx.GetContainerType(e.Data).ConfigureAwait(continueOnCapturedContext: false);
     }
     NotifyPropertyChanged(m => CurrentContainerType);
 }
Exemple #3
0
        public async Task SelectAll()
        {
            IEnumerable <ContainerType> lst = null;

            using (var ctx = new ContainerTypeRepository())
            {
                lst = await ctx.GetContainerTypesByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false);
            }
            SelectedContainerTypes = new ObservableCollection <ContainerType>(lst);
        }
Exemple #4
0
        private async Task LoadContainerTypes()
        {
            using (var ctx = new ContainerTypeRepository())
            {
                var res = await ctx.ContainerTypes().ConfigureAwait(false);

                if (res != null)
                {
                    containerTypes = new ObservableCollection <ContainerType>(res);
                }
            }
        }
        public IList <ContainerType> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount)
        {
            try
            {
                if (FilterExpression == null)
                {
                    FilterExpression = "All";
                }
                using (var ctx = new ContainerTypeRepository())
                {
                    var r = ctx.LoadRange(startIndex, count, FilterExpression, navExp, IncludesLst);
                    overallCount = r.Result.Item2;

                    return(r.Result.Item1.ToList());
                }
            }
            catch (Exception ex)
            {
                StatusModel.Message(ex.Message);
                overallCount = 0;
                return(new List <ContainerType>());
            }
        }