Ejemplo n.º 1
0
        protected IEnumerable prepareRecords(PXAdapter adapter)
        {
            List <string> importedRecords = new List <string>();

            SOOrderFilter  curFilter = Filter.Current;
            LUM3DCartSetup curSetup  = SelectFrom <LUM3DCartSetup> .View.SelectSingleBound(this, null);

            PXLongOperation.StartOperation(this, delegate()
            {
                if (curFilter != null)
                {
                    ThreeDCartHelper.PrepareRecords(curSetup, curFilter.EndDate);
                }
            });

            return(adapter.Get());
        }
Ejemplo n.º 2
0
        public virtual void ImportAllRecords(LUM3DCartImportProc graph, List <LUM3DCartProcessOrder> list, SOOrderFilter curFilter)
        {
            if (list.Count < 0)
            {
                return;
            }

            LUM3DCartSetup curSetup = SelectFrom <LUM3DCartSetup> .View.SelectSingleBound(this, null);

            // Because I cannot get the number of records in the current cache, only use BQL select to get the number of records stored.
            int selectedCount = SelectFrom <LUM3DCartProcessOrder> .Where <LUM3DCartProcessOrder.processed.IsNotEqual <True>
                                                                           .And <LUM3DCartProcessOrder.orderDate.IsBetween <@P.AsDateTime, @P.AsDateTime> > >
                                .View.Select(graph, curFilter.StartDate, curFilter.EndDate).Count;

            PXLongOperation.StartOperation(this, delegate()
            {
                using (PXTransactionScope ts = new PXTransactionScope())
                {
                    if (curFilter != null)
                    {
                        if (selectedCount == list.Count)
                        {
                            graph.PrepareRecords.PressButton();
                        }

                        for (int i = 0; i < list.Count; i++)
                        {
                            ThreeDCartHelper.ImportRecords(curSetup, list[i]);
                            UpdateProcessed(list[i]);
                        }
                    }

                    graph.Actions.PressSave();

                    ts.Complete();
                }
            });
        }