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