Ejemplo n.º 1
0
// Send to Excel Implementation


        public async Task Send2Excel()
        {
            IEnumerable <SalesDataAllocations> lst = null;

            using (var ctx = new SalesDataAllocationsRepository())
            {
                lst = await ctx.GetSalesDataAllocationsByExpressionNav(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 <SalesDataAllocationsExcelLine, List <SalesDataAllocationsExcelLine> >
            {
                dataToPrint = lst.Select(x => new SalesDataAllocationsExcelLine
                {
                    EntryDataId = x.EntryDataId
                }).ToList()
            };

            using (var sta = new StaTaskScheduler(numberOfThreads: 1))
            {
                await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false);
            }
        }
Ejemplo n.º 2
0
 internal async void OnCurrentSalesDataAllocationsIDChanged(object sender, NotificationEventArgs <string> e)
 {
     using (SalesDataAllocationsRepository ctx = new SalesDataAllocationsRepository())
     {
         CurrentSalesDataAllocations = await ctx.GetSalesDataAllocations(e.Data).ConfigureAwait(continueOnCapturedContext: false);
     }
     NotifyPropertyChanged(m => CurrentSalesDataAllocations);
 }
Ejemplo n.º 3
0
        public async Task SelectAll()
        {
            IEnumerable <SalesDataAllocations> lst = null;

            using (var ctx = new SalesDataAllocationsRepository())
            {
                lst = await ctx.GetSalesDataAllocationsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false);
            }
            SelectedSalesDataAllocations = new ObservableCollection <SalesDataAllocations>(lst);
        }
        public IList <SalesDataAllocations> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount)
        {
            try
            {
                if (FilterExpression == null)
                {
                    FilterExpression = "All";
                }
                using (var ctx = new SalesDataAllocationsRepository())
                {
                    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 <SalesDataAllocations>());
            }
        }