WEB/manager/product_relate_product.aspx.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using shop.Model;
using shop.BLL;
using System.Data;
using shop.Tools;

public partial class back_stage_product_relate_product : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            rRelate_load();
            rYesRelate_load();
        }
    }
    private void rRelate_load()
    {
        string title = Request.QueryString["productName"];
        string productId = Request.QueryString["productId"];
        string where = "is_show=1 and Id!="+productId;
        if (!string.IsNullOrEmpty(title))
            where += " and product_name like '%" + title + "%'";
        DataRecordTable table = new ProductDetailBusiness().GetList("Id,product_name,order_by,is_show", "order_by", false, AspNetPager2.CurrentPageIndex, AspNetPager2.PageSize, where);
        rRelate.DataSource = table.Table;
        rRelate.DataBind();
        AspNetPager2.RecordCount = table.RecordCount;
    }
    protected void AspNetPager2_PageChanged(object sender, EventArgs e)
    {
        rRelate_load();
    }
    private void rYesRelate_load()
    {
        int productId = int.Parse(Request.QueryString["productId"]);
        lProductName.Text = new ProductDetailBusiness().GetEntity(productId).ProductName;
        DataTable table = new ProductRelateProductBusiness().GetListByProductId(productId);
        rYesRelate.DataSource = table;
        rYesRelate.DataBind();
    }
    protected void rRelate_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string cmdName = e.CommandName;
        int productId = int.Parse(Request.QueryString["productId"]);
        int relateProductId = int.Parse(e.CommandArgument.ToString());
        if (cmdName == "relate")
        {
            ProductRelateProductBusiness business = new ProductRelateProductBusiness();
            bool isHasSame = business.IsSameRecord(productId, relateProductId);
            if (isHasSame)
            {
                JavascriptHelper.Alert("已经存在相关的产品");
                return;
            }
            business.Add(new ProductRelateProduct() { ProductId = productId, RelateProductId = relateProductId });
后面还有 16 行代码,购买后查看完整代码

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

AI 解读 AI

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

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