Hidistro.UI.Web/Admin/Shop/api/Hi_Ajax_Brands.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace Hidistro.UI.Web.Admin.Shop.api
{
    using Hidistro.ControlPanel.Commodities;
    using Hidistro.Core;
    using Hidistro.Core.Entities;
    using Hidistro.Core.Enums;
    using Hidistro.Entities.Sales;
    using System;
    using System.Data;
    using System.Text;
    using System.Web;

    public class Hi_Ajax_Brands : IHttpHandler
    {
        public BrandQuery GetBrandSearch(HttpContext context)
        {
            return new BrandQuery { Name = (context.Request.Form["title"] == null) ? "" : context.Request.Form["title"], PageIndex = (context.Request.Form["p"] == null) ? 1 : Convert.ToInt32(context.Request.Form["p"]), SortOrder = SortAction.Desc, SortBy = "BrandId" };
        }

        public DbQueryResult GetBrandsTable(HttpContext context)
        {
            return CatalogHelper.GetBrandQuery(this.GetBrandSearch(context));
        }

        public string GetGraphicesListJson(DbQueryResult GraphicesTable, HttpContext context)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("\"list\":[");
            DataTable data = (DataTable) GraphicesTable.Data;
            for (int i = 0; i < data.Rows.Count; i++)
            {
                builder.Append("{");
                builder.Append("\"item_id\":\"" + data.Rows[i]["BrandId"] + "\",");
                builder.Append("\"title\":\"" + data.Rows[i]["BrandName"] + "\",");
                builder.Append("\"create_time\":\"" + DateTime.Now + "\",");
                builder.Append("\"link\":\"/BrandDetail.aspx?BrandId=" + data.Rows[i]["BrandId"] + "\",");
                builder.Append("\"pic\":\"" + data.Rows[i]["Logo"] + "\"");
                builder.Append("},");
            }
            return (builder.ToString().TrimEnd(new char[] { ',' }) + "]");
        }

        public string GetModelJson(HttpContext context)
        {
            DbQueryResult brandsTable = this.GetBrandsTable(context);
            int pageCount = TemplatePageControl.GetPageCount(brandsTable.TotalRecords, 10);
            if (brandsTable != null)
            {
                string str = "{\"status\":1,";
                return (((str + this.GetGraphicesListJson(brandsTable, context) + ",") + "\"page\":\"" + this.GetPageHtml(pageCount, context) + "\"") + "}");
            }
            return "{\"status\":1,\"list\":[],\"page\":\"\"}";
        }

        public string GetPageHtml(int pageCount, HttpContext context)
        {
            int pageIndex = (context.Request.Form["p"] == null) ? 1 : Convert.ToInt32(context.Request.Form["p"]);
            return TemplatePageControl.GetPageHtml(pageCount, pageIndex);
        }

后面还有 16 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。