// Send to Excel Implementation


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

            using (var ctx = new Customs_ProcedureRepository())
            {
                lst = await ctx.GetCustoms_ProcedureByExpressionNav(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 <Customs_ProcedureExcelLine, List <Customs_ProcedureExcelLine> >
            {
                dataToPrint = lst.Select(x => new Customs_ProcedureExcelLine
                {
                    Extended_customs_procedure = x.Extended_customs_procedure,


                    National_customs_procedure = x.National_customs_procedure,


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

            using (var sta = new StaTaskScheduler(numberOfThreads: 1))
            {
                await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false);
            }
        }
예제 #2
0
 internal async void OnCurrentCustoms_ProcedureIDChanged(object sender, NotificationEventArgs <string> e)
 {
     using (Customs_ProcedureRepository ctx = new Customs_ProcedureRepository())
     {
         CurrentCustoms_Procedure = await ctx.GetCustoms_Procedure(e.Data).ConfigureAwait(continueOnCapturedContext: false);
     }
     NotifyPropertyChanged(m => CurrentCustoms_Procedure);
 }
 private async Task LoadCustomsProcedures()
 {
     using (var ctx = new Customs_ProcedureRepository())
     {
         _customs_Procedures = new ObservableCollection <Customs_Procedure>(await ctx.Customs_Procedure().ConfigureAwait(false));
         NotifyPropertyChanged(x => this.Customs_Procedures);
     }
 }
        public async Task SelectAll()
        {
            IEnumerable <Customs_Procedure> lst = null;

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