Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (this.RequestActionString.ToLower())
            {
            case "submittask":
                Aim.WorkFlow.WinService.Task task = Aim.WorkFlow.WorkFlow.ServiceClient.GetTaskByTaskId(this.RequestData["TaskId"].ToString());
                if (task.Status == 0)
                {
                    Aim.WorkFlow.WorkFlow.SubmitTask("", task.WorkflowInstanceID, task.BookmarkName, GetApprovalResult(task));
                }
                PageState.Add("message", "提交成功!");
                break;

            case "checkstate":
                //检查如果有后续任务未提交,则设置状态为已提交.
                Aim.WorkFlow.Task taskpre = Aim.WorkFlow.Task.Find(this.RequestData["TaskId"].ToString());
                if (taskpre.Status == 0 && DataHelper.QueryDataTable("select * from Task where WorkFlowInstanceId='" + taskpre.WorkflowInstanceID + "' and ApprovalNodeName<>'" + taskpre.ApprovalNodeName + "' and CreatedTime>'" + taskpre.CreatedTime + "' and Status=0").Rows.Count > 0)
                {
                    taskpre.Status = 4;
                    taskpre.Save();
                }
                break;

            case "savetask":
                Aim.WorkFlow.Task tas = Aim.WorkFlow.Task.Find(this.RequestData["TaskId"].ToString());
                tas.FinishTime = DateTime.Now;
                tas.Status     = 4;
                tas.Save();
                break;

            default:
                if (this.RequestData["TaskId"] != null && !string.IsNullOrEmpty(this.RequestData["TaskId"].ToString()))
                {
                    Aim.WorkFlow.Task fTask = Aim.WorkFlow.Task.Find(this.RequestData["TaskId"].ToString());
                    if (!fTask.UpdatedTime.HasValue)
                    {
                        fTask.UpdatedTime = DateTime.Now;
                        fTask.Save();
                    }
                    //捕获节点扩展信息配置,如已阅,加签,并行等信息
                    this.PageState.Add("ExtData", GetNodeExtData(fTask));
                    Aim.WorkFlow.WorkflowInstance instance = WorkflowInstance.Find(fTask.WorkflowInstanceID);
                    this.PageState.Add("InstanceId", fTask.WorkflowInstanceID);
                    this.PageState.Add("TemplateId", instance.WorkflowTemplateID);
                    FlowInstanceId = instance.ID;
                    FormUrl        = instance.RelateUrl;
                    FlowDefineId   = instance.WorkflowTemplateID;
                    Title          = fTask.WorkFlowName + "->" + fTask.ApprovalNodeName;
                    Aim.WorkFlow.Task[] tasks = Aim.WorkFlow.Task.FindAllByProperty("CreatedTime", "WorkflowInstanceID", fTask.WorkflowInstanceID);
                    this.PageState.Add("Tasks", JsonHelper.GetJsonString(tasks));
                    this.PageState.Add("Task", fTask);
                }
                break;
            }
        }
        public static ApprovalResult GetJumpResult(Aim.WorkFlow.WinService.Task task, string taskId, string winstanceId, string nextName, params string[] UserIdsNames)
        {
            ApprovalResult result = new ApprovalResult()
            {
                Task   = task,
                TaskId = task.ID,

                ApprovalDateTime = DateTime.Now,

                Opinion                  = ApprovalOpinion.意,
                ExtendedProperties       = new List <KeyValuePair_V2>().ToArray(),
                ApprovalNodeSkipInfoList = new List <ApprovalNodeSkipInfo>().ToArray(),

                //Comment = ""
            };

            /// 设定选中的流转节点
            if (nextName != "")
            {
                result.SwitchRules = new KeyValuePair_V2[]
                {
                    new KeyValuePair_V2()
                    {
                        Key   = task.ApprovalNodeName,
                        Value = nextName
                    }
                };
                string nextNodeName = nextName;
                /// 设定指定流转节点的审批人员的信息.
                List <ApprovalNodeContext> approvalNodeContexts         = new List <ApprovalNodeContext>();
                ApprovalNodeContext        specifiedApprovalNodeContext = new ApprovalNodeContext();
                specifiedApprovalNodeContext.Name = nextNodeName;

                if (UserIdsNames != null && UserIdsNames.Length == 2)
                {
                    LoadFromConfigString(specifiedApprovalNodeContext, UserIdsNames[0].TrimEnd(','), UserIdsNames[1].TrimEnd(','));
                    approvalNodeContexts.Add(specifiedApprovalNodeContext);
                    result.SpecifiedApprovalNodeContexts = approvalNodeContexts.ToArray();
                }
            }

            return(result);
        }
        /// <summary>
        /// 适用于流程第二步已指定人员的,自动执行
        /// </summary>
        /// <param name="fTask"></param>
        public static void AutoExecute(Task fTask)
        {
            XmlSerializer xs = new XmlSerializer(typeof(TaskContext));

            if (!string.IsNullOrEmpty(fTask.Context))
            {
                StringReader sr      = new StringReader(fTask.Context);
                TaskContext  content = xs.Deserialize(sr) as TaskContext;
                if (content.SwitchRules.Length > 0)
                {
                    TaskContextSwitchRuleNextAction[] arrs = content.SwitchRules[0].NextActions;
                    if (arrs.Length > 0)
                    {
                        string route = arrs[0].Name;
                        Aim.WorkFlow.WinService.Task taskS = Aim.WorkFlow.WorkFlow.ServiceClient.GetTaskByTaskId(fTask.ID);
                        SubmitTask("", fTask.WorkflowInstanceID, fTask.BookmarkName, GetApprovalResult(taskS, fTask.ID, fTask.WorkflowInstanceID, route));;
                    }
                }
            }
        }
        public static ApprovalResult GetApprovalResult(Aim.WorkFlow.WinService.Task task, string taskId, string winstanceId, string route, params string[] UserIdsNames)
        {
            ApprovalResult result = new ApprovalResult()
            {
                Task   = task,
                TaskId = task.ID,

                ApprovalDateTime = DateTime.Now,

                Opinion                  = ApprovalOpinion.意,
                ExtendedProperties       = new List <KeyValuePair_V2>().ToArray(),
                ApprovalNodeSkipInfoList = new List <ApprovalNodeSkipInfo>().ToArray(),

                //Comment = ""
            };

            /// 设定跳过后续哪些节点.

            /*List<ApprovalNodeSkipInfo> approvalNodeSkipInfos = new List<ApprovalNodeSkipInfo>();
             *
             * if (checkBox1.IsChecked.HasValue && checkBox1.IsChecked.Value)
             *  approvalNodeSkipInfos.Add(new ApprovalNodeSkipInfo() { ApprovalNodeContextName = "经理审批", CanBeSkipped = true });
             *
             * if (checkBox2.IsChecked.HasValue && checkBox2.IsChecked.Value)
             *  approvalNodeSkipInfos.Add(new ApprovalNodeSkipInfo() { ApprovalNodeContextName = "主管审批", CanBeSkipped = true });
             *
             * result.ApprovalNodeSkipInfoList = approvalNodeSkipInfos.ToArray();
             */
            /// 设定选中的流转节点
            if (route != "")
            {
                result.SwitchRules = new KeyValuePair_V2[]
                {
                    new KeyValuePair_V2()
                    {
                        Key   = task.ApprovalNodeName,
                        Value = route
                    }
                };
                WorkflowInstance ins = WorkflowInstance.Find(winstanceId);
                //Aim.WorkFlow.WorkflowTemplate temp = Aim.WorkFlow.WorkflowTemplate.Find(ins.WorkflowTemplateID);
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(ins.XAML);
                XmlElement          root      = doc.DocumentElement;
                string              nameSpace = root.NamespaceURI;
                XmlNamespaceManager nsmgr     = new XmlNamespaceManager(doc.NameTable);
                nsmgr.AddNamespace("ns", nameSpace);
                nsmgr.AddNamespace("x", "http://schemas.microsoft.com/winfx/2006/xaml");
                nsmgr.AddNamespace("bwa", "clr-namespace:BPM.WF.Activities;assembly=BPM.WF");

                string  current     = "ApprovalNode Name=\"" + task.ApprovalNodeName + "\"";
                XmlNode currentNode = root.SelectSingleNode("//*[contains(@ApprovalNodeConfig,'" + current + "')]", nsmgr);
                //XmlNode node = root.SelectSingleNode("//*[@x:Key='" + nextName + "']", nsmgr);
                XmlNode node                = currentNode.NextSibling.SelectSingleNode("ns:FlowSwitch/ns:FlowStep[@x:Key='" + route + "']", nsmgr);
                string  nextUserIds         = "";
                string  nextUserNames       = "";
                string  nextUserAccountType = "";
                string  nextNodeName        = "";
                string  content             = "ApprovalNode Name=\"" + route + "\"";
                if (root.SelectSingleNode("//*[contains(@ApprovalNodeConfig,'" + content + "')]", nsmgr) != null)//直接路由
                {
                    string      config = System.Web.HttpUtility.HtmlDecode(root.SelectSingleNode("//*[contains(@ApprovalNodeConfig,'" + content + "')]", nsmgr).Attributes["ApprovalNodeConfig"].InnerXml);
                    XmlDocument docC   = new XmlDocument();
                    docC.LoadXml(config);
                    nextNodeName = docC.DocumentElement.Attributes["Name"].InnerText.ToString();
                    if (docC.DocumentElement.SelectSingleNode("ApprovalUnits") != null && docC.DocumentElement.SelectSingleNode("ApprovalUnits").ChildNodes.Count > 0)
                    {
                        XmlNodeList list = docC.DocumentElement.SelectSingleNode("ApprovalUnits").ChildNodes;
                        foreach (XmlNode chd in list)
                        {
                            nextUserIds        += chd.ChildNodes[0].Attributes["Value"].InnerText + ",";
                            nextUserNames      += chd.ChildNodes[0].Attributes["Name"].InnerText + ",";
                            nextUserAccountType = chd.ChildNodes[0].Attributes["Type"].InnerText;
                        }
                    }
                }
                nextUserIds   = nextUserIds.TrimEnd(',');
                nextUserNames = nextUserNames.TrimEnd(',');
                /// 设定指定流转节点的审批人员的信息.
                List <ApprovalNodeContext> approvalNodeContexts         = new List <ApprovalNodeContext>();
                ApprovalNodeContext        specifiedApprovalNodeContext = new ApprovalNodeContext();
                specifiedApprovalNodeContext.Name = nextNodeName;

                if (nextUserAccountType != "ADAccount" && nextUserIds != "" && UserIdsNames != null && UserIdsNames.Length == 0)//如果是组或者角色
                {
                    string[] grpIds   = nextUserIds.Split(',');
                    string[] grpNames = nextUserNames.Split(',');
                    List <ApprovalUnitContext> approvalUnitContexts = new List <ApprovalUnitContext>();
                    foreach (string groupId in grpIds)
                    {
                        string cou   = @"select count(*) from (select distinct ParentDeptName from View_SysUserGroup where ChildDeptName=(Select Name from SysRole where RoleID='{0}')) a";
                        string sql   = "";
                        int    count = DataHelper.QueryValue <int>(string.Format(cou, groupId));
                        IList <EasyDictionary> lists = null;
                        //判断角色的唯一性,多部门角色需要对应到部门
                        if (count > 1)
                        {
                            sql = @"select distinct UserID,UserName Name from View_SysUserGroup where ChildDeptName in (Select Name from SysRole where RoleID='{0}') 
                            and (select top 1 Path+'.'+DeptId from View_SysUserGroup where UserID='{1}') like '%'+Path+'%'";
                            sql = string.Format(sql, groupId, task.OwnerId);

                            lists = DataHelper.QueryDictList(sql);
                        }
                        else if (count == 1)
                        {
                            sql   = "select UserId,UserName Name from View_SysUserGroup where ChildDeptName=(Select Name from SysRole where RoleID='{0}')";
                            sql   = string.Format(sql, groupId);
                            lists = DataHelper.QueryDictList(sql);
                        }
                        if (lists == null || lists.Count == 0)
                        {
                            throw new Exception("缺少角色" + nextUserNames + "的人员!");
                        }
                        foreach (EasyDictionary ed in lists)
                        {
                            approvalUnitContexts.Add(new ApprovalUnitContext()
                            {
                                Approver = new Approver()
                                {
                                    Value = ed["UserID"].ToString(), Name = ed["Name"].ToString()
                                }
                            });
                        }
                    }
                    specifiedApprovalNodeContext.ApprovalUnitContexts = approvalUnitContexts.ToArray();
                    approvalNodeContexts.Add(specifiedApprovalNodeContext);
                    result.SpecifiedApprovalNodeContexts = approvalNodeContexts.ToArray();
                }
                else if (UserIdsNames != null && UserIdsNames.Length == 2)
                {
                    LoadFromConfigString(specifiedApprovalNodeContext, UserIdsNames[0].TrimEnd(','), UserIdsNames[1].TrimEnd(','));
                    approvalNodeContexts.Add(specifiedApprovalNodeContext);
                    result.SpecifiedApprovalNodeContexts = approvalNodeContexts.ToArray();
                }
                else if (nextUserIds.Trim() != "")
                {
                    LoadFromConfigString(specifiedApprovalNodeContext, nextUserIds, nextUserNames);
                    approvalNodeContexts.Add(specifiedApprovalNodeContext);
                    result.SpecifiedApprovalNodeContexts = approvalNodeContexts.ToArray();
                }

                /*List<ApprovalNodeContext> approvalNodeContexts = new List<ApprovalNodeContext>();
                 *
                 * ApprovalNodeContext specifiedApprovalNodeContext = new ApprovalNodeContext();
                 * specifiedApprovalNodeContext.Name = this.RequestData["RouteName"].ToString();
                 *
                 * string userIds = this.RequestData["UserIds"].ToString().TrimEnd(',');
                 * string userNames = this.RequestData["UserNames"].ToString().TrimEnd(',');
                 * LoadFromConfigString(specifiedApprovalNodeContext, userIds,userNames);
                 * approvalNodeContexts.Add(specifiedApprovalNodeContext);
                 * result.SpecifiedApprovalNodeContexts = approvalNodeContexts.ToArray();*/
            }

            return(result);
        }
Ejemplo n.º 5
0
        public Aim.WorkFlow.WinService.ApprovalResult GetApprovalResult(Aim.WorkFlow.WinService.Task task)
        {
            Aim.WorkFlow.WinService.ApprovalResult result = new Aim.WorkFlow.WinService.ApprovalResult()
            {
                Task                     = task,
                TaskId                   = this.RequestData["TaskId"].ToString(),
                ApprovalDateTime         = DateTime.Now,
                Opinion                  = Aim.WorkFlow.WinService.ApprovalOpinion.意,
                ExtendedProperties       = new List <KeyValuePair_V2>().ToArray(),
                ApprovalNodeSkipInfoList = new List <ApprovalNodeSkipInfo>().ToArray(),

                //Comment = ""
            };
            /// 设定跳过后续哪些节点.

            /*List<ApprovalNodeSkipInfo> approvalNodeSkipInfos = new List<ApprovalNodeSkipInfo>();
             *
             * if (checkBox1.IsChecked.HasValue && checkBox1.IsChecked.Value)
             *  approvalNodeSkipInfos.Add(new ApprovalNodeSkipInfo() { ApprovalNodeContextName = "经理审批", CanBeSkipped = true });
             *
             * if (checkBox2.IsChecked.HasValue && checkBox2.IsChecked.Value)
             *  approvalNodeSkipInfos.Add(new ApprovalNodeSkipInfo() { ApprovalNodeContextName = "主管审批", CanBeSkipped = true });
             *
             * result.ApprovalNodeSkipInfoList = approvalNodeSkipInfos.ToArray();
             */
            /// 设定选中的流转节点
            if (this.RequestData["Route"] != null && this.RequestData["Route"].ToString() != "")
            {
                result.SwitchRules = new Aim.WorkFlow.WinService.KeyValuePair_V2[]
                {
                    new Aim.WorkFlow.WinService.KeyValuePair_V2()
                    {
                        Key   = task.ApprovalNodeName,
                        Value = this.RequestData["Route"].ToString()
                    }
                };
                /// 设定指定流转节点的审批人员的信息.
                List <ApprovalNodeContext> approvalNodeContexts         = new List <ApprovalNodeContext>();
                ApprovalNodeContext        specifiedApprovalNodeContext = new ApprovalNodeContext();
                specifiedApprovalNodeContext.Name = this.RequestData["NextNodeName"] == null ? "" : this.RequestData["NextNodeName"].ToString();
                if (!string.IsNullOrEmpty(this.RequestData.Get <string>("Jumps")))
                {
                    List <ApprovalNodeSkipInfo> approvalNodeSkipInfos = new List <ApprovalNodeSkipInfo>();
                    string[] jumps = this.RequestData.Get <string>("Jumps").Split(';');
                    foreach (string jump in jumps)
                    {
                        if (jump.Trim() != "")
                        {
                            approvalNodeSkipInfos.Add(new ApprovalNodeSkipInfo()
                            {
                                ApprovalNodeContextName = jump, CanBeSkipped = true
                            });
                            specifiedApprovalNodeContext.Name = jump;
                            result.SwitchRules.ToList().Add(new Aim.WorkFlow.WinService.KeyValuePair_V2()
                            {
                                Key   = jump,
                                Value = "下一步"
                            }
                                                            );
                        }
                    }
                    if (approvalNodeSkipInfos.Count > 0)
                    {
                        result.ApprovalNodeSkipInfoList = approvalNodeSkipInfos.ToArray();
                    }
                }

                //if (this.RequestData["UserType"] != null)
                //{
                if (this.RequestData["UserType"] != null && this.RequestData["UserType"].ToString() != "ADAccount" && this.RequestData["UserIds"].ToString() != "")//如果是组或者角色
                {
                    string[] grpIds = this.RequestData["UserIds"].ToString().Split(',');
                    List <ApprovalUnitContext> approvalUnitContexts = new List <ApprovalUnitContext>();
                    foreach (string groupId in grpIds)
                    {
                        string cou   = @"select count(*) from (select distinct ParentDeptName from View_SysUserGroup where 
ChildDeptName=(Select Name from SysRole where RoleID='{0}')) a";
                        string sql   = "";
                        int    count = DataHelper.QueryValue <int>(string.Format(cou, groupId));
                        IList <EasyDictionary> lists = null;
                        //判断角色的唯一性,多部门角色需要对应到部门
                        if (count > 1)
                        {
                            sql = @"select distinct UserID,UserName Name from View_SysUserGroup where ChildDeptName in (Select Name from SysRole where RoleID='{0}') 
and (select top 1 Path+'.'+DeptId from View_SysUserGroup where UserID='{1}') like '%'+Path+'%'";
                            if (this.RequestData.Get("StartUserId") != null && this.RequestData.Get <string>("StartUserId") != "")
                            {
                                sql = string.Format(sql, groupId, this.RequestData.Get("StartUserId"));
                            }
                            else
                            {
                                sql = string.Format(sql, groupId, this.UserInfo.UserID);
                            }
                            lists = DataHelper.QueryDictList(sql);
                        }
                        else if (count == 1)
                        {
                            sql   = "select UserId,UserName Name from View_SysUserGroup where ChildDeptName=(Select Name from SysRole where RoleID='{0}')";
                            sql   = string.Format(sql, groupId);
                            lists = DataHelper.QueryDictList(sql);
                        }
                        if (lists.Count == 0)
                        {
                            throw new Exception("缺少角色" + this.RequestData["UserNames"] + "的人员!");
                        }
                        foreach (EasyDictionary ed in lists)
                        {
                            approvalUnitContexts.Add(new ApprovalUnitContext()
                            {
                                Approver = new Approver()
                                {
                                    Value = ed["UserID"].ToString(), Name = ed["Name"].ToString()
                                }
                            });
                        }
                    }
                    specifiedApprovalNodeContext.ApprovalUnitContexts = approvalUnitContexts.ToArray();
                    approvalNodeContexts.Add(specifiedApprovalNodeContext);
                    result.SpecifiedApprovalNodeContexts = approvalNodeContexts.ToArray();
                }
                //}
                else if (this.RequestData["UserIds"] != null && this.RequestData["UserIds"].ToString().Trim() != "")
                {
                    string userIds   = this.RequestData["UserIds"].ToString().TrimEnd(',');
                    string userNames = this.RequestData["UserNames"].ToString().TrimEnd(',');
                    LoadFromConfigString(specifiedApprovalNodeContext, userIds, userNames);
                    approvalNodeContexts.Add(specifiedApprovalNodeContext);
                    result.SpecifiedApprovalNodeContexts = approvalNodeContexts.ToArray();
                }

                /*List<ApprovalNodeContext> approvalNodeContexts = new List<ApprovalNodeContext>();
                 *
                 * ApprovalNodeContext specifiedApprovalNodeContext = new ApprovalNodeContext();
                 * specifiedApprovalNodeContext.Name = this.RequestData["RouteName"].ToString();
                 *
                 * string userIds = this.RequestData["UserIds"].ToString().TrimEnd(',');
                 * string userNames = this.RequestData["UserNames"].ToString().TrimEnd(',');
                 * LoadFromConfigString(specifiedApprovalNodeContext, userIds,userNames);
                 * approvalNodeContexts.Add(specifiedApprovalNodeContext);
                 * result.SpecifiedApprovalNodeContexts = approvalNodeContexts.ToArray();*/
            }

            return(result);
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (this.RequestActionString.ToLower())
            {
            case "submittask":
                Aim.WorkFlow.WinService.Task task = Aim.WorkFlow.WorkFlow.ServiceClient.GetTaskByTaskId(this.RequestData["TaskId"].ToString());
                if (task.Status == 0)
                {
                    Aim.WorkFlow.WorkFlow.SubmitTask("", task.WorkflowInstanceID, task.BookmarkName, GetApprovalResult(task));
                }
                PageState.Add("message", "提交成功!");
                break;

            case "submitaddtask":
                Aim.WorkFlow.Task taskOld    = Aim.WorkFlow.Task.Find(this.RequestData["TaskId"].ToString());
                string            userIds    = this.RequestData.Get <string>("UserIds");
                string            userNames  = this.RequestData.Get <string>("UserNames");
                string[]          userIdss   = userIds.Split(',');
                string[]          userNamess = userNames.Split(',');
                for (int i = 0; i < userIdss.Length; i++)
                {
                    if (userIdss[i].Trim() == "")
                    {
                        continue;
                    }
                    Aim.WorkFlow.Task taskNew = new Aim.WorkFlow.Task();
                    DataHelper.MergeData <Aim.WorkFlow.Task>(taskNew, taskOld);
                    taskNew.Owner            = userNamess[i];
                    taskNew.OwnerId          = userIdss[i];
                    taskNew.Ext1             = "Branch";
                    taskNew.Ext2             = taskOld.ID;
                    taskNew.CreatedTime      = DateTime.Now;
                    taskNew.UpdatedTime      = DateTime.Now;
                    taskNew.ApprovalNodeName = taskNew.ApprovalNodeName + "[分发]";
                    taskNew.Create();
                }
                PageState.Add("message", "分发成功!");
                break;

            case "savetask":
                Aim.WorkFlow.Task tas = Aim.WorkFlow.Task.Find(this.RequestData["TaskId"].ToString());
                tas.Description = this.RequestData["Opinion"].ToString();
                tas.SaveAndFlush();
                break;

            case "getusers":
                GetNextUsers(this.RequestData["TemplateId"].ToString(), this.RequestData["FlowInstanceId"].ToString(), this.RequestData["Name"].ToString(), this.RequestData["CurrentName"].ToString());
                break;

            case "getbackusers":
                Aim.WorkFlow.Task[] tks = Aim.WorkFlow.Task.FindAllByProperties(Aim.WorkFlow.Task.Prop_WorkflowInstanceID, this.RequestData["FlowInstanceId"].ToString(), Aim.WorkFlow.Task.Prop_ApprovalNodeName, this.RequestData["TaskName"].ToString());
                if (tks != null && tks.Length == 1)    //打回情况一个人的时候有效,多人的话,还是从之前配置里取
                {
                    this.PageState.Add("NextUserIds", tks[0].OwnerId);
                    this.PageState.Add("NextUserNames", tks[0].Owner);
                }
                break;

            case "checkstate":
                //检查如果有后续任务未提交,则设置状态为已提交.
                Aim.WorkFlow.Task taskpre = Aim.WorkFlow.Task.Find(this.RequestData["TaskId"].ToString());
                if (taskpre.Status == 0 && DataHelper.QueryDataTable("select * from Task where WorkFlowInstanceId='" + taskpre.WorkflowInstanceID + "' and ApprovalNodeName<>'" + taskpre.ApprovalNodeName + "' and CreatedTime>'" + taskpre.CreatedTime + "' and Status=0").Rows.Count > 0)
                {
                    taskpre.Status = 4;
                    taskpre.Save();
                }
                break;

            default:
                if (this.RequestData["TaskId"] != null && !string.IsNullOrEmpty(this.RequestData["TaskId"].ToString()))
                {
                    Aim.WorkFlow.Task fTask = Aim.WorkFlow.Task.Find(this.RequestData["TaskId"].ToString());
                    if (!fTask.UpdatedTime.HasValue)
                    {
                        fTask.UpdatedTime = DateTime.Now;
                        fTask.Save();
                    }
                    if (fTask.Ext1 == "Branch")
                    {
                        Response.Redirect("FreeTask.aspx?Type=Branch&TaskId=" + this.RequestData["TaskId"].ToString());
                    }
                    if (fTask.Flag == "Add")
                    {
                        fTask.ApprovalNodeName = fTask.Ext1;
                    }
                    //捕获节点扩展信息配置,如已阅,加签,并行等信息
                    this.PageState.Add("ExtData", GetNodeExtData(fTask));
                    Aim.WorkFlow.WorkflowInstance instance = WorkflowInstance.Find(fTask.WorkflowInstanceID);
                    this.PageState.Add("InstanceId", fTask.WorkflowInstanceID);
                    this.PageState.Add("TemplateId", instance.WorkflowTemplateID);
                    FlowInstanceId = instance.ID;
                    FormUrl        = instance.RelateUrl;
                    FlowDefineId   = instance.WorkflowTemplateID;
                    Title          = fTask.WorkFlowName + "->" + fTask.ApprovalNodeName;
                    XmlSerializer xs = new XmlSerializer(typeof(TaskContext));
                    if (!string.IsNullOrEmpty(fTask.Context))
                    {
                        /*Aim.WorkFlow.WorkflowTemplate temp = Aim.WorkFlow.WorkflowTemplate.Find(instance.WorkflowTemplateID);
                         * XmlDocument doc = new XmlDocument();
                         * doc.LoadXml(temp.XAML);
                         * XmlElement root = doc.DocumentElement;
                         * string nameSpace = root.NamespaceURI;
                         * XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
                         * nsmgr.AddNamespace("ns", nameSpace);
                         * nsmgr.AddNamespace("x", "http://schemas.microsoft.com/winfx/2006/xaml");
                         * nsmgr.AddNamespace("bwa", "clr-namespace:BPM.WF.Activities;assembly=BPM.WF");
                         * XmlNode currentNode = root.SelectSingleNode("//*[contains(@ApprovalNodeConfig,'" + fTask.ApprovalNodeName + "')]", nsmgr);*/
                        StringReader sr      = new StringReader(fTask.Context);
                        TaskContext  content = xs.Deserialize(sr) as TaskContext;
                        if (content.SwitchRules.Length > 0)
                        {
                            TaskContextSwitchRuleNextAction[] arrs = content.SwitchRules[0].NextActions;
                            string comboxdataText = "['{0}','{1}'],";
                            if (arrs.Length > 0)
                            {
                                int first = 0;
                                foreach (TaskContextSwitchRuleNextAction ar in arrs)
                                {
                                    //GetNextRoute(currentNode, nsmgr, ar.Name)
                                    NextStep += string.Format(comboxdataText, ar.Name, ar.Name);
                                    if (first == 0)
                                    {
                                        GetNextUsers(instance.WorkflowTemplateID, fTask.WorkflowInstanceID, ar.Name, fTask.ApprovalNodeName);
                                    }
                                    first++;
                                }
                            }
                            else
                            {
                                NextStep += string.Format("['','{0}'],", "结束");
                            }
                        }
                        else
                        {
                            NextStep += string.Format("['','{0}'],", "结束");
                        }
                    }
                    else
                    {
                        NextStep += string.Format("['','{0}'],", "结束");
                    }
                    NextStep = NextStep.TrimEnd(',');
                    Aim.WorkFlow.Task[] tasks = Aim.WorkFlow.Task.FindAllByProperty("CreatedTime", "WorkflowInstanceID", fTask.WorkflowInstanceID).OrderBy(ens => !ens.FinishTime.HasValue ? DateTime.Now : ens.FinishTime).OrderBy(ens => ens.CreatedTime).ToArray();
                    this.PageState.Add("Tasks", JsonHelper.GetJsonString(tasks));
                    this.PageState.Add("Task", fTask);
                }
                break;
            }
        }