WEB/ascx/product_by_category.ascx.cs

(开头部分) 2KB

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

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using shop.BLL;
using shop.Model;

public partial class product_by_category : System.Web.UI.UserControl
{
    private int categoryId;
    public int CategoryId
    {
        get { return categoryId; }
        set { categoryId = value; }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            lCategoryName.Text = new ProductCategoryBusiness().GetEntity(CategoryId).CategoryName;
            rProductList_load();
        }
    }
    private void rProductList_load()
    {
        string where = "category_id in ("+GetIds(CategoryId)+") and is_show=1 and is_delete=0";
        string fieldList="Id,product_name,price,sale_price,order_by";
        string orderField = "order_by";
        bool orderby = true;
        DataRecordTable table = new ProductDetailBusiness().GetList(fieldList, orderField, orderby, 1, 5, where);
        rProductList.DataSource = table.Table;
        rProductList.DataBind();
    }
    protected ProductImage GetImage(int productId)
    {
        string where = "product_id=" + productId + " and type=1";
        string fieldList = "Id,product_id,image,alt";
        string orderFiled = "Id";
        bool orderby = false;
        DataRecordTable table = new ProductImageBusiness().GetList(fieldList, orderFiled, orderby, 1, 1, where);
        ProductImage productImage = new ProductImage();
        if (table.Table.Rows.Count > 0)
        {
            productImage.Image = table.Table.Rows[0]["image"].ToString();
            productImage.Alt = table.Table.Rows[0]["alt"].ToString();
        }
        return productImage;
    }
    private string GetIds(int categoryId)
    {
        ProductCategoryBusiness productCategoryBusiness = new ProductCategoryBusiness();
后面还有 21 行代码,购买后查看完整代码

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

AI 解读 AI

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

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