示例#1
0
        public static IWfProcess CreateProcessInstance(WfClientProcessDescriptor client)
        {
            WfProcessDescriptor processDesp = null;

            WfClientProcessDescriptorConverter.Instance.ClientToServer(client, ref processDesp);
            WfProcessStartupParams startupParams = GetInstanceOfWfProcessStartupParams(processDesp);

            startupParams.ApplicationRuntimeParameters["CostCenter"] = "1001";
            startupParams.ApplicationRuntimeParameters["PayMethod"] = "1";
            startupParams.ApplicationRuntimeParameters["Age"] = 30;

            return WfRuntime.StartWorkflow(startupParams);
        }
        /// <summary>
        /// 创建一个没有连线的客户端流程对象
        /// </summary>
        /// <returns></returns>
        public static WfClientProcessDescriptor CreateSimpleClientProcessWithoutLines()
        {
            WfClientProcessDescriptor processDesp = new WfClientProcessDescriptor();

            processDesp.Key = UuidHelper.NewUuidString();
            processDesp.Name = "客户端测试流程";

            processDesp.Activities.Add(ActivityDescriptorHelper.CreateSimpleClientActivityWithUser("Start", "开始", "Requestor", WfClientActivityType.InitialActivity));
            processDesp.Activities.Add(ActivityDescriptorHelper.CreateSimpleClientActivity("End", "结束", WfClientActivityType.CompletedActivity));

            processDesp.RelativeLinks.Add(new WfClientRelativeLinkDescriptor("AP1") { Category = "Process", Url = "http://www.ak47.com" });
            processDesp.CancelEventReceivers.Add(new WfClientUserResourceDescriptor(Consts.Users["Requestor"]));

            return processDesp;
        }
        /// <summary>
        /// 基类中构造开始点和结束点,不包含两个点的连线
        /// </summary>
        /// <param name="processKey"></param>
        /// <param name="processName"></param>
        /// <returns></returns>
        public virtual WfClientProcessDescriptor Build(string processKey, string processName)
        {
            processKey.CheckStringIsNullOrEmpty("processKey");
            processName.CheckStringIsNullOrEmpty("processName");

            WfClientProcessDescriptor processDesp = new WfClientProcessDescriptor();

            processDesp.Key = processKey;
            processDesp.ApplicationName = this._ApplicationName;
            processDesp.ProgramName = this._ProgramName;
            processDesp.Name = processName;

            processDesp.Activities.Add(new WfClientActivityDescriptor(WfClientActivityType.InitialActivity) { Key = "Start", Name = "起草" });
            processDesp.Activities.Add(new WfClientActivityDescriptor(WfClientActivityType.CompletedActivity) { Key = "Complete", Name = "办结" });

            processDesp.Properties.AddOrSetValue("ProbeParentProcessParams", "True");

            return processDesp;
        }
        public static void AssertProcessDescriptor(this WfClientProcessDescriptor cpd, WfClientProcessDescriptor spd)
        {
            cpd.AreSame(spd);

            cpd.Activities.AssertActivityDescriptorCollection(spd.Activities);

            if (cpd.InitialActivity != null)
                Assert.AreEqual(cpd.InitialActivity.Key, spd.InitialActivity.Key);

            if (cpd.CompletedActivity != null)
                Assert.AreEqual(cpd.CompletedActivity.Key, spd.CompletedActivity.Key);

            cpd.RelativeLinks.AssertRelativeLinks(spd.RelativeLinks);
        }
 public WfClientActivityDescriptorCollection(WfClientProcessDescriptor process)
 {
     this._Process = process;
 }
        public void SaveDescriptor(WfClientProcessDescriptor clientProcessDesp)
        {
            OperationContext.Current.FillContextToOguServiceContext();

            WfProcessDescriptor processDesp = null;

            WfClientProcessDescriptorConverter.Instance.ClientToServer(clientProcessDesp, ref processDesp);

            WfSaveTemplateExecutor executor = new WfSaveTemplateExecutor(processDesp);

            executor.Execute();
        }