當前位置: 首頁>>代碼示例>>C#>>正文


C# WorkflowService.StartProcess方法代碼示例

本文整理匯總了C#中Slickflow.Engine.Service.WorkflowService.StartProcess方法的典型用法代碼示例。如果您正苦於以下問題:C# WorkflowService.StartProcess方法的具體用法?C# WorkflowService.StartProcess怎麽用?C# WorkflowService.StartProcess使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Slickflow.Engine.Service.WorkflowService的用法示例。


在下文中一共展示了WorkflowService.StartProcess方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: StartProcess

        /// <summary>
        /// 啟動流程
        /// </summary>
        public WfExecutedResult StartProcess(WfAppRunner runner)
        {
            //啟動流程
            var wfService = new WorkflowService();
            var result = wfService.StartProcess(runner);

            return result;
        }
開發者ID:huoxudong125,項目名稱:Slickflow,代碼行數:11,代碼來源:WfAppInteropService.cs

示例2: WfAppRunner

 private void btn開始_Click(object sender, EventArgs e)
 {
     WfAppRunner appRunner = new WfAppRunner();
     appRunner.ProcessGUID = process_guid;
     appRunner.AppInstanceID = application_instance_id;
     //指定第一步的處理人
     appRunner.AppName = "officeIn";
     appRunner.UserID = "1";
     appRunner.UserName = "user1";
     IWorkflowService wfService = new WorkflowService();
     var result = wfService.StartProcess(appRunner);
     var msg = string.Format("流程運行結果:{0}\r\n{1}\r\n", result.Status, result.Message);
     tBoxResult.Text += msg;
 }
開發者ID:huoxudong125,項目名稱:Slickflow,代碼行數:14,代碼來源:FormOfficeIn.cs

示例3: btnPrintOrder_Click

        /// <summary>
        /// 打單節點
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPrintOrder_Click(object sender, EventArgs e)
        {
            WfAppRunner appRunner = new WfAppRunner();
            appRunner.ProcessGUID = process_guid;
            appRunner.AppInstanceID = application_instance_id;
            appRunner.AppName = application_name;
            appRunner.UserID = per_dict["yiran"];
            appRunner.UserName = "yiran";

            //先啟動流程
            var wfService = new WorkflowService();
            var r1 = wfService.StartProcess(appRunner);

            var msg = string.Format("生產訂單流程開始:{0}, {1}\r\n", r1.Status, r1.Message);
            WriteText(msg);

            if (r1.Status == WfExecutedStatus.Success)
            {
                //打單環節加入條件,運行流程
                var cond = new Dictionary<string, string>();

                cond["CanUseStock"] = chkStock.Checked.ToString().ToLower();
                cond["IsHavingWeight"] = chkWeight.Checked.ToString().ToLower();

                appRunner.Conditions = cond;

                string message = string.Empty;
                var nextSteps = wfService.GetNextActivityTree(appRunner, cond);
                if (nextSteps != null)
                {
                    appRunner.NextActivityPerformers = CreateNextActivityPerformers(nextSteps);

                    var r2 = wfService.RunProcessApp(appRunner);
                    message = r2.Message;
                    WriteText(string.Format("執行【打單】: {0}, {1}\r\n", r2.Status, r2.Message));

                    if (r2.Status == WfExecutedStatus.Success)
                    {
                        WriteText(string.Format("任務已經發送到下一節點:{0}\r\n\r\n", nextSteps[0].ActivityName));
                    }
                }
                else
                {
                    message = "下一步節點不匹配!";
                    WriteText(string.Format("{0}\r\n", message));
                }
            }
        }
開發者ID:huoxudong125,項目名稱:Slickflow,代碼行數:53,代碼來源:MOrderUserCaseForm.cs

示例4: StartProcess

        public ResponseResult StartProcess(WfAppRunner starter)
        {
            IWorkflowService wfService = new WorkflowService();
            IDbConnection conn = SessionFactory.CreateConnection();

            IDbTransaction trans = null;
            try
            {
                trans = conn.BeginTransaction();
                WfExecutedResult result = wfService.StartProcess(conn, starter, trans);

                if (result.Status == WfExecutedStatus.Success)
                {
                    trans.Commit();
                    int newProcessInstanceID = result.ProcessInstanceIDStarted;
                    IList<NodeView> nextSteps = wfService.GetNextActivityTree(starter);
                    return ResponseResult.Success();
                }
                else
                {
                    trans.Rollback();
                    return ResponseResult.Error(result.Message);
                }
            }
            catch (WorkflowException w)
            {
                trans.Rollback();
                return ResponseResult.Error(w.Message);
            }
            finally
            {
                trans.Dispose();
                if (conn.State == ConnectionState.Open)
                    conn.Close();
            }
        }
開發者ID:huoxudong125,項目名稱:Slickflow,代碼行數:36,代碼來源:WfTaskMISignTogetherController.cs

示例5: StartupRunEnd

        public void StartupRunEnd()
        {
            IDbConnection conn = new SqlConnection(DBConfig.ConnectionString);
            conn.Open();

            ////StarterA:
            ////{"UserID":"10","UserName":"Long","AppName":"SamplePrice","AppInstanceID":"100","ProcessGUID":"072af8c3-482a-4b1c-890b-685ce2fcc75d"}
            var initiator = new WfAppRunner();
            initiator.AppName = "SamplePrice";
            initiator.AppInstanceID = 100;
            initiator.ProcessGUID = Guid.Parse("072af8c3-482a-4b1c-890b-685ce2fcc75d");
            initiator.UserID = 10;
            initiator.UserName = "Long";

            IWorkflowService service = new WorkflowService();

            //流程開始->業務員提交
            IDbTransaction trans = conn.BeginTransaction();
            try
            {
                service.StartProcess(conn, initiator, trans);
                trans.Commit();
            }
            catch
            {
                trans.Rollback();
                throw;
            }
            finally
            {
                trans.Dispose();
            }

            //業務員提交->板房簽字
            var banFangNodeGuid = "fc8c71c5-8786-450e-af27-9f6a9de8560f";
            PerformerList pList = new PerformerList();
            pList.Add(new Performer(20, "Zhang"));

            initiator.NextActivityPerformers = new Dictionary<Guid, PerformerList>();
            initiator.NextActivityPerformers.Add(Guid.Parse(banFangNodeGuid), pList);

            trans = conn.BeginTransaction();
            try
            {
                service.RunProcessApp(conn, initiator, trans);
                trans.Commit();
            }
            catch
            {
                trans.Rollback();
                throw;
            }
            finally
            {
                trans.Dispose();
            }

            //板房簽字->業務員簽字
            //登錄用戶身份
            initiator.UserID = 20;
            initiator.UserName = "Zhang";

            var salesGuid = "39c71004-d822-4c15-9ff2-94ca1068d745";
            pList.Clear();
            pList.Add(new Performer(10, "Long"));

            initiator.NextActivityPerformers.Clear();
            initiator.NextActivityPerformers.Add(Guid.Parse(salesGuid), pList);
            trans = conn.BeginTransaction();
            try
            {
                service.RunProcessApp(conn, initiator, trans);
                trans.Commit();
            }
            catch
            {
                trans.Rollback();
                throw;
            }
            finally
            {
                trans.Dispose();
            }

            //業務員簽字->結束
            //登錄用戶身份
            initiator.UserID = 10;
            initiator.UserName = "Lhang";

            var endGuid = "b70e717a-08da-419f-b2eb-7a3d71f054de";
            pList.Clear();
            pList.Add(new Performer(10, "Long"));

            initiator.NextActivityPerformers.Clear();
            initiator.NextActivityPerformers.Add(Guid.Parse(endGuid), pList);
            trans = conn.BeginTransaction();
            try
            {
                service.RunProcessApp(conn, initiator, trans);
                trans.Commit();
//.........這裏部分代碼省略.........
開發者ID:zengcheng,項目名稱:Slickflow,代碼行數:101,代碼來源:ProcessRunningTest.cs

示例6: btnStartup_Click

        /// <summary>
        /// 啟動流程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStartup_Click(object sender, EventArgs e)
        {
            WfAppRunner appRunner = new WfAppRunner();
            appRunner.ProcessGUID = process_guid;
            appRunner.AppInstanceID = application_instance_id;
            appRunner.AppName = "WallwaOrder";
            appRunner.UserID = "1";
            appRunner.UserName = "admin";

            IWorkflowService wfService = new WorkflowService();
            var result = wfService.StartProcess(appRunner);
            var msg = string.Format("流程啟動結果:{0}\r\n", result.Status);
            textBox1.Text += msg;
        }
開發者ID:zengfanlin,項目名稱:Slickflow,代碼行數:19,代碼來源:FlowForm.cs

示例7: btnSave_Click

        //提交請假信息
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string processGUID = this.txtProcessGUID.Value.ToString();
                string stepGuid = this.hiddenStepGuid.Value.ToString();
                int stepUserID = Helper.ConverToInt32(this.hiddenStepUser.Value.ToString().Trim());
                decimal days = Helper.ConverToDecimal(this.txtDays.Value);
                int leaveType = Helper.ConverToInt32(selectLeaveType.Value);

                int nextUserID = 0;
                string nextUserName = string.Empty;

                SysUserEntity userEntity = WorkFlows.GetSysUserModel(stepUserID);
                if (userEntity != null && userEntity.ID > 0)
                {
                    nextUserID = userEntity.ID;
                    nextUserName = userEntity.UserName;
                }

                DateTime now = DateTime.Now;

                //請假業務數據
                HrsLeaveEntity hrsLeaveEntity = new HrsLeaveEntity();
                hrsLeaveEntity.LeaveType = leaveType;
                hrsLeaveEntity.Days = days;
                try
                {
                    hrsLeaveEntity.FromDate = Helper.ConvertToDateTime(this.txtFromDate.Value, now);
                }
                catch (Exception ex)
                {
                    hrsLeaveEntity.FromDate = now;
                }
                try
                {
                    hrsLeaveEntity.ToDate = Helper.ConvertToDateTime(this.txtToDate.Value, now);
                }
                catch (Exception ex)
                {
                    hrsLeaveEntity.ToDate = now;
                }
                hrsLeaveEntity.CurrentActivityText = string.Empty;
                hrsLeaveEntity.Status = 0;
                hrsLeaveEntity.CreatedUserID = LoginUserID;
                hrsLeaveEntity.CreatedUserName = this.LoginUserName;
                hrsLeaveEntity.CreatedDate = now;

                int instanceId = WorkFlows.AddHrsLeave(hrsLeaveEntity);
                if (instanceId > 0)
                {
                    //調用流程
                    IWorkflowService service = new WorkflowService();

                    WfAppRunner initiator = new WfAppRunner();
                    initiator.AppName = "請假流程";
                    initiator.AppInstanceID = instanceId.ToString();
                    initiator.ProcessGUID = processGUID;
                    initiator.UserID = LoginUserID.ToString();
                    initiator.UserName = LoginUserName;
                    initiator.Conditions = GetCondition(string.Format("days-{0}", days));
                    WfExecutedResult startedResult = service.StartProcess(initiator);
                    if (startedResult.Status != WfExecutedStatus.Success)
                    {
                        base.RegisterStartupScript("", "<script>alert('" + startedResult.Message + "');</script>");
                        return;
                    }

                    //送往下一步
                    PerformerList pList = new PerformerList();
                    pList.Add(new Performer(nextUserID.ToString(), nextUserName));

                    initiator.NextActivityPerformers = new Dictionary<String, PerformerList>();
                    initiator.NextActivityPerformers.Add(stepGuid, pList);

                    WfExecutedResult runAppResult = service.RunProcessApp(initiator);
                    if (runAppResult.Status != WfExecutedStatus.Success)
                    {
                        base.RegisterStartupScript("", "<script>alert('" + runAppResult.Message + "');</script>");
                        return;
                    }

                    //保存業務數據
                    BizAppFlowEntity AppFlowEntity = new Entity.BizAppFlowEntity();
                    AppFlowEntity.AppName = "流程發起";
                    AppFlowEntity.AppInstanceID = instanceId.ToString();
                    AppFlowEntity.ActivityName = "流程發起";
                    AppFlowEntity.Remark = string.Format("申請人:{0}-{1}", LoginUserID, LoginUserName);
                    AppFlowEntity.ChangedTime = now;
                    AppFlowEntity.ChangedUserID = LoginUserID;
                    AppFlowEntity.ChangedUserName = LoginUserName;

                    WorkFlows.AddBizAppFlow(AppFlowEntity);

                    base.RegisterStartupScript("", "<script>alert('流程發起成功');window.location.href='FlowList.aspx';</script>");

                }
            }
            catch (Exception ex)
//.........這裏部分代碼省略.........
開發者ID:zengcheng,項目名稱:Slickflow,代碼行數:101,代碼來源:HrsLeaveApply.aspx.cs

示例8: Add

        public async Task<ActionResult> Add(LeaveViewModel leave)
        {
            string processGUID = leave.ProcessGUID;
            //驗證不通過,重新填寫表單
            if (!ModelState.IsValid)
            {
                return View();
            }
            IWorkflowService service = new WorkflowService();
            //流程開始第一步
            ActivityEntity firstActivity = service.GetFirstActivity(leave.ProcessGUID);

            //該處較上一版本有變化,上一版本為GUID類型
            string firstActivityGUID = firstActivity.ActivityGUID;
            IList<NodeView> nextActivity = service.GetNextActivity(leave.ProcessGUID, firstActivityGUID, GetCondition("days-" + leave.Days));
            //表示有下一位審批者
            if (nextActivity.Count() > 0)
            {
                //下一步角色ID審批者
                string outerId = nextActivity[0].Roles[0].ID.ToString();
                //這裏隻取第一個審批者,WebDemo 是彈窗形式選擇
                //審批用戶id
                IEnumerable<int> userId = RoleManager.FindById(Convert.ToInt32(outerId)).Users.Select(t => t.UserId);
                ApplicationUser user = await UserManager.FindByIdAsync(Convert.ToInt32(userId.ToList()[0]));
                //提交請假信息
                LeaveEntity leaveE = new LeaveEntity()
                {
                    FromDate = leave.BeginTime,
                    ToDate = leave.EndTime,
                    Days = leave.Days,
                    LeaveType = leave.LeaveType,
                    CurrentActivityText = "",
                    Status = 0,
                    CreatedUserID = Convert.ToInt32(User.Identity.GetUserId()),
                    CreatedUserName = User.Identity.Name,
                    CreatedDate = DateTime.Now
                };
                HrsLeaveResult result = new WorkFlowManager().Insert(leaveE);
                if (result.Successed)
                {
                    WfAppRunner initiator = new WfAppRunner();
                    initiator.AppName = "請假流程";
                    initiator.AppInstanceID = result.ResultIdentities.ToString();
                    initiator.ProcessGUID = processGUID;
                    initiator.UserID = User.Identity.GetUserId();
                    initiator.UserName = User.Identity.Name;
                    initiator.Conditions = GetCondition(string.Format("days-{0}", leave.Days));
                    WfExecutedResult startedResult = service.StartProcess(initiator);
                    if (startedResult.Status != WfExecutedStatus.Success)
                    {
                        //給出提示
                    }
                    //送往下一步
                    PerformerList pList = new PerformerList();
                    //這裏使用真實姓名代替
                    pList.Add(new Performer(user.Id.ToString(), user.RealName));
                    initiator.NextActivityPerformers = new Dictionary<String, PerformerList>();
                    initiator.NextActivityPerformers.Add(nextActivity[0].ActivityGUID, pList);
                    WfExecutedResult runAppResult = service.RunProcessApp(initiator);
                    if (runAppResult.Status != WfExecutedStatus.Success)
                    {
                        this.Content("<script>alert('" + runAppResult.Message + "');</script>");
                    }
                    //保存業務數據
                    BizAppFlowEntity AppFlowEntity = new BizAppFlowEntity();
                    AppFlowEntity.AppName = "流程發起";
                    AppFlowEntity.AppInstanceID = result.ResultIdentities.ToString();
                    AppFlowEntity.ActivityName = "流程發起";
                    AppFlowEntity.Remark = string.Format("申請人:{0}-{1}", User.Identity.GetUserId(), User.Identity.Name);
                    AppFlowEntity.ChangedTime = DateTime.Now;
                    AppFlowEntity.ChangedUserID = User.Identity.GetUserId();
                    AppFlowEntity.ChangedUserName = User.Identity.Name;
                    HrsLeaveResult resultBiz = new WorkFlowManager().Insert(AppFlowEntity);
                    if (resultBiz.Successed)
                    {
                        //給出前台提示
                        this.Content("", "<script>alert('流程發起成功');</script>");
                    }
                }
            }
            else
            {
                //顯示前台錯誤,人事人員審批失敗
                ModelState.AddModelError("Human", "該用戶暫時不可提交審批,未查詢到該用戶的下一位審批者");
                return View();
            }
            return RedirectToAction("MySlickflow", "Slickflow");
        }
開發者ID:zengcheng,項目名稱:Slickflow,代碼行數:88,代碼來源:LeaveController.cs


注:本文中的Slickflow.Engine.Service.WorkflowService.StartProcess方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。