Exemple #1
0
        public string Query()
        {
            string Title   = Request.Forms("Title");
            string Address = Request.Forms("Address");
            string typeid  = Request.Forms("typeid");
            string sidx    = Request.Forms("sidx");
            string sord    = Request.Forms("sord");

            int    size   = Tools.GetPageSize();
            int    number = Tools.GetPageNumber();
            string order  = (sidx.IsNullOrEmpty() ? "Type,Title" : sidx) + " " + (sord.IsNullOrEmpty() ? "ASC" : sord);

            Business.Dictionary dictionary = new Business.Dictionary();
            if (typeid.IsGuid(out Guid typeId))
            {
                var childsId = dictionary.GetAllChildsId(typeId);
                typeid = childsId.JoinSqlIn();
            }

            var appLibraries = new Business.AppLibrary().GetPagerList(out int count, size, number, Title, Address, typeid, order);

            Newtonsoft.Json.Linq.JArray jArray = new Newtonsoft.Json.Linq.JArray();
            foreach (System.Data.DataRow dr in appLibraries.Rows)
            {
                Newtonsoft.Json.Linq.JObject jObject = new Newtonsoft.Json.Linq.JObject
                {
                    { "id", dr["Id"].ToString() },
                    { "Title", dr["Title"].ToString() },
                    { "Address", dr["Address"].ToString() },
                    { "TypeTitle", dictionary.GetTitle(dr["Type"].ToString().ToGuid()) },
                    { "Opation", "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"edit('" + dr["Id"].ToString() + "');return false;\"><i class=\"fa fa-edit (alias)\"></i>编辑</a>" +
                      "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"editButton('" + dr["Id"].ToString() + "');return false;\"><i class=\"fa fa-square-o\"></i>按钮</a>" }
                };
                jArray.Add(jObject);
            }
            return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + size + ",\"pagenumber\":" + number + "},\"rows\":" + jArray.ToString() + "}");
        }