GetActivityEntity() public method

获取当前活动实体
public GetActivityEntity ( string processGUID, string version, string activityGUID ) : ActivityEntity
processGUID string
version string
activityGUID string
return Slickflow.Engine.Xpdl.ActivityEntity
        /// <summary>
        /// 获取节点信息
        /// </summary>
        /// <param name="processGUID"></param>
        /// <param name="version"></param>
        /// <param name="activityGUID"></param>
        /// <returns></returns>
        public ActivityEntity GetActivity(string processGUID, string version, string activityGUID)
        {
            var wfService = new WorkflowService();
            var activityEntity = wfService.GetActivityEntity(processGUID, version, activityGUID);

            return activityEntity;
        }
        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();
                    ProcessEntity processEntity = service.GetProcessById(ProcessGUID);
                    if (processEntity != null)
                    {
                        this.txtProcessGUID.Value = processEntity.ProcessGUID.ToString();

                        ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(ActivityInstanceID);
                        if (activityInstanceEntity != null)
                        {
                            ActivityEntity activityEntity = service.GetActivityEntity(ProcessGUID, activityInstanceEntity.ActivityGUID);
                            if (activityEntity != null && activityEntity.Roles != null && activityEntity.Roles.Count > 0)
                            {
                                foreach (var role in activityEntity.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;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#3
0
        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();
                    ProcessEntity processEntity = service.GetProcessById(processGuid);
                    if (processEntity != null)
                    {
                        ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(activityInstanceID);
                        string s = "";
                        if (activityInstanceEntity != null)
                        {
                            ActivityEntity activityEntity = service.GetActivityEntity(processGuid, activityInstanceEntity.ActivityGUID);
                            if (activityEntity != null && activityEntity.Roles != null && activityEntity.Roles.Count > 0)
                            {
                                //用户角色列表
                                IList<string> roleUser = UserManager.GetRoles(Convert.ToInt32(User.Identity.GetUserId()));

                                foreach (var role in activityEntity.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();
        }