예제 #1
0
        public void DoAutoAC(NextStep ns, ActivityConfig.ACSeriesRow asr, int revId, ACEngine.RevType revType, DateTime acDate)
        {
            try
            {
                if (ns == null)
                {
                    AutoAC(null, asr, revId, revType, acDate, null, true);
                }
                else
                {
                    AutoAC(ns.prevAc, asr, revId, revType, acDate, ns.FlowQ, true);
                }

                CurrentACE = null;

                FM.GetDocMng().DB.DocContent.AcceptChanges();
            }
            catch (Exception xx)
            {
                if (CurrentACE != null)
                {
                    CurrentACE.Cancel();
                }
                CurrentACE = null;

                throw xx;
            }
        }
예제 #2
0
        public void CreateAC(int acseriesId, DateTime acDate, string ctxTable, int ctxId, int revId, ACEngine.RevType revType)
        {
            //get context process
            atriumDB.ProcessRow pr = null;
            if (ctxTable != null)
            {
                foreach (atriumDB.ProcessContextRow pcr in FM.DB.ProcessContext)
                {
                    if (pcr.LinkTable == ctxTable && pcr.LinkId == ctxId)
                    {
                        pr = pcr.ProcessRow;
                        break;
                    }
                }
            }
            ActivityConfig.ACSeriesRow acsr = FM.AtMng.acMng.DB.ACSeries.FindByACSeriesId(acseriesId);

            AcSeriesOKToAdd.Clear();
            Dictionary <int, atriumBE.CurrentFlow> activeProcesses = this.Workflow.NextSteps();

            Workflow.EnabledProcesses();
            Workflow.AvailableProcesses();

            if (AcSeriesOKToAdd.Contains(acsr))
            {
                //atriumDB.ActivityRow prevAc = null;
                NextStep ns = null;
                foreach (atriumBE.CurrentFlow ap in activeProcesses.Values)
                {
                    ns = LoadNextSteps(acseriesId, ap);
                    //test for process match
                    if (ns != null)
                    {
                        bool match = TestForProcessMatch(pr, ns.prevAc);

                        if (ns != null && ns.prevAc != null && match)
                        {
                            break;
                        }
                    }
                }

                if (ns == null || ns.prevAc == null)
                {
                    activeProcesses = this.Workflow.EnabledProcesses();
                    foreach (atriumBE.CurrentFlow ap in activeProcesses.Values)
                    {
                        ns = LoadNextSteps(acseriesId, ap);
                        if (ns != null)
                        {
                            bool match = TestForProcessMatch(pr, ns.prevAc);
                            if (ns != null && ns.prevAc != null && match)
                            {
                                break;
                            }
                        }
                    }
                }

                this.DoAutoAC(ns, acsr, revId, revType, acDate);
            }
            else
            {
                throw new AtriumException("You cannot perform this activity on this file");
            }
        }
예제 #3
0
 //TFS#54543 BY 2013-8-29
 //made the function overloading so that we can set the activitydate
 public void DoAutoAC(NextStep ns, ActivityConfig.ACSeriesRow asr, int revId, ACEngine.RevType revType)
 {
     DoAutoAC(ns, asr, revId, revType, DateTime.Today);
 }
예제 #4
0
        internal void DoACAllSteps(atriumDB.ActivityRow prevAC, ActivityConfig.ACSeriesRow asr, int revId, ACEngine.RevType revType, DateTime acDate, out ACEngine ace, out atriumDB.ActivityRow newAC, Stack <ParentChildStep> _flowQ, string conversationIndex)
        {
            atriumDB.ProcessRow pr = null;
            if (prevAC != null)
            {
                pr = prevAC.ProcessRow;
            }
            ace     = Add(acDate, asr, pr, false, prevAC, ConnectorType.NextStep, _flowQ, revId, revType, conversationIndex, null);
            ace.ctx = ctx;

            newAC = ace.NewActivity;
            if (ace.HasRel0)
            {
                ace.DoStep(ACEngine.Step.RelatedFields0, true);
            }
            if (ace.HasRel1)
            {
                ace.DoStep(ACEngine.Step.RelatedFields1, true);
            }
            if (ace.HasRel2)
            {
                ace.DoStep(ACEngine.Step.RelatedFields2, true);
            }
            if (ace.HasRel3)
            {
                ace.DoStep(ACEngine.Step.RelatedFields3, true);
            }
            if (ace.HasRel4)
            {
                ace.DoStep(ACEngine.Step.RelatedFields4, true);
            }
            if (ace.HasRel5)
            {
                ace.DoStep(ACEngine.Step.RelatedFields5, true);
            }
            if (ace.HasRel6)
            {
                ace.DoStep(ACEngine.Step.RelatedFields6, true);
            }
            if (ace.HasRel7)
            {
                ace.DoStep(ACEngine.Step.RelatedFields7, true);
            }
            if (ace.HasRel8)
            {
                ace.DoStep(ACEngine.Step.RelatedFields8, true);
            }
            if (ace.HasRel9)
            {
                ace.DoStep(ACEngine.Step.RelatedFields9, true);
            }
            if (ace.HasTimeline)
            {
                ace.DoStep(ACEngine.Step.Timeline, true);
            }

            if (ace.HasDoc & !SkipDoc)
            {
                docDB.DocumentRow dr = (docDB.DocumentRow)ace.relTables["Document0"][0].Row;

                //if (TemplateCode != null) //only set the template if it is provided
                //    dr.templateCode = TemplateCode;

                ace.DocumentDefaults(revId != 0);
                // if (dr.DocContentRow == null)
                //FM.GetDocMng().GetDocContent().Load(dr.DocRefId, dr.CurrentVersion);

                Doc0 = dr.DocContentRow.ContentsAsText;
            }
            else
            {
                ace.FM.GetDocMng().DB.RejectChanges();
                ace.relTables.Remove("Document0");

                ace.NewActivity.SetDocIdNull();
            }
            if (ace.HasBilling)
            {
                ace.DoStep(ACEngine.Step.Billing, true);
            }
        }
예제 #5
0
        private void AutoAC(atriumDB.ActivityRow prevAC, ActivityConfig.ACSeriesRow asr, int revId, ACEngine.RevType revType, DateTime acDate, Stack <ParentChildStep> _flowQ, bool recurse)
        {
            FileManager fmp = FM;

            try
            {
                if (asr.InitialStep == (int)ACEngine.Step.CreateFile)
                {
                    myFM   = FM.AtMng.CreateFile(fmp);
                    prevAC = null;
                    revId  = 0;
                }


                ACEngine             ace;
                atriumDB.ActivityRow newAC;
                DoACAllSteps(prevAC, asr, revId, revType, acDate, out ace, out newAC, _flowQ, null);
                LastActivityId = newAC.ActivityId;
                FM.GetActivity().CalculateBF(newAC, revId != 0, false);
                if (PrototypeAC != null)
                {
                    if (!PrototypeAC.IsActivityCommentNull())
                    {
                        newAC.ActivityComment = PrototypeAC.ActivityComment;
                    }
                    //copy user bfs
                    foreach (atriumDB.ActivityBFRow abfr in PrototypeAC.GetActivityBFRows())
                    {
                        if (abfr.ACBFId == ActivityBFBE.USERBFID)
                        {
                            atriumDB.ActivityBFRow newabfr = (atriumDB.ActivityBFRow)FM.GetActivityBF().Add(newAC);
                            newabfr.BFDate        = abfr.BFDate;
                            newabfr.InitialBFDate = abfr.InitialBFDate;
                            if (!abfr.IsBFCommentNull())
                            {
                                newabfr.BFComment = abfr.BFComment;
                            }
                            newabfr.BFType      = abfr.BFType;
                            newabfr.BFOfficerID = abfr.BFOfficerID;
                        }
                    }
                }
                ace.Save(true, false);

                FM.GetDocMng().GetDocument().Send(newAC);

                //recurse to allow nested files
                if (recurse)
                {
                    AutoNextStep(newAC);
                }
            }
            catch (Exception x)
            {
                myFM = fmp;
                throw x;
            }
            finally
            {
                myFM = fmp;
            }
        }
예제 #6
0
 private void AutoAC(atriumDB.ActivityRow prevAC, ActivityConfig.ACSeriesRow asr, int revId, ACEngine.RevType revType, bool recurse)
 {
     AutoAC(prevAC, asr, revId, revType, DateTime.Today, null, recurse);
 }
예제 #7
0
        public ACEngine Add(DateTime acDate, ActivityConfig.ACSeriesRow acSeries, atriumDB.ProcessRow process, bool adHoc, atriumDB.ActivityRow prevAc, ConnectorType action, Stack <ParentChildStep> _flowQ, int revId, ACEngine.RevType revType, string conversationIndex, DataRow contextRow)
        {
            //if (_flowQ != null)
            //    flowQ = _flowQ;
            if (myACE != null)
            {
                throw new AtriumException("You cannot enter more than one activity at a time on a file.");
            }

            ConnectorType ct;

            if (action == ConnectorType.Reply | action == ConnectorType.ReplyAll | action == ConnectorType.Forward)
            {
                ct = action;
            }
            else
            {
                ct = ConnectorType.NextStep;
            }
            myACE = new ACEngine(FM, acDate, acSeries, process, adHoc, conversationIndex, prevAc, ct, _flowQ, revId, revType, contextRow);
            return(myACE);
        }