internal async void OnCurrentInventoryItemsExIDChanged(object sender, NotificationEventArgs <string> e) { using (InventoryItemsExRepository ctx = new InventoryItemsExRepository()) { CurrentInventoryItemsEx = await ctx.GetInventoryItemsEx(e.Data).ConfigureAwait(continueOnCapturedContext: false); } NotifyPropertyChanged(m => CurrentInventoryItemsEx); }
public async Task SelectAll() { IEnumerable <InventoryItemsEx> lst = null; using (var ctx = new InventoryItemsExRepository()) { lst = await ctx.GetInventoryItemsExByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false); } SelectedInventoryItemsEx = new ObservableCollection <InventoryItemsEx>(lst); }
// Send to Excel Implementation public async Task Send2Excel() { IEnumerable <InventoryItemsEx> lst = null; using (var ctx = new InventoryItemsExRepository()) { lst = await ctx.GetInventoryItemsExByExpressionNav(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 <InventoryItemsExExcelLine, List <InventoryItemsExExcelLine> > { dataToPrint = lst.Select(x => new InventoryItemsExExcelLine { ItemNumber = x.ItemNumber, Description = x.Description, Category = x.Category, TariffCode = x.TariffCode, EntryTimeStamp = x.EntryTimeStamp }).ToList() }; using (var sta = new StaTaskScheduler(numberOfThreads: 1)) { await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false); } }
public IList <InventoryItemsEx> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount) { try { if (FilterExpression == null) { FilterExpression = "All"; } using (var ctx = new InventoryItemsExRepository()) { 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 <InventoryItemsEx>()); } }