/// <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
         {
             UserId             = UserInfo.Id,
             WorkFlowId         = workflowId,
             WorkTaskId         = worktaskId,
             WorkFlowInstanceId = workflowInsId,
             WorkTaskInstanceId = worktaskInsId,
             WorkFlowNo         = tbxFlowNo.Text,
             CommandName        = command,
             Priority           = drpPriority.SelectedValue,
             WorkflowInsCaption = tbxWorkflowCaption.Text,
             Description        = tbxWorkflowDes.Text,
             IsDraft            = false,
             CurrentUser        = this.UserInfo
         };
         //wfruntime.RunSuccess += WFRuntime_RunSuccess;//流程成功启动时执行的事件
         //wfruntime.RunFail += WFRuntime_RunFail;//流程启动失败时执行的事件
         string returnStatusCode = wfruntime.Start();
         //if (returnStatusCode == WorkFlowConst.SuccessCode)
         //{
         //    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('提交成功,请关闭窗体!');window.close();", true);
         //}
         Response.Redirect("OperTips.aspx?worktaskInsId=" + worktaskInsId);
     }
 }
Esempio n. 2
0
        private void btnAudit_Click(object sender, EventArgs e)
        {
            //保存数据到数据库
            if (string.IsNullOrEmpty(txtBillName.Text))
            {
                MessageBoxHelper.ShowInformationMsg("单据名称不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(txtWFInstanceName.Text))
            {
                MessageBoxHelper.ShowInformationMsg("流程实例名称不能为空!");
                return;
            }
            saveData();
            var wfRunTime = new WorkFlowRuntime();

            wfRunTime.RunSuccess        += WFRuntime_RunSuccess;   //流程成功启动时执行的事件
            wfRunTime.RunFail           += WFRuntime_RunFail;      //流程启动失败时执行的事件
            wfRunTime.UserId             = UserInfo.Id;            //当前操作人id
            wfRunTime.WorkFlowInstanceId = WorkFlowInsId;          //必须保持与业务数据中的该值相同
            wfRunTime.WorkTaskInstanceId = WorkTaskInsId;          //必须保持与业务数据中的该值相同
            wfRunTime.WorkFlowId         = WorkFlowId;             //必须保持与业务数据中的该值相同
            wfRunTime.WorkTaskId         = WorkTaskId;             //必须保持与业务数据中的该值相同
            wfRunTime.WorkFlowNo         = WorkFlowNo;             //流程编号,可以自定义
            wfRunTime.CommandName        = "提交";                   //命令分支,必须与建模中的命令定义名相同,否则无法流转
            wfRunTime.WorkflowInsCaption = txtWFInstanceName.Text; //可以自定义
            wfRunTime.IsDraft            = false;                  // 表示保存草稿,执行start方法的时候流程不流转
            wfRunTime.CurrentUser        = this.UserInfo;          //传递当前用户
            label2.Text = wfRunTime.Start();                       //启动流程
        }
        /// <summary>
        /// 控制流程流转的命令按钮,如提交等
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RunToolStriptButtonEvent(object sender, EventArgs e)
        {
            //if (SaveFormData(false))
            //{
            string command  = (sender as ToolStripButton).Text;
            string priority = "1";

            switch (BusinessLogic.ConvertToString(cboPriority.SelectedItem))
            {
            case "普通":
                priority = "1";
                break;

            case "紧急":
                priority = "2";
                break;

            case "特急":
                priority = "3";
                break;

            default:
                priority = "1";
                break;
            }

            var wfruntime = new WorkFlowRuntime
            {
                UserId             = UserInfo.Id,
                WorkFlowId         = WorkFlowId,
                WorkTaskId         = WorkTaskId,
                WorkFlowInstanceId = WorkFlowInsId,
                WorkTaskInstanceId = WorkTaskInsId,
                WorkFlowNo         = txtBizWorkFlowNo.Text,
                CommandName        = command,
                Priority           = priority,
                WorkflowInsCaption = txtBizWorkFlowName.Text,
                Description        = txtBizWorkFlowDescription.Text,
                IsDraft            = false,
                CurrentUser        = this.UserInfo
            };

            wfruntime.RunSuccess += WFRuntime_RunSuccess; //流程成功启动时执行的事件
            wfruntime.RunFail    += WFRuntime_RunFail;    //流程启动失败时执行的事件
            wfruntime.Start();
            //}
        }