public ActionResult InstanceList()
        {
            new RoadFlow.Platform.WorkFlowTask();
            RoadFlow.Platform.WorkFlow workFlow = new RoadFlow.Platform.WorkFlow();
            string text = base.Request.QueryString["typeid"];
            Dictionary <Guid, string> instanceManageFlowIDList = workFlow.GetInstanceManageFlowIDList(RoadFlow.Platform.Users.CurrentUserID, text);
            string options             = workFlow.GetOptions(instanceManageFlowIDList, text);
            string text2               = string.Format("&appid={0}&tabid={1}&typeid={2}", base.Request.QueryString["appid"], base.Request.QueryString["tabid"], text);
            List <SelectListItem> list = new List <SelectListItem>();

            list.Add(new SelectListItem
            {
                Text  = "==全部==",
                Value = "0"
            });
            list.Add(new SelectListItem
            {
                Text  = "未完成",
                Value = "1"
            });
            list.Add(new SelectListItem
            {
                Text  = "已完成",
                Value = "2"
            });
            base.ViewBag.Query       = text2;
            base.ViewBag.StatusItems = list;
            base.ViewBag.FlowOptions = options;
            return(View());
        }
        public string QueryInstanceList()
        {
            RoadFlow.Platform.WorkFlowTask workFlowTask = new RoadFlow.Platform.WorkFlowTask();
            RoadFlow.Platform.WorkFlow     workFlow     = new RoadFlow.Platform.WorkFlow();
            string str    = base.Request.Form["Title"];
            string flowid = base.Request.Form["FlowID"];
            string text   = base.Request.Form["SenderID"];
            string date   = base.Request.Form["Date1"];
            string date2  = base.Request.Form["Date2"];
            string str2   = base.Request.Form["Status"];
            string text2  = base.Request.Form["sidx"];
            string text3  = base.Request.Form["sord"];
            string typeID = base.Request.Form["typeid"];
            string text4  = 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      = (text2.IsNullOrEmpty() ? "SenderTime" : text2) + " " + (text3.IsNullOrEmpty() ? "asc" : text3);
            long      count;
            DataTable instances = workFlowTask.GetInstances1(flowID, new Guid[0], text.IsNullOrEmpty() ? new Guid[0] : new Guid[1]
            {
                text.Replace("u_", "").ToGuid()
            }, out count, pageSize, pageNumber, str.Trim1(), flowid, date, date2, str2.ToInt(), order);
            JsonData jsonData = new JsonData();

            foreach (DataRow row in instances.Rows)
            {
                RoadFlow.Data.Model.WorkFlowTask lastTask = workFlowTask.GetLastTask(row["FlowID"].ToString().ToGuid(), row["GroupID"].ToString().ToGuid());
                if (lastTask != null)
                {
                    string        flowName;
                    string        stepName      = workFlow.GetStepName(lastTask.StepID, lastTask.FlowID, out flowName);
                    string        text5         = string.Format("flowid={0}&stepid={1}&instanceid={2}&taskid={3}&groupid={4}&appid={5}&display=1", lastTask.FlowID, lastTask.StepID, lastTask.InstanceID, lastTask.ID, lastTask.GroupID, text4);
                    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 (lastTask.Status.In(-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?" + text5 + "','" + lastTask.Title.RemoveHTML().UrlEncode() + "','" + lastTask.ID + "');return false;\" class=\"blue\">" + lastTask.Title.HtmlEncode() + "</a>";
                    jsonData2["FlowName"]    = flowName;
                    jsonData2["StepName"]    = stepName;
                    jsonData2["ReceiveName"] = lastTask.ReceiveName;
                    jsonData2["ReceiveTime"] = lastTask.ReceiveTime.ToDateTimeStringS();
                    jsonData2["StatusTitle"] = lastTask.Status;
                    jsonData2["Opation"]     = stringBuilder.ToString();
                    jsonData.Add(jsonData2);
                }
            }
            return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + pageSize + ",\"pagenumber\":" + pageNumber + "},\"rows\":" + jsonData.ToJson() + "}");
        }