示例#1
0
 private async void OnSalesDataDetailsFilterExpressionChangetals(object sender, SimpleMvvmToolkit.NotificationEventArgs <string> e)
 {
     using (var ctx = new SalesDataDetailRepository())
     {
         TotalSalesValue = await ctx.SumNav(e.Data, vloader.NavigationExpression, "SalesValue").ConfigureAwait(false);
     }
 }
示例#2
0
 internal async void OnCurrentSalesDataDetailIDChanged(object sender, NotificationEventArgs <string> e)
 {
     using (SalesDataDetailRepository ctx = new SalesDataDetailRepository())
     {
         CurrentSalesDataDetail = await ctx.GetSalesDataDetail(e.Data).ConfigureAwait(continueOnCapturedContext: false);
     }
     NotifyPropertyChanged(m => CurrentSalesDataDetail);
 }
示例#3
0
        public async Task SelectAll()
        {
            IEnumerable <SalesDataDetail> lst = null;

            using (var ctx = new SalesDataDetailRepository())
            {
                lst = await ctx.GetSalesDataDetailsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false);
            }
            SelectedSalesDataDetails = new ObservableCollection <SalesDataDetail>(lst);
        }
示例#4
0
        public IList <SalesDataDetail> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount)
        {
            try
            {
                if (FilterExpression == null)
                {
                    FilterExpression = "All";
                }
                using (var ctx = new SalesDataDetailRepository())
                {
                    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 <SalesDataDetail>());
            }
        }
示例#5
0
// Send to Excel Implementation


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

            using (var ctx = new SalesDataDetailRepository())
            {
                lst = await ctx.GetSalesDataDetailsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression, new List <string>() { "SalesData" }).ConfigureAwait(continueOnCapturedContext: false);
            }
            if (lst == null || !lst.Any())
            {
                MessageBox.Show("No Data to Send to Excel");
                return;
            }
            var s = new ExportToExcel <SalesDataDetailExcelLine, List <SalesDataDetailExcelLine> >
            {
                dataToPrint = lst.Select(x => new SalesDataDetailExcelLine
                {
                    EntryDataId = x.EntryDataId,

                    InvoiceDate = x.SalesData.EntryDataDate,


                    LineNumber = x.LineNumber,


                    ItemNumber = x.ItemNumber,


                    Quantity = x.Quantity,


                    Units = x.Units,


                    ItemDescription = x.ItemDescription,


                    Cost = x.Cost,


                    QtyAllocated = x.QtyAllocated,


                    UnitWeight = x.UnitWeight,


                    DoNotAllocate = x.DoNotAllocate,


                    TariffCode = x.TariffCode,


                    CNumber = x.CNumber,


                    CLineNumber = x.CLineNumber,


                    Downloaded = x.Downloaded,


                    SalesValue = x.SalesValue
                }).ToList()
            };

            using (var sta = new StaTaskScheduler(numberOfThreads: 1))
            {
                await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false);
            }
        }