Esempio n. 1
0
        private void FilterData()
        {
            var res = new StringBuilder();

            if (!string.IsNullOrEmpty(Prev_reg_nbrFilter))
            {
                res.Append(string.Format("&& Prev_reg_nbr == \"{0}\"", Prev_reg_nbrFilter));
            }

            if (!string.IsNullOrEmpty(Previous_item_numberFilter))
            {
                res.Append(string.Format("&& Previous_item_number == \"{0}\"", Previous_item_numberFilter));
            }

            if (res.Length > 3)
            {
                using (var ctx = new PreviousItemsExRepository())
                {
                    PreviousItems =
                        (ctx.GetPreviousItemsExesByExpression(res.ToString().Substring(3), //Item_Id
                                                              new List <string>()
                    {
                        "PreviousDocumentItem.PreviousDocument",         //
                        // "AsycudaDocumentItem"
                    })).Result.ToList();
                }
            }
        }
Esempio n. 2
0
 internal async void OnCurrentPreviousItemsExIDChanged(object sender, NotificationEventArgs <string> e)
 {
     using (PreviousItemsExRepository ctx = new PreviousItemsExRepository())
     {
         CurrentPreviousItemsEx = await ctx.GetPreviousItemsEx(e.Data).ConfigureAwait(continueOnCapturedContext: false);
     }
     NotifyPropertyChanged(m => CurrentPreviousItemsEx);
 }
        public async Task SelectAll()
        {
            IEnumerable <PreviousItemsEx> lst = null;

            using (var ctx = new PreviousItemsExRepository())
            {
                lst = await ctx.GetPreviousItemsExesByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false);
            }
            SelectedPreviousItemsExes = new ObservableCollection <PreviousItemsEx>(lst);
        }
Esempio n. 4
0
 private async void OnCurrentAsycudaSalesAllocationsExChanged(object sender, NotificationEventArgs <AsycudaSalesAllocationsEx> e)
 {
     if (e.Data.PreviousItem_Id != null)
     {
         using (var ctx = new PreviousItemsExRepository())
         {
             PreviousItems =
                 (await ctx.GetPreviousItemsExesByExpression(string.Format("PreviousDocumentItemId == {0}", e.Data.PreviousItem_Id)).ConfigureAwait(false))
                 .ToList();
         }
     }
 }
Esempio n. 5
0
 private async void OnCurrentPreviousDocumentItemChanged(object sender, NotificationEventArgs <PreviousDocumentItem> e)
 {
     if (e.Data == null)
     {
         PreviousItems = new List <PreviousItemsEx>();
     }
     else
     {
         using (var ctx = new PreviousItemsExRepository())
         {
             PreviousItems =
                 (await ctx.GetPreviousItemsExesByExpression(string.Format("PreviousDocumentItemId == {0}", e.Data.Item_Id),//Item_Id
                                                             new List <string>()
             {
                 "PreviousDocumentItem.PreviousDocument",                                        //
                 // "AsycudaDocumentItem"
             }).ConfigureAwait(false)).ToList();
         }
     }
 }
Esempio n. 6
0
        public IList <PreviousItemsEx> LoadRange(int startIndex, int count, SortDescriptionCollection sortDescriptions, out int overallCount)
        {
            try
            {
                if (FilterExpression == null)
                {
                    FilterExpression = "All";
                }
                using (var ctx = new PreviousItemsExRepository())
                {
                    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 <PreviousItemsEx>());
            }
        }
// Send to Excel Implementation


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

            using (var ctx = new PreviousItemsExRepository())
            {
                lst = await ctx.GetPreviousItemsExesByExpressionNav(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 <PreviousItemsExExcelLine, List <PreviousItemsExExcelLine> >
            {
                dataToPrint = lst.Select(x => new PreviousItemsExExcelLine
                {
                    Packages_number = x.Packages_number,


                    Previous_Packages_number = x.Previous_Packages_number,


                    Hs_code = x.Hs_code,


                    Commodity_code = x.Commodity_code,


                    Previous_item_number = x.Previous_item_number,


                    Goods_origin = x.Goods_origin,


                    Net_weight = x.Net_weight,


                    Prev_net_weight = x.Prev_net_weight,


                    Prev_reg_ser = x.Prev_reg_ser,


                    Prev_reg_nbr = x.Prev_reg_nbr,


                    Prev_reg_dat = x.Prev_reg_dat,


                    Prev_reg_cuo = x.Prev_reg_cuo,


                    Suplementary_Quantity = x.Suplementary_Quantity,


                    Preveious_suplementary_quantity = x.Preveious_suplementary_quantity,


                    Current_value = x.Current_value,


                    Previous_value = x.Previous_value,


                    Current_item_number = x.Current_item_number,


                    QtyAllocated = x.QtyAllocated,


                    RndCurrent_Value = x.RndCurrent_Value,


                    CNumber = x.CNumber,


                    RegistrationDate = x.RegistrationDate,

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

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