private void button1_Click(object sender, EventArgs e) { //保存数据到数据库 saveData(); var wfruntime = new WorkFlowRuntime(); wfruntime.RunSuccess += wfruntime_RunSuccess; wfruntime.RunFail += wfruntime_RunFail; wfruntime.IsDraft = false; //true 表示保存草稿,执行Run方法的时候流程不流转 wfruntime.CurrentUser = this.UserInfo; wfruntime.Run(UserInfo.Id, operatorInsId, "提交"); //命令分支,必须与建模中的命令定义名相同,否则无法流转 }
/// <summary> /// 控制流程流转的命令按钮,如提交等 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RunToolStriptButtonEvent(object sender, EventArgs e) { this.SaveDyAssignNextOper(); string command = (sender as ToolStripButton).Text; var wfRuntime = new WorkFlowRuntime { UserId = UserInfo.Id, WorkFlowId = WorkFlowId, WorkTaskId = WorkTaskId, WorkFlowInstanceId = WorkFlowInsId, WorkTaskInstanceId = WorkTaskInsId, CurrentUser = this.UserInfo }; wfRuntime.RunSuccess += WFRuntime_RunSuccess; wfRuntime.RunFail += WFRuntime_RunFail; wfRuntime.Run(UserInfo.Id, OperatorInsId, command); }
/// <summary> /// 控制流程流转的命令按钮,如提交等 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void RunButtonEvent(object sender, EventArgs e) { if (SaveUserControl(false)) { string command = (sender as Button).Text; var wfruntime = new WorkFlowRuntime { CurrentUser = this.UserInfo }; string returnStatusCode = wfruntime.Run(this.UserInfo.Id, operatorInsId, command); Response.Redirect("OperTips.aspx?worktaskInsId=" + workTaskInsId); } else { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('您好!出现以下错误未能提交流程。" + eorr + "');", true); } }