Пример #1
0
 internal async void OnCurrentTariffCodesIDChanged(object sender, NotificationEventArgs <string> e)
 {
     using (TariffCodesRepository ctx = new TariffCodesRepository())
     {
         CurrentTariffCodes = await ctx.GetTariffCodes(e.Data).ConfigureAwait(continueOnCapturedContext: false);
     }
     NotifyPropertyChanged(m => CurrentTariffCodes);
 }
Пример #2
0
        public async Task SelectAll()
        {
            IEnumerable <TariffCodes> lst = null;

            using (var ctx = new TariffCodesRepository())
            {
                lst = await ctx.GetTariffCodesByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false);
            }
            SelectedTariffCodes = new ObservableCollection <TariffCodes>(lst);
        }
Пример #3
0
        public IList <TariffCodes> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount)
        {
            try
            {
                if (FilterExpression == null)
                {
                    FilterExpression = "All";
                }
                using (var ctx = new TariffCodesRepository())
                {
                    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 <TariffCodes>());
            }
        }
Пример #4
0
// Send to Excel Implementation


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

            using (var ctx = new TariffCodesRepository())
            {
                lst = await ctx.GetTariffCodesByExpressionNav(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 <TariffCodesExcelLine, List <TariffCodesExcelLine> >
            {
                dataToPrint = lst.Select(x => new TariffCodesExcelLine
                {
                    TariffCode = x.TariffCode,


                    Description = x.Description,


                    RateofDuty = x.RateofDuty,


                    EnvironmentalLevy = x.EnvironmentalLevy,


                    CustomsServiceCharge = x.CustomsServiceCharge,


                    ExciseTax = x.ExciseTax,


                    VatRate = x.VatRate,


                    PetrolTax = x.PetrolTax,


                    Units = x.Units,


                    SiteRev3 = x.SiteRev3,


                    TariffCategoryCode = x.TariffCategoryCode,


                    LicenseRequired = x.LicenseRequired,


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

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