UserGoodsManage.aspx.cs

(开头部分) 7KB

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

using MyWeb.DBUtility;
using MyWeb.WebUtility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MyWeb
{
    public partial class UserGoodsManage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DBHelper db = new DBHelper();
                string sql = "select * from Class_Tbl where del=0";
                DataSet ds = db.Query(sql);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DropDownList1.Items.Add(new ListItem(ds.Tables[0].Rows[i]["className"].ToString(), ds.Tables[0].Rows[i]["id"].ToString()));
                }
                //DropDownList2.Items.Add(new ListItem("不可用", "0"));
                //DropDownList2.Items.Add(new ListItem("可用", "1"));
                //DropDownList2.Items.Add(new ListItem("已选购", "2"));
                Hidden1.Value = Session["id"].ToString();
            }
        }
        [WebMethod]
        public static string loadUserGoodsManage(string pi, string ps,string hid)
        {
            DBHelper db = new DBHelper();
            //分页sql查询列表数据
            string sql = "select top " + ((Convert.ToInt32(pi) - 1) * Convert.ToInt32(ps) + Convert.ToInt32(ps)) + " * from Goods_Tbl a inner join Class_Tbl b on a.classID=b.id inner join UserInfo_Tbl c on a.userID=c.id where a.del=0 and b.del=0 and c.del=0 and a.userID='" + hid + "' and a.id not in (select top " + ((Convert.ToInt32(pi) - 1) * Convert.ToInt32(ps)) + " a.id from Goods_Tbl a inner join Class_Tbl b on a.classID=b.id inner join UserInfo_Tbl c on a.userID=c.id where a.del=0 and b.del=0 and c.del=0 and a.userID='" + hid + "' order by a.addDate desc) order by a.addDate desc";
            DataSet ds = db.Query(sql);
            string html = "";
            string state = "";
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                if (ds.Tables[0].Rows[i]["state"].ToString() == "0")
                {
                    state = "不可用";
                }
                else if (ds.Tables[0].Rows[i]["state"].ToString() == "1")
                {
                    state = "可用";
                }
                else
                {
                    state = "已下架";
                }
                //得到列表数据
                html += "<tr><td><img style='width:20px;height:20px;' src='" + ds.Tables[0].Rows[i]["FoodsUrl"].ToString() + "' /></td><td>" + ds.Tables[0].Rows[i]["FoodsName"] + "</td><td>" + ds.Tables[0].Rows[i]["className"] + "</td><td>" + ds.Tables[0].Rows[i]["name"] + "</td><td>" + ds.Tables[0].Rows[i]["Price"] + "</td><td>" + ds.Tables[0].Rows[i]["sales"] + "</td><td>" + ds.Tables[0].Rows[i]["stock"] + "</td><td>" + state + "</td><td>" + ds.Tables[0].Rows[i]["note"] + "</td><td><input type='button' value='删除' class='btn' id='" + ds.Tables[0].Rows[i]["id"] + "'/></td><td><a href='EditFoods.aspx?id=" + ds.Tables[0].Rows[i]["id"] + "'>修改</a></td><td><input type='button' value='设置状态' class='btn1' id='" + ds.Tables[0].Rows[i]["id"] + "'/></td></tr>";
            }
            return html;
        }
后面还有 96 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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