Esempio n. 1
0
 internal async void OnCurrentOverShortDetailsEXIDChanged(object sender, NotificationEventArgs <string> e)
 {
     using (OverShortDetailsEXRepository ctx = new OverShortDetailsEXRepository())
     {
         CurrentOverShortDetailsEX = await ctx.GetOverShortDetailsEX(e.Data).ConfigureAwait(continueOnCapturedContext: false);
     }
     NotifyPropertyChanged(m => CurrentOverShortDetailsEX);
 }
        private async void OnOverShortDetailsFilterExpressionChangetals(object sender, SimpleMvvmToolkit.NotificationEventArgs <string> e)
        {
            using (var ctx = new OverShortDetailsEXRepository())
            {
                TotalReceivedValue = await ctx.SumNav(e.Data, vloader.NavigationExpression, "ReceivedValue").ConfigureAwait(false);

                TotalInvoiceValue = await ctx.SumNav(e.Data, vloader.NavigationExpression, "InvoiceValue").ConfigureAwait(false);
            }
        }
        public async Task SelectAll()
        {
            IEnumerable <OverShortDetailsEX> lst = null;

            using (var ctx = new OverShortDetailsEXRepository())
            {
                lst = await ctx.GetOverShortDetailsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false);
            }
            SelectedOverShortDetails = new ObservableCollection <OverShortDetailsEX>(lst);
        }
        private async Task <IEnumerable <OverShortDetailsEX> > GetBadMatchLst()
        {
            using (var ctx = new OverShortDetailsEXRepository())
            {
                var lst = await ctx.GetOverShortDetailsByExpressionNav("All",
                                                                       new Dictionary <string, string>()
                {
                    {
                        "EX", "(Duration > 15) || (AsycudaMonth != InvoiceMonth)"
                    }
                }).ConfigureAwait(false);

                return(lst);
            }
        }
// Send to Excel Implementation


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

            using (var ctx = new OverShortDetailsEXRepository())
            {
                lst = await ctx.GetOverShortDetailsByExpressionNav(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 <OverShortDetailsEXExcelLine, List <OverShortDetailsEXExcelLine> >
            {
                dataToPrint = lst.Select(x => new OverShortDetailsEXExcelLine
                {
                    ReceivedQty = x.ReceivedQty,


                    ItemNumber = x.ItemNumber,


                    ItemDescription = x.ItemDescription,


                    Cost = x.Cost,


                    InvoiceQty = x.InvoiceQty,


                    Status = x.Status,


                    ReceivedValue = x.ReceivedValue,


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

            using (var sta = new StaTaskScheduler(numberOfThreads: 1))
            {
                await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false);
            }
        }
        public IList <OverShortDetailsEX> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount)
        {
            try
            {
                if (FilterExpression == null)
                {
                    FilterExpression = "All";
                }
                using (var ctx = new OverShortDetailsEXRepository())
                {
                    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 <OverShortDetailsEX>());
            }
        }