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