// Send to Excel Implementation public async Task Send2Excel() { IEnumerable <CounterPointSalesDetails> lst = null; using (var ctx = new CounterPointSalesDetailsRepository()) { lst = await ctx.GetCounterPointSalesDetailsByExpressionNav(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 <CounterPointSalesDetailsExcelLine, List <CounterPointSalesDetailsExcelLine> > { dataToPrint = lst.Select(x => new CounterPointSalesDetailsExcelLine { INVNO = x.INVNO, SEQ_NO = x.SEQ_NO, ITEM_NO = x.ITEM_NO, ITEM_DESCR = x.ITEM_DESCR, QUANTITY = x.QUANTITY, COST = x.COST, ACCT_NO = x.ACCT_NO, CUSTOMER_NAME = x.CUSTOMER_NAME, DATE = x.DATE, TAX_AMT = x.TAX_AMT, UNIT_WEIGHT = x.UNIT_WEIGHT, QTY_UNIT = x.QTY_UNIT }).ToList() }; using (var sta = new StaTaskScheduler(numberOfThreads: 1)) { await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false); } }
public async Task SelectAll() { IEnumerable <CounterPointSalesDetails> lst = null; using (var ctx = new CounterPointSalesDetailsRepository()) { lst = await ctx.GetCounterPointSalesDetailsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false); } SelectedCounterPointSalesDetails = new ObservableCollection <CounterPointSalesDetails>(lst); }