// Send to Excel Implementation public async Task Send2Excel() { IEnumerable <OversShort> lst = null; using (var ctx = new OversShortRepository()) { lst = await ctx.GetOversShortsByExpressionNav(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 <OversShortExcelLine, List <OversShortExcelLine> > { dataToPrint = lst.Select(x => new OversShortExcelLine { InvoiceNo = x.InvoiceNo, InvoiceDate = x.InvoiceDate }).ToList() }; using (var sta = new StaTaskScheduler(numberOfThreads: 1)) { await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false); } }
internal async void OnCurrentOversShortIDChanged(object sender, NotificationEventArgs <string> e) { using (OversShortRepository ctx = new OversShortRepository()) { CurrentOversShort = await ctx.GetOversShort(e.Data).ConfigureAwait(continueOnCapturedContext: false); } NotifyPropertyChanged(m => CurrentOversShort); }
public async Task SelectAll() { IEnumerable <OversShort> lst = null; using (var ctx = new OversShortRepository()) { lst = await ctx.GetOversShortsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false); } SelectedOversShorts = new ObservableCollection <OversShort>(lst); }
public IList <OversShort> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount) { try { if (FilterExpression == null) { FilterExpression = "All"; } using (var ctx = new OversShortRepository()) { 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 <OversShort>()); } }