// Send to Excel Implementation public async Task Send2Excel() { IEnumerable <EmptyFullCode> lst = null; using (var ctx = new EmptyFullCodeRepository()) { lst = await ctx.GetEmptyFullCodesByExpressionNav(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 <EmptyFullCodeExcelLine, List <EmptyFullCodeExcelLine> > { dataToPrint = lst.Select(x => new EmptyFullCodeExcelLine { EmptyFullCodeName = x.EmptyFullCodeName, EmptyFullDescription = x.EmptyFullDescription }).ToList() }; using (var sta = new StaTaskScheduler(numberOfThreads: 1)) { await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false); } }
internal async void OnCurrentEmptyFullCodeIDChanged(object sender, NotificationEventArgs <string> e) { using (EmptyFullCodeRepository ctx = new EmptyFullCodeRepository()) { CurrentEmptyFullCode = await ctx.GetEmptyFullCode(e.Data).ConfigureAwait(continueOnCapturedContext: false); } NotifyPropertyChanged(m => CurrentEmptyFullCode); }
public async Task SelectAll() { IEnumerable <EmptyFullCode> lst = null; using (var ctx = new EmptyFullCodeRepository()) { lst = await ctx.GetEmptyFullCodesByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false); } SelectedEmptyFullCodes = new ObservableCollection <EmptyFullCode>(lst); }
//private async Task InitializationAsync() //{ // await LoadContainerTypes().ConfigureAwait(false); // await LoadPackageTypes().ConfigureAwait(false); // await LoadEmptyFullCodes().ConfigureAwait(false); //} private async Task LoadEmptyFullCodes() { using (var ctx = new EmptyFullCodeRepository()) { var res = await ctx.EmptyFullCodes().ConfigureAwait(false); if (res != null) { emptyFullCodes = new ObservableCollection <EmptyFullCode>(res); } } }
public IList <EmptyFullCode> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount) { try { if (FilterExpression == null) { FilterExpression = "All"; } using (var ctx = new EmptyFullCodeRepository()) { 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 <EmptyFullCode>()); } }