public ActionResult InstanceManage()
        {
            RoadFlow.Platform.WorkFlowTask workFlowTask = new RoadFlow.Platform.WorkFlowTask();
            RoadFlow.Platform.WorkFlow     workFlow     = new RoadFlow.Platform.WorkFlow();
            string            text             = base.Request.QueryString["flowid1"];
            string            text2            = base.Request.QueryString["groupid"];
            WorkFlowInstalled workFlowRunModel = workFlow.GetWorkFlowRunModel(text);
            IOrderedEnumerable <RoadFlow.Data.Model.WorkFlowTask> orderedEnumerable = from p in workFlowTask.GetTaskList(MyExtensions.ToGuid(text), MyExtensions.ToGuid(text2))
                                                                                      orderby p.Sort
                                                                                      select p;
            JsonData jsonData = new JsonData();

            foreach (RoadFlow.Data.Model.WorkFlowTask item in orderedEnumerable)
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("<a style=\"background:url(" + base.Url.Content("~/Images/ico/permission.gif") + ") no-repeat left center; padding-left:18px;\" href=\"javascript:void(0);\" onclick=\"cngStatus('" + item.ID + "');\">状态</a>");
                if (MyExtensions.In(item.Status, new int[2]
                {
                    0,
                    1
                }))
                {
                    stringBuilder.Append("<a style=\"background:url(" + base.Url.Content("~/Images/ico/arrow_medium_lower_left.png") + ") no-repeat left center; padding-left:16px;\" href=\"javascript:void(0);\" onclick=\"designate('" + item.ID + "');\">指派</a>");
                    stringBuilder.Append("<a style=\"background:url(" + base.Url.Content("~/Images/ico/arrow_medium_lower_right.png") + ") no-repeat left center; padding-left:16px;\" href=\"javascript:void(0);\" onclick=\"goTo('" + item.ID + "');\">跳转</a>");
                }
                JsonData jsonData2 = new JsonData();
                jsonData2["id"]             = item.ID.ToString();
                jsonData2["StepID"]         = workFlow.GetStepName(item.StepID, workFlowRunModel);
                jsonData2["SenderName"]     = item.SenderName;
                jsonData2["ReceiveTime"]    = MyExtensions.ToDateTimeStringS(item.ReceiveTime);
                jsonData2["ReceiveName"]    = item.ReceiveName;
                jsonData2["CompletedTime1"] = (item.CompletedTime1.HasValue ? MyExtensions.ToDateTimeStringS(item.CompletedTime1.Value) : "");
                jsonData2["Status"]         = workFlowTask.GetStatusTitle(item.Status);
                jsonData2["Comment"]        = item.Comment;
                jsonData2["Opation"]        = stringBuilder.ToString();
                jsonData.Add(jsonData2);
            }
            base.ViewBag.list = jsonData.ToJson();
            return(View());
        }
        public string QueryInstanceList()
        {
            RoadFlow.Platform.WorkFlowTask workFlowTask = new RoadFlow.Platform.WorkFlowTask();
            RoadFlow.Platform.WorkFlow     workFlow     = new RoadFlow.Platform.WorkFlow();
            string text   = base.Request.Form["Title"];
            string flowid = base.Request.Form["FlowID"];
            string text2  = base.Request.Form["SenderID"];
            string date   = base.Request.Form["Date1"];
            string date2  = base.Request.Form["Date2"];
            string text3  = base.Request.Form["Status"];
            string text4  = base.Request.Form["sidx"];
            string text5  = base.Request.Form["sord"];
            string typeID = base.Request.Form["typeid"];
            string text6  = base.Request.Form["appid"];
            Dictionary <Guid, string> instanceManageFlowIDList = workFlow.GetInstanceManageFlowIDList(RoadFlow.Platform.Users.CurrentUserID, typeID);
            List <Guid> list = new List <Guid>();

            foreach (KeyValuePair <Guid, string> item in from p in instanceManageFlowIDList
                     orderby p.Value
                     select p)
            {
                list.Add(item.Key);
            }
            Guid[]    flowID     = list.ToArray();
            int       pageSize   = RoadFlow.Utility.Tools.GetPageSize();
            int       pageNumber = RoadFlow.Utility.Tools.GetPageNumber();
            string    order      = (MyExtensions.IsNullOrEmpty(text4) ? "SenderTime" : text4) + " " + (MyExtensions.IsNullOrEmpty(text5) ? "asc" : text5);
            long      count;
            DataTable instances = workFlowTask.GetInstances1(flowID, new Guid[0], MyExtensions.IsNullOrEmpty(text2) ? new Guid[0] : new Guid[1]
            {
                MyExtensions.ToGuid(text2.Replace("u_", ""))
            }, out count, pageSize, pageNumber, MyExtensions.Trim1(text), flowid, date, date2, MyExtensions.ToInt(text3), order);
            JsonData jsonData = new JsonData();

            foreach (DataRow row in instances.Rows)
            {
                RoadFlow.Data.Model.WorkFlowTask lastTask = workFlowTask.GetLastTask(MyExtensions.ToGuid(row["FlowID"].ToString()), MyExtensions.ToGuid(row["GroupID"].ToString()));
                if (lastTask != null)
                {
                    string        flowName;
                    string        stepName      = workFlow.GetStepName(lastTask.StepID, lastTask.FlowID, out flowName);
                    string        text7         = $"flowid={lastTask.FlowID}&stepid={lastTask.StepID}&instanceid={lastTask.InstanceID}&taskid={lastTask.ID}&groupid={lastTask.GroupID}&appid={text6}&display=1";
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.Append("<a style=\"margin-right:5px; background:url(" + base.Url.Content("~/Images/ico/mouse.png") + ") no-repeat left center; padding-left:18px;\" href=\"javascript:void(0);\" onclick=\"manage('" + lastTask.FlowID.ToString() + "','" + lastTask.GroupID.ToString() + "');\">管理</a>");
                    if (MyExtensions.In(lastTask.Status, new int[3]
                    {
                        -1,
                        0,
                        1
                    }))
                    {
                        stringBuilder.Append("<a style=\"background:url(" + base.Url.Content("~/Images/ico/trash.gif") + ") no-repeat left center; padding-left:18px;\" href=\"javascript:void(0);\" onclick=\"delete1('" + lastTask.FlowID.ToString() + "','" + lastTask.GroupID.ToString() + "');\">删除</a>");
                    }
                    JsonData jsonData2 = new JsonData();
                    jsonData2["id"]          = lastTask.ID.ToString();
                    jsonData2["Title"]       = "<a href=\"javascript:void(0);\" onclick=\"openTask('/WorkFlowRun/Index?" + text7 + "','" + MyExtensions.UrlEncode(MyExtensions.RemoveHTML(lastTask.Title)) + "','" + lastTask.ID + "');return false;\" class=\"blue\">" + MyExtensions.HtmlEncode(lastTask.Title) + "</a>";
                    jsonData2["FlowName"]    = flowName;
                    jsonData2["StepName"]    = stepName;
                    jsonData2["ReceiveName"] = lastTask.ReceiveName;
                    jsonData2["ReceiveTime"] = MyExtensions.ToDateTimeStringS(lastTask.ReceiveTime);
                    jsonData2["StatusTitle"] = lastTask.Status;
                    jsonData2["Opation"]     = stringBuilder.ToString();
                    jsonData.Add(jsonData2);
                }
            }
            return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + pageSize + ",\"pagenumber\":" + pageNumber + "},\"rows\":" + jsonData.ToJson() + "}");
        }