productlist.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 System.Data;
using System.Data.SqlClient;
using DbPrvd;
using Common;

public partial class productlist : Pagging
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null || Session["Role"] == null)
            Response.Write("<script type='text/javascript'>parent.document.location='timeout.htm';</script>");
        if (Session["Role"].ToString() != "admin")
        {
            Response.Write("<script type='text/javascript'>alert('您无权操作');history.go(-1);</script>");
        }

        PAGESIZE = 20;
        InitMember();
        Delete();
        BindCount();
        SetMember();
        BindReader();
        SetPageDiv_2(pageDiv);
    }
    private void BindCount()
    {
        string strSql = "select count(1) from [" + SqlHelper.Tbpre + "product] ";

        object rv = SqlHelper.ExecuteScalar(SqlHelper.ConStr, CommandType.Text, strSql);
        _recordCount = int.Parse(rv.ToString());
    }

    private void BindReader()
    {
        string strSql = "select TT.* from " +
                "(select top " + _currentSize + " T.* from " +
                "(select top " + _pageIndex * PAGESIZE + " * from [" + SqlHelper.Tbpre + "product] ";

        strSql += " order by id desc)t " +
                "order by t.id  )tt " +
                "order by tt.id desc";
        _infoReader = SqlHelper.ExecuteReader(SqlHelper.ConStr, CommandType.Text, strSql);
    }

    private void Delete()
    {
        if (!string.IsNullOrEmpty(Request.Form["hdID"]) && RegexHelper.isNumberR(Request.Form["hdID"]))
        {
            int id = int.Parse(Request.Form["hdID"]);
            try
            {
                string strSql = "delete from [" + SqlHelper.Tbpre + "product] where id=" + id;
                SqlHelper.ExecuteNonQuery(SqlHelper.ConStr, CommandType.Text, strSql);
                Response.Write("<script type='text/javascript'>alert('操作成功');document.location='productlist.aspx';</script>");
后面还有 8 行代码,购买后查看完整代码

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

AI 解读 AI

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

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