GetProcessInstance() public method

获取流程正常实例数据
public GetProcessInstance ( Slickflow.Engine.Common.WfAppRunner runner, IDbConnection conn = null ) : ProcessInstanceEntity
runner Slickflow.Engine.Common.WfAppRunner
conn IDbConnection
return Slickflow.Engine.Business.Entity.ProcessInstanceEntity
コード例 #1
0
        protected void InitFlowInfo()
        {
            int AppInstanceID = Request.QueryString["AppInstanceID"] == null ? 0 : Helper.ConverToInt32(Request.QueryString["AppInstanceID"].ToString());
            string ProcessGUID = Request.QueryString["ProcessGUID"] == null ? string.Empty : Request.QueryString["ProcessGUID"].ToString();
            int ActivityInstanceID = Request.QueryString["ActivityInstanceID"] == null ? 0 : Helper.ConverToInt32(Request.QueryString["ActivityInstanceID"].ToString());
            if (AppInstanceID > 0)
            {
                HrsLeaveEntity hrsLeaveEntity = WorkFlows.GetHrsLeaveModel(AppInstanceID);
                if (hrsLeaveEntity != null && hrsLeaveEntity.ID > 0)
                {
                    selectLeaveType.Value = hrsLeaveEntity.LeaveType.ToString();
                    selectLeaveType.Disabled = true;
                    txtDays.Value = hrsLeaveEntity.Days.ToString();
                    txtFromDate.Value = hrsLeaveEntity.FromDate.ToString("yyyy-MM-dd");
                    txtToDate.Value = hrsLeaveEntity.ToDate.ToString("yyyy-MM-dd");
                    hiddenInstanceId.Value = hrsLeaveEntity.ID.ToString();
                    hiddenActivityInstanceID.Value = ActivityInstanceID.ToString();

                    this.txtDepmanagerRemark.Value = hrsLeaveEntity.DepManagerRemark;
                    this.txtDirectorRemark.Value = hrsLeaveEntity.DirectorRemark;//主管总监
                    this.txtDeputyGeneralRemark.Value = hrsLeaveEntity.DeputyGeneralRemark;//副总经理
                    this.txtGeneralManagerRemark.Value = hrsLeaveEntity.GeneralManagerRemark;//总经理

                    //权限设置
                    IWorkflowService service = new WorkflowService();
                    ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(ActivityInstanceID);
                    ProcessInstanceEntity processInstanceEntity = service.GetProcessInstance(activityInstanceEntity.ProcessInstanceID);

                    this.txtProcessGUID.Value = activityInstanceEntity.ProcessGUID;
                    if (activityInstanceEntity != null)
                    {
                        ActivityEntity activityEntity = service.GetActivityEntity(processInstanceEntity.ProcessGUID,
                            processInstanceEntity.Version,
                            activityInstanceEntity.ActivityGUID);

                        var roles = service.GetActivityRoles(processInstanceEntity.ProcessGUID,
                            processInstanceEntity.Version,
                            activityInstanceEntity.ActivityGUID);

                        if (activityEntity != null && roles != null && roles.Count > 0)
                        {
                            foreach (var role in roles)
                            {
                                if (role.ID == LoginRoleID)
                                {
                                    switch (role.ID)
                                    {
                                        case 2://部门经理
                                            this.txtDepmanagerRemark.Disabled = false;
                                            hiddenPerformField.Value = "DepManager";
                                            break;

                                        case 4://主管总监
                                            this.txtDirectorRemark.Disabled = false;
                                            hiddenPerformField.Value = "Director";
                                            break;

                                        case 7://副总经理
                                            this.txtDeputyGeneralRemark.Disabled = false;
                                            hiddenPerformField.Value = "Deputy";
                                            break;

                                        case 8://总经理
                                            this.txtGeneralManagerRemark.Disabled = false;
                                            hiddenPerformField.Value = "General";
                                            break;
                                    }
                                }
                            }
                        }
                    }

                }
            }
        }
コード例 #2
0
        public ProcessInstanceEntity GetProcessInstance()
        {
            IWorkflowService service = new WorkflowService();
            var instance = service.GetProcessInstance(14001);

            return instance;
        }
コード例 #3
0
ファイル: LeaveController.cs プロジェクト: yydon/slickflow
        public ActionResult List(int id = 1, string processGuid = "", int activityInstanceID = 0)
        {
            if (id == 1)
            {
                ViewBag.Message = "非法链接";
                return View();
            }
            else
            {
                if (string.IsNullOrEmpty(processGuid))
                {
                    WorkFlowManager work = new WorkFlowManager();
                    LeaveEntity entity = work.FindById(id);
                    string s = @"<table class='table table-bordered'>"
                                + "<tr><td>部门经理</td><td>" + entity.DepManagerRemark + "</td></tr>"
                                + "<tr><td>主管总监 </td><td>" + entity.DirectorRemark + "</td></tr>"
                                + "<tr><td>副总经理</td><td>" + entity.DeputyGeneralRemark + "</td></tr>"
                                + "<tr><td>总经理</td><td>" + entity.GeneralManagerRemark + "</td> </tr></table>";
                    ViewBag.Shenpi = s;
                    return View(entity);
                }
                else
                {
                    WorkFlowManager work = new WorkFlowManager();
                    LeaveEntity entity = work.FindById(id);
                    //权限设置
                    IWorkflowService service = new WorkflowService();

                    ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(activityInstanceID);
                    ProcessInstanceEntity processInstanceEntity = service.GetProcessInstance(activityInstanceEntity.ProcessInstanceID);

                    string s = "";
                    if (activityInstanceEntity != null)
                    {
                        ActivityEntity activityEntity = service.GetActivityEntity(processGuid, 
                            processInstanceEntity.Version,
                            activityInstanceEntity.ActivityGUID);

                        var roles = service.GetActivityRoles(processGuid, processInstanceEntity.Version, activityInstanceEntity.ActivityGUID);
                        if (activityEntity != null && roles != null && roles.Count > 0)
                        {
                            //用户角色列表
                            IList<string> roleUser = UserManager.GetRoles(Convert.ToInt32(User.Identity.GetUserId()));

                            foreach (var role in roles)
                            {
                                //为方便起见这里只取第一个角色,开发人员可以自行调整
                                if (role.RoleCode == roleUser[0].ToString())
                                {
                                    switch (role.ID)
                                    {
                                        case 2:
                                            //部门经理审批
                                            s = @"<table class='table table-bordered'>" +
                                            "<tr><td>部门经理</td><td><input type='text'class='form-control' name='DepManagerRemark'></td></tr>" +
                                            "<tr><td>主管总监 </td><input type='text' class='form-control' name='DirectorRemark' style='display:none'></td></tr>" +
                                            "<tr><td>副总经理</td><td><input type='text' class='form-control' name='DeputyGeneralRemark' style='display:none'></td></tr>" +
                                            "<tr><td>总经理</td><td><input class='form-control' name='GeneralManagerRemark'  style='display:none' type='text' /> </td> </tr>"
                                            ;
                                            break;
                                        case 3:
                                            //主管总监审批
                                            s = @"<table class='table table-bordered'>" +
                                            "<tr><td>部门经理</td><td>" + entity.DepManagerRemark + "<input type='text'class='form-control'  style='display:none' name='DepManagerRemark' value='" + entity.DepManagerRemark + "'></td></tr>" +
                                            "<tr><td>主管总监 </td><input type='text' class='form-control' name='DirectorRemark' ></td></tr>" +
                                            "<tr><td>副总经理</td><td><input type='text' class='form-control' name='DeputyGeneralRemark' style='display:none'></td></tr>" +
                                            "<tr><td>总经理</td><td><input class='form-control' name='GeneralManagerRemark'  style='display:none' type='text' /> </td> </tr>"
                                                                                ;
                                            break;
                                        case 7:
                                            //副总经理审批
                                            s = @"<table class='table table-bordered'>" +
                                            "<tr><td>部门经理</td><td>" + entity.DepManagerRemark + "<input type='text'class='form-control' style='display:none' name='DepManagerRemark' value='" + entity.DepManagerRemark + "'></td></tr>" +
                                            "<tr><td>主管总监 </td><td>" + entity.DirectorRemark + "<input type='text' class='form-control' name='DirectorRemark' value='" + entity.DirectorRemark + "' ></td></tr>" +
                                            "<tr><td>副总经理</td><td><input type='text' class='form-control' name='DeputyGeneralRemark' style='display:none'></td></tr>" +
                                            "<tr><td>总经理</td><td><input class='form-control' name='GeneralManagerRemark'  style='display:none' type='text' /> </td> </tr>";
                                            break;
                                        case 8:
                                            //总经理审批
                                            s = @"<table class='table table-bordered'>" +
"<tr><td>部门经理</td><td>" + entity.DepManagerRemark + "<input type='text'class='form-control' style='display:none' name='DepManagerRemark' value='" + entity.DepManagerRemark + "'></td></tr>" +
"<tr><td>主管总监 </td><td>" + entity.DirectorRemark + "<input type='text' class='form-control' name='DirectorRemark' value='" + entity.DirectorRemark + "' ></td></tr>" +
"<tr><td>副总经理</td><td><input type='text' class='form-control' name='DeputyGeneralRemark' style='display:none' value='" + entity.DeputyGeneralRemark + "'></td></tr>" +
"<tr><td>总经理</td><td><input class='form-control' name='GeneralManagerRemark' type='text' /> </td> </tr>"
                                    ;
                                            break;
                                    }
                                }
                            }
                        }
                    }
                    //获取当前角色      
                    ViewBag.Shenpi = "<form action='' id='Remark'>" + s + "</table></form><button class='btn btn-primary' id='agree'>同意</button><button class='btn btn-primary' id='return'>退回</button>";
                    ViewBag.processGUID = processGuid;
                    ViewBag.days = entity.Days;
                    return View(entity);
                }
            }
            //表示出现错误
            return View();
        }