public async Task SelectAll() { IEnumerable <ApplicationSettings> lst = null; using (var ctx = new ApplicationSettingsRepository()) { lst = await ctx.GetApplicationSettingsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false); } SelectedApplicationSettings = new ObservableCollection <ApplicationSettings>(lst); }
// Send to Excel Implementation public async Task Send2Excel() { IEnumerable <ApplicationSettings> lst = null; using (var ctx = new ApplicationSettingsRepository()) { lst = await ctx.GetApplicationSettingsByExpressionNav(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 <ApplicationSettingsExcelLine, List <ApplicationSettingsExcelLine> > { dataToPrint = lst.Select(x => new ApplicationSettingsExcelLine { Description = x.Description, MaxEntryLines = x.MaxEntryLines, SoftwareName = x.SoftwareName, AllowCounterPoint = x.AllowCounterPoint, GroupEX9 = x.GroupEX9, InvoicePerEntry = x.InvoicePerEntry, AllowTariffCodes = x.AllowTariffCodes, AllowWareHouse = x.AllowWareHouse, AllowXBond = x.AllowXBond, AllowAsycudaManager = x.AllowAsycudaManager, AllowQuickBooks = x.AllowQuickBooks, ItemDescriptionContainsAsycudaAttribute = x.ItemDescriptionContainsAsycudaAttribute, AllowExportToExcel = x.AllowExportToExcel, AllowAutoWeightCalculation = x.AllowAutoWeightCalculation, AllowEntryPerIM7 = x.AllowEntryPerIM7, AllowSalesToPI = x.AllowSalesToPI, AllowEffectiveAssessmentDate = x.AllowEffectiveAssessmentDate, AllowAutoFreightCalculation = x.AllowAutoFreightCalculation, AllowSubItems = x.AllowSubItems, AllowEntryDoNotAllocate = x.AllowEntryDoNotAllocate, AllowPreviousItems = x.AllowPreviousItems, AllowOversShort = x.AllowOversShort, AllowContainers = x.AllowContainers, AllowNonXEntries = x.AllowNonXEntries, AllowValidateTariffCodes = x.AllowValidateTariffCodes, AllowCleanBond = x.AllowCleanBond, OrderEntriesBy = x.OrderEntriesBy, OpeningStockDate = x.OpeningStockDate, AllowWeightEqualQuantity = x.AllowWeightEqualQuantity }).ToList() }; using (var sta = new StaTaskScheduler(numberOfThreads: 1)) { await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false); } }