internal async void OnCurrentCounterPointPODetailsIDChanged(object sender, NotificationEventArgs <string> e)
 {
     using (CounterPointPODetailsRepository ctx = new CounterPointPODetailsRepository())
     {
         CurrentCounterPointPODetails = await ctx.GetCounterPointPODetails(e.Data).ConfigureAwait(continueOnCapturedContext: false);
     }
     NotifyPropertyChanged(m => CurrentCounterPointPODetails);
 }
        public async Task SelectAll()
        {
            IEnumerable <CounterPointPODetails> lst = null;

            using (var ctx = new CounterPointPODetailsRepository())
            {
                lst = await ctx.GetCounterPointPODetailsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false);
            }
            SelectedCounterPointPODetails = new ObservableCollection <CounterPointPODetails>(lst);
        }
// Send to Excel Implementation


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

            using (var ctx = new CounterPointPODetailsRepository())
            {
                lst = await ctx.GetCounterPointPODetailsByExpressionNav(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 <CounterPointPODetailsExcelLine, List <CounterPointPODetailsExcelLine> >
            {
                dataToPrint = lst.Select(x => new CounterPointPODetailsExcelLine
                {
                    PO_NO = x.PO_NO,


                    SEQ_NO = x.SEQ_NO,


                    ITEM_NO = x.ITEM_NO,


                    ORD_QTY = x.ORD_QTY,


                    ORD_UNIT = x.ORD_UNIT,


                    ITEM_DESCR = x.ITEM_DESCR,


                    ORD_COST = x.ORD_COST,


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

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