예제 #1
0
        protected CRBaseMassProcess()
        {
            primaryGraph = new PXPrimaryGraphCollection(this);
            if (ProcessingDataMember == null)
            {
                throw new PXException(Messages.IsNotProcessing, typeof(TGraph).FullName);
            }

            foreach (Type table in ProcessingDataMember.View.BqlSelect.GetTables())
            {
                PXDBAttributeAttribute.Activate(Caches[table]);
            }

            ProcessingDataMember.SetParametersDelegate(delegate
            {
                bool result = AskParameters();
                Unload();
                TGraph process;
                using (new PXPreserveScope())
                {
                    process = CreateInstance <TGraph>();
                    foreach (var key in this.Caches.Keys)
                    {
                        var clonedCache = process.Caches[key];
                    }
                }

                ProcessingDataMember.SetProcessDelegate(item =>
                {
                    PXGraph graph = primaryGraph[item];
                    if (graph == null)
                    {
                        throw new PXException(ErrorMessages.CantDetermineGraphType);
                    }
                    process.ProccessItem(graph, item);
                    graph.Actions.PressSave();
                    PXCache cache = graph.Caches[typeof(TPrimary)];
                    cache.RestoreCopy(item, cache.Current);
                });
                return(result);
            });

            PXUIFieldAttribute.SetDisplayName <BAccount.acctCD>(Caches[typeof(BAccount)], Messages.BAccountCD);
        }
예제 #2
0
        protected CRBaseMassProcess()
        {
            primaryGraph = new PXPrimaryGraphCollection(this);
            if (ProcessingDataMember == null)
            {
                throw new PXException(string.Format("{0} is not processing graph", typeof(TGraph).FullName));
            }

            Actions["Schedule"].SetVisible(false);
            foreach (Type table in ProcessingDataMember.View.BqlSelect.GetTables())
            {
                PXDBAttributeAttribute.Activate(Caches[table]);
            }

            ProcessingDataMember.SetParametersDelegate(delegate
            {
                bool result = AskParameters();
                Unload();
                TGraph process;
                using (new PXPreserveScope())
                    process = CreateInstance <TGraph>();

                ProcessingDataMember.SetProcessDelegate(item =>
                {
                    PXGraph graph = primaryGraph[item];
                    if (graph == null)
                    {
                        throw new PXException(ErrorMessages.CantDetermineGraphType);
                    }
                    process.ProccessItem(graph, item);
                    graph.Actions.PressSave();
                });
                return(result);
            });

            PXUIFieldAttribute.SetDisplayName <BAccount.acctCD>(Caches[typeof(BAccount)], Messages.BAccountCD);
        }