예제 #1
0
        public IList <AsycudaDocumentItem> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount)
        {
            try
            {
                if (FilterExpression == "All")
                {
                    FilterExpression = "None";
                }
                if (FilterExpression == null)
                {
                    FilterExpression = "None";
                }
                //FilterExpression = "None";
                using (var ctx = new AsycudaDocumentItemRepository())
                {
                    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 <AsycudaDocumentItem>());
            }
        }
예제 #2
0
 internal async void OnCurrentAsycudaDocumentItemIDChanged(object sender, NotificationEventArgs <string> e)
 {
     using (AsycudaDocumentItemRepository ctx = new AsycudaDocumentItemRepository())
     {
         CurrentAsycudaDocumentItem = await ctx.GetAsycudaDocumentItem(e.Data).ConfigureAwait(continueOnCapturedContext: false);
     }
     NotifyPropertyChanged(m => CurrentAsycudaDocumentItem);
 }
        public async Task SelectAll()
        {
            IEnumerable <AsycudaDocumentItem> lst = null;

            using (var ctx = new AsycudaDocumentItemRepository())
            {
                lst = await ctx.GetAsycudaDocumentItemsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false);
            }
            SelectedAsycudaDocumentItems = new ObservableCollection <AsycudaDocumentItem>(lst);
        }
// Send to Excel Implementation


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

            using (var ctx = new AsycudaDocumentItemRepository())
            {
                lst = await ctx.GetAsycudaDocumentItemsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression, new List <string>() { "AsycudaDocument" }).ConfigureAwait(continueOnCapturedContext: false);
            }
            if (lst == null || !lst.Any())
            {
                MessageBox.Show("No Data to Send to Excel");
                return;
            }
            var s = new ExportToExcel <AsycudaDocumentItemExcelLine, List <AsycudaDocumentItemExcelLine> >
            {
                dataToPrint = lst.Select(x => new AsycudaDocumentItemExcelLine
                {
                    LineNumber = x.LineNumber,


                    IsAssessed = x.IsAssessed,


                    DoNotAllocate = x.DoNotAllocate,


                    DoNotEX = x.DoNotEX,


                    AttributeOnlyAllocation = x.AttributeOnlyAllocation,


                    Description_of_goods = x.Description_of_goods,


                    Commercial_Description = x.Commercial_Description,


                    Gross_weight_itm = x.Gross_weight_itm,


                    Net_weight_itm = x.Net_weight_itm,


                    Item_price = x.Item_price,


                    ItemQuantity = x.ItemQuantity,


                    Suppplementary_unit_code = x.Suppplementary_unit_code,


                    ItemNumber = x.ItemNumber,


                    TariffCode = x.TariffCode,


                    TariffCodeLicenseRequired = x.TariffCodeLicenseRequired,


                    TariffCategoryLicenseRequired = x.TariffCategoryLicenseRequired,


                    TariffCodeDescription = x.TariffCodeDescription,


                    DutyLiability = x.DutyLiability,


                    Total_CIF_itm = x.Total_CIF_itm,


                    Freight = x.Freight,


                    Statistical_value = x.Statistical_value,


                    DPQtyAllocated = x.DPQtyAllocated,


                    DFQtyAllocated = x.DFQtyAllocated,


                    PiQuantity = Convert.ToDouble(x.PiQuantity),


                    ImportComplete = x.ImportComplete,


                    CNumber = x.CNumber,


                    RegistrationDate = x.RegistrationDate,

                    DocumentType = x.AsycudaDocument.DocumentType,


                    Number_of_packages = x.Number_of_packages,


                    //Country_of_origin_code = x.Country_of_origin_code ,


                    //PiWeight = x.PiWeight ,


                    Currency_rate = x.Currency_rate,


                    //Currency_code = x.Currency_code ,


                    InvalidHSCode = x.InvalidHSCode,


                    WarehouseError = x.WarehouseError,

                    SalesFactor = Convert.ToDouble(x.SalesFactor)
                }).ToList()
            };

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