//获取品牌信息列表 public string GetBrands() { string keyword = tools.CheckStr(Request["keyword"]); QueryInfo Query = new QueryInfo(); Query.PageSize = tools.CheckInt(Request["rows"]); Query.CurrentPage = tools.CheckInt(Request["page"]); if (keyword.Length > 0) { Query.ParamInfos.Add(new ParamInfo("AND", "str", "BrandInfo.Brand_Name", "like", keyword)); } Query.ParamInfos.Add(new ParamInfo("AND", "str", "BrandInfo.Brand_Site", "=", Public.GetCurrentSite())); Query.OrderInfos.Add(new OrderInfo(tools.CheckStr(Request["sidx"]), tools.CheckStr(Request["sord"]))); PageInfo pageinfo = brand.GetPageInfo(Query, Public.GetUserPrivilege()); IList <BrandInfo> Brands = brand.GetBrands(Query, Public.GetUserPrivilege()); if (Brands != null) { StringBuilder jsonBuilder = new StringBuilder(); jsonBuilder.Append("{\"page\":" + pageinfo.CurrentPage + ",\"total\":" + pageinfo.PageCount + ",\"records\":" + pageinfo.RecordCount + ",\"rows\""); jsonBuilder.Append(":["); foreach (BrandInfo entity in Brands) { jsonBuilder.Append("{\"BrandInfo.Brand_ID\":" + entity.Brand_ID + ",\"cell\":["); //各字段 jsonBuilder.Append("\""); jsonBuilder.Append(entity.Brand_ID); jsonBuilder.Append("\","); jsonBuilder.Append("\""); jsonBuilder.Append(Public.JsonStr(entity.Brand_Name)); jsonBuilder.Append("\","); jsonBuilder.Append("\""); jsonBuilder.Append(entity.Brand_Sort); jsonBuilder.Append("\","); jsonBuilder.Append("\""); if (Public.CheckPrivilege("9592b436-454a-42cf-83f4-0d9ce83c339a")) { jsonBuilder.Append("<img src=\\\"/images/icon_edit.gif\\\"> <a href=\\\"brand_edit.aspx?brand_id=" + entity.Brand_ID + "\\\" title=\\\"修改\\\">修改</a>"); } if (Public.CheckPrivilege("3297a5d3-44e6-4318-aa23-4d31288a291b")) { jsonBuilder.Append(" <img src=\\\"/images/icon_del.gif\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('brand_do.aspx?action=move&brand_id=" + entity.Brand_ID + "')\\\" title=\\\"删除\\\">删除</a>"); } jsonBuilder.Append("\","); jsonBuilder.Remove(jsonBuilder.Length - 1, 1); jsonBuilder.Append("]},"); } jsonBuilder.Remove(jsonBuilder.Length - 1, 1); jsonBuilder.Append("]"); jsonBuilder.Append("}"); return(jsonBuilder.ToString()); } else { return(null); } }