//获取产品类型列表 public string GetProductTypes() { 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", "ProductType.ProductType_Name", "like", keyword)); } Query.ParamInfos.Add(new ParamInfo("AND", "str", "ProductType.ProductType_Site", "=", Public.GetCurrentSite())); Query.OrderInfos.Add(new OrderInfo(tools.CheckStr(Request["sidx"]), tools.CheckStr(Request["sord"]))); PageInfo pageinfo = MyProductType.GetPageInfo(Query, Public.GetUserPrivilege()); IList <ProductTypeInfo> ProductTypes = MyProductType.GetProductTypes(Query, Public.GetUserPrivilege()); if (ProductTypes != null) { StringBuilder jsonBuilder = new StringBuilder(); jsonBuilder.Append("{\"page\":" + pageinfo.CurrentPage + ",\"total\":" + pageinfo.PageCount + ",\"records\":" + pageinfo.RecordCount + ",\"rows\""); jsonBuilder.Append(":["); foreach (ProductTypeInfo entity in ProductTypes) { jsonBuilder.Append("{\"ProductType.ProductType_ID\":" + entity.ProductType_ID + ",\"cell\":["); //各字段 jsonBuilder.Append("\""); jsonBuilder.Append(entity.ProductType_ID); jsonBuilder.Append("\","); jsonBuilder.Append("\"<a href=\\\"producttypeExtend.aspx?producttype_id=" + entity.ProductType_ID + "\\\">"); jsonBuilder.Append(entity.ProductType_Name); jsonBuilder.Append("</a>\","); jsonBuilder.Append("\""); jsonBuilder.Append(entity.ProductType_Sort); jsonBuilder.Append("\","); jsonBuilder.Append("\""); if (Public.CheckPrivilege("847e8136-fd2f-4834-86b7-f2c984705eff")) { jsonBuilder.Append("<img src=\\\"/images/icon_set.gif\\\"> <a href=\\\"producttypeExtend.aspx?producttype_id=" + entity.ProductType_ID + "\\\" title=\\\"设置属性\\\">设置属性</a> <img src=\\\"/images/icon_edit.gif\\\"> <a href=\\\"producttype_edit.aspx?producttype_id=" + entity.ProductType_ID + "\\\" title=\\\"修改\\\">修改</a>"); } if (Public.CheckPrivilege("fcc7d1f7-e2f5-440f-a827-2e53e6e62184")) { jsonBuilder.Append(" <img src=\\\"/images/icon_del.gif\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('producttype_do.aspx?action=move&producttype_id=" + entity.ProductType_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); } }