Esempio n. 1
0
// Send to Excel Implementation


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

            using (var ctx = new TariffSupUnitLkpsRepository())
            {
                lst = await ctx.GetTariffSupUnitLkpsByExpressionNav(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 <TariffSupUnitLkpsExcelLine, List <TariffSupUnitLkpsExcelLine> >
            {
                dataToPrint = lst.Select(x => new TariffSupUnitLkpsExcelLine
                {
                    // TariffCategoryCode = x.TariffCategoryCode ,


                    SuppUnitCode2 = x.SuppUnitCode2,


                    SuppUnitName2 = x.SuppUnitName2,


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

            using (var sta = new StaTaskScheduler(numberOfThreads: 1))
            {
                await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false);
            }
        }
Esempio n. 2
0
 internal async void OnCurrentTariffSupUnitLkpsIDChanged(object sender, NotificationEventArgs <string> e)
 {
     using (TariffSupUnitLkpsRepository ctx = new TariffSupUnitLkpsRepository())
     {
         CurrentTariffSupUnitLkps = await ctx.GetTariffSupUnitLkps(e.Data).ConfigureAwait(continueOnCapturedContext: false);
     }
     NotifyPropertyChanged(m => CurrentTariffSupUnitLkps);
 }
Esempio n. 3
0
        public async Task SelectAll()
        {
            IEnumerable <TariffSupUnitLkps> lst = null;

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