// Send to Excel Implementation public async Task Send2Excel() { IEnumerable <Document_Type> lst = null; using (var ctx = new Document_TypeRepository()) { lst = await ctx.GetDocument_TypeByExpressionNav(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 <Document_TypeExcelLine, List <Document_TypeExcelLine> > { dataToPrint = lst.Select(x => new Document_TypeExcelLine { Type_of_declaration = x.Type_of_declaration, Declaration_gen_procedure_code = x.Declaration_gen_procedure_code }).ToList() }; using (var sta = new StaTaskScheduler(numberOfThreads: 1)) { await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false); } }
internal async void OnCurrentDocument_TypeIDChanged(object sender, NotificationEventArgs <string> e) { using (Document_TypeRepository ctx = new Document_TypeRepository()) { CurrentDocument_Type = await ctx.GetDocument_Type(e.Data).ConfigureAwait(continueOnCapturedContext: false); } NotifyPropertyChanged(m => CurrentDocument_Type); }
private async Task LoadDocumentTypes() { using (var ctx = new Document_TypeRepository()) { _document_types = new ObservableCollection <Document_Type>(await ctx.Document_Type().ConfigureAwait(false)); NotifyPropertyChanged(x => this.Document_Types); } }
public async Task SelectAll() { IEnumerable <Document_Type> lst = null; using (var ctx = new Document_TypeRepository()) { lst = await ctx.GetDocument_TypeByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false); } SelectedDocument_Type = new ObservableCollection <Document_Type>(lst); }
public IList <Document_Type> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount) { try { if (FilterExpression == null) { FilterExpression = "All"; } using (var ctx = new Document_TypeRepository()) { 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 <Document_Type>()); } }