internal async void OnCurrentOverShortDetailIDChanged(object sender, NotificationEventArgs <string> e) { using (OverShortDetailRepository ctx = new OverShortDetailRepository()) { CurrentOverShortDetail = await ctx.GetOverShortDetail(e.Data).ConfigureAwait(continueOnCapturedContext: false); } NotifyPropertyChanged(m => CurrentOverShortDetail); }
public async Task SelectAll() { IEnumerable <OverShortDetail> lst = null; using (var ctx = new OverShortDetailRepository()) { lst = await ctx.GetOverShortDetailsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false); } SelectedOverShortDetails = new ObservableCollection <OverShortDetail>(lst); }
internal async Task RemoveOsMatch(OverShortDetailsEX osd) { osd.OverShortDetailAllocations.Clear(); osd.Status = ""; using (var ctx = new OverShortDetailRepository()) { await ctx.UpdateOverShortDetail(osd).ConfigureAwait(false); } OverShortDetails.Refresh(); }
// Send to Excel Implementation public async Task Send2Excel() { IEnumerable <OverShortDetail> lst = null; using (var ctx = new OverShortDetailRepository()) { lst = await ctx.GetOverShortDetailsByExpressionNav(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 <OverShortDetailExcelLine, List <OverShortDetailExcelLine> > { dataToPrint = lst.Select(x => new OverShortDetailExcelLine { ReceivedQty = x.ReceivedQty, ItemNumber = x.ItemNumber, ItemDescription = x.ItemDescription, Cost = x.Cost, InvoiceQty = x.InvoiceQty, Status = x.Status }).ToList() }; using (var sta = new StaTaskScheduler(numberOfThreads: 1)) { await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false); } }
public IList <OverShortDetail> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount) { try { if (FilterExpression == null) { FilterExpression = "All"; } using (var ctx = new OverShortDetailRepository()) { 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 <OverShortDetail>()); } }