internal async void OnCurrentLicenceSummaryIDChanged(object sender, NotificationEventArgs <string> e) { using (LicenceSummaryRepository ctx = new LicenceSummaryRepository()) { CurrentLicenceSummary = await ctx.GetLicenceSummary(e.Data).ConfigureAwait(continueOnCapturedContext: false); } NotifyPropertyChanged(m => CurrentLicenceSummary); }
public async Task SelectAll() { IEnumerable <LicenceSummary> lst = null; using (var ctx = new LicenceSummaryRepository()) { lst = await ctx.GetLicenceSummaryByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false); } SelectedLicenceSummary = new ObservableCollection <LicenceSummary>(lst); }
private async Task GetLicenceSummaryLines() { try { if (BaseViewModel.Instance.CurrentAsycudaDocumentSetEx != null) { //ObservableCollection<LicenceSummaryLine> licenceSummaryLines = null; using (var ctx = new LicenceSummaryRepository()) { var clst = ctx.GetLicenceSummaryByAsycudaDocumentSetId( BaseViewModel.Instance.CurrentAsycudaDocumentSetEx.AsycudaDocumentSetId.ToString()) .Result; if (clst.ToList().Any() == false) { // return licenceSummaryLines; //return true; return; } var lst = from t in clst select new LicenceSummaryLine { TariffCode = t.TariffCode, Description = t.TariffCodeDescription, Quantity = Convert.ToDouble(t.Quantity), Total = Convert.ToDouble(t.Total) }; if (lst.Any()) { _licenceSummaryData = new ObservableCollection <LicenceSummaryLine>(lst); NotifyPropertyChanged(x => this.LicenceSummaryData); } } } } catch (Exception Ex) { throw; } }
// Send to Excel Implementation public async Task Send2Excel() { IEnumerable <LicenceSummary> lst = null; using (var ctx = new LicenceSummaryRepository()) { lst = await ctx.GetLicenceSummaryByExpressionNav(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 <LicenceSummaryExcelLine, List <LicenceSummaryExcelLine> > { dataToPrint = lst.Select(x => new LicenceSummaryExcelLine { TariffCode = x.TariffCode, Quantity = x.Quantity, Total = x.Total, TariffCodeDescription = x.TariffCodeDescription, RowNumber = x.RowNumber }).ToList() }; using (var sta = new StaTaskScheduler(numberOfThreads: 1)) { await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false); } }
public IList <LicenceSummary> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount) { try { if (FilterExpression == null) { FilterExpression = "All"; } using (var ctx = new LicenceSummaryRepository()) { 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 <LicenceSummary>()); } }