Files
g.hnyhua.cn/Mtxfw.shop/shop_category.aspx.cs
2026-02-07 15:48:27 +08:00

51 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;
namespace Mtxfw.shop
{
public partial class shop_category : System.Web.UI.Page
{
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config();
public Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
public string categorys = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Page.Title = "商品分类 - " + config.webName;
Page.MetaDescription = "商品分类 - " + config.webName;
Page.MetaKeywords = "商品分类," + config.webName;
if (!String.IsNullOrEmpty(Request.QueryString["id"]))
{
int CategoryID = int.Parse(Request.QueryString["id"].ToString());
DataSet Ds_Productlb2 = daoCategory.GetList("(select count(c_id) from P_Category b where b.C_PARENTID=a.c_id) as acount,", "ttype=0 And IfShow=0 And C_PARENTID=" + CategoryID + " Order By C_LinkID Asc");
if (Ds_Productlb2.Tables[0].Rows.Count > 0)
{
foreach (System.Data.DataRow drv2 in Ds_Productlb2.Tables[0].Rows)
{
int acount = int.Parse(drv2["acount"].ToString());
categorys += "<li><a href=\"/" + (acount > 0 ? "category-" : "search-class-") + drv2["C_ID"].ToString() + ".html\">" + drv2["C_NAME"].ToString() + "</a></li>\n";
}
}
Ds_Productlb2.Clear();
}
else
{
DataSet Ds_Productlb = daoCategory.GetList("", "ttype=0 And C_Layer=1 And IfShow=0 Order By C_LinkID Asc");
foreach (System.Data.DataRow drv in Ds_Productlb.Tables[0].Rows)
{
categorys += "<li><a href=\"/category-" + drv["C_ID"].ToString() + ".html\">" + drv["C_NAME"].ToString() + "</a></li>\n";
}
Ds_Productlb.Clear();
}
}
}
}
}