コード例 #1
0
        public string Query()
        {
            List <RoadFlow.Data.Model.WorkFlow> workFlowList = new List <RoadFlow.Data.Model.WorkFlow>();

            RoadFlow.Platform.Users    users     = new RoadFlow.Platform.Users();
            RoadFlow.Platform.WorkFlow workFlow1 = new RoadFlow.Platform.WorkFlow();
            string name   = this.Request.Form["flow_name"];
            string str1   = this.Request.Form["typeid"];
            string str2   = this.Request.Form["sidx"];
            string str3   = this.Request.Form["sord"];
            bool   flag   = "1" == this.Request.Form["openlist"];
            string typeid = "";

            if (str1.IsGuid())
            {
                typeid = new RoadFlow.Platform.Dictionary().GetAllChildsIDString(str1.ToGuid(), true);
            }
            int    pageSize   = flag ? 10 : RoadFlow.Utility.Tools.GetPageSize();
            int    pageNumber = RoadFlow.Utility.Tools.GetPageNumber();
            string order      = (str2.IsNullOrEmpty() ? "CreateDate" : str2) + " " + (str3.IsNullOrEmpty() ? "asc" : str3);
            long   count;
            List <RoadFlow.Data.Model.WorkFlow> pagerData = workFlow1.GetPagerData(out count, pageSize, pageNumber, RoadFlow.Platform.Users.CurrentUserID.ToString(), typeid, name, order);
            JsonData jsonData1 = new JsonData();

            foreach (RoadFlow.Data.Model.WorkFlow workFlow2 in pagerData)
            {
                JsonData jsonData2 = new JsonData();
                jsonData2["id"]           = (JsonData)workFlow2.ID.ToString();
                jsonData2["Name"]         = (JsonData)workFlow2.Name;
                jsonData2["CreateDate"]   = (JsonData)workFlow2.CreateDate.ToDateTimeString();
                jsonData2["CreateUserID"] = (JsonData)users.GetName(workFlow2.CreateUserID);
                jsonData2["Status"]       = (JsonData)workFlow1.GetStatusTitle(workFlow2.Status);
                if (flag)
                {
                    jsonData2["Edit"] = (JsonData)("<a href=\"javascript:void(0);\" onclick=\"openflow('" + (object)workFlow2.ID + "');return false;\"><img src=\"" + this.Url.Content("~/Images/ico/topic_edit.gif") + "\" alt=\"\" style=\"vertical-align:middle; border:0;\" /><span style=\"vertical-align:middle; margin-left:3px;\">编辑</span></a>");
                }
                else
                {
                    jsonData2["Edit"] = (JsonData)("<a class=\"editlink\" href=\"javascript:void(0);\" onclick=\"openflow('" + (object)workFlow2.ID + "','" + workFlow2.Name + "');return false;\"><span style=\"vertical-align:middle;\">编辑</span></a><a class=\"deletelink\" href=\"javascript:void(0);\" style=\"margin-left:5px\" onclick=\"delflow('" + (object)workFlow2.ID + "'); return false;\"><span style=\"vertical-align:middle;\">删除</span></a><a href=\"javascript:void(0);\" style=\"margin-left:5px\" onclick=\"ExportFlow('" + (object)workFlow2.ID + "'); return false;\"><span style=\"vertical-align:middle; background:url(../Images/ico/arrow_medium_right.png) no-repeat;padding-left:18px;\">导出</span></a>");
                }
                jsonData1.Add((object)jsonData2);
            }
            return("{\"userdata\":{\"total\":" + (object)count + ",\"pagesize\":" + (object)pageSize + ",\"pagenumber\":" + (object)pageNumber + "},\"rows\":" + jsonData1.ToJson(true) + "}");
        }