예제 #1
0
파일: Blocks.cs 프로젝트: ljxu1/DWKit
        public override void Register(ProcessDefinition pd, List <WorkflowBlock> blocks)
        {
            base.Register(pd, blocks);

            var actor = ActorDefinition.Create(string.Format("LegalEntitySigns_{0}", Name), "BudgetItemIsLegalEntityNeedSigns", Name);

            pd.Actors.Add(actor);
            this["_actorRestrictions"] = actor;
        }
예제 #2
0
파일: Blocks.cs 프로젝트: ljxu1/DWKit
        public override void Register(ProcessDefinition pd, List <WorkflowBlock> blocks)
        {
            base.Register(pd, blocks);

            bool isFinal = this["Commands"] == null
                ? true :
                           (this["Commands"] as List <SimpleCommand>).Count == 0;

            //activity
            var c = ActivityDefinition.Create(Name, Name, TryCast <bool>("Initial", false), isFinal, true, true);

            if (c.IsInitial)
            {
                c.AddAction(ActionDefinitionReference.Create("CheckDocumentType", "0", string.Empty));
            }

            //actions
            if (this["AllowEdit"] is bool)
            {
                c.AddAction(ActionDefinitionReference.Create("SetDocumentEditable", "1", this["AllowEdit"].ToString()));
            }

            c.AddAction(ActionDefinitionReference.Create("SetDocumentState", "2", string.Empty));
            c.AddAction(ActionDefinitionReference.Create("UpdateHistory", "3", string.Empty));
            c.AddPreExecutionAction(ActionDefinitionReference.Create("WriteHistory", "0", string.Empty));

            pd.Activities.Add(c);
            this["_currentActivity"] = c;

            //actor
            var users = this["Users"] as string;

            if (!string.IsNullOrWhiteSpace(users))
            {
                var actor = ActorDefinition.Create(string.Format("Actor{0}", Name), "CheckUsers", users);
                pd.Actors.Add(actor);
                this["_actorRestrictions"] = actor;
            }
            else if (c.IsInitial)
            {
                var actor = pd.Actors.FirstOrDefault(a => a.Name == "Author");
                if (actor == null)
                {
                    actor = ActorDefinition.Create("Author", "Author", null);
                    pd.Actors.Add(actor);
                }
                this["_actorRestrictions"] = actor;
            }
        }