コード例 #1
0
        public async Task SelectAll()
        {
            IEnumerable <OverShortAllocationsEX> lst = null;

            using (var ctx = new OverShortAllocationsEXRepository())
            {
                lst = await ctx.GetOverShortAllocationsEXesByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false);
            }
            SelectedOverShortAllocationsEXes = new ObservableCollection <OverShortAllocationsEX>(lst);
        }
コード例 #2
0
// Send to Excel Implementation


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

            using (var ctx = new OverShortAllocationsEXRepository())
            {
                lst = await ctx.GetOverShortAllocationsEXesByExpressionNav(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 <OverShortAllocationsEXExcelLine, List <OverShortAllocationsEXExcelLine> >
            {
                dataToPrint = lst.Select(x => new OverShortAllocationsEXExcelLine
                {
                    ReceivedQty = x.ReceivedQty,


                    ItemNumber = x.ItemNumber,


                    ItemDescription = x.ItemDescription,


                    Cost = x.Cost,


                    InvoiceQty = x.InvoiceQty,


                    InvoiceNo = x.InvoiceNo,


                    InvoiceDate = x.InvoiceDate,


                    CNumber = x.CNumber,


                    RegistrationDate = x.RegistrationDate,


                    Duration = x.Duration,


                    InvoiceMonth = x.InvoiceMonth,


                    AsycudaMonth = x.AsycudaMonth,


                    AllocatedValue = x.AllocatedValue,


                    ReceivedValue = x.ReceivedValue,


                    InvoiceValue = x.InvoiceValue,


                    LineNumber = Convert.ToInt16(x.LineNumber),


                    PiQuantity = x.PiQuantity,


                    OverShortDetailStatus = x.OverShortDetailStatus,


                    QtyAllocated = x.QtyAllocated,


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

            using (var sta = new StaTaskScheduler(numberOfThreads: 1))
            {
                await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false);
            }
        }