Demo/AdmPlanlist.aspx.cs

(开头部分) 3KB

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

using Demo.Helper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Demo
{
    public partial class AdmPlanlist : Page
    {
        private string LoginId = CookieHelper.GetCookie("Aid", "LoginId");
        protected void Page_Load(object sender, EventArgs e)
        {
            if(string.IsNullOrEmpty(LoginId))
            {
                Response.Write("<script>alert('请您先登录再操作!');window.location.href='Login.aspx';</script>");
                Response.End();
            }
            else
            {
                DataSet datauser = DBHelper.GetDataTable($"select * from UserInfo where id='{LoginId}'").DataSet;
                if (Convert.ToString(datauser.Tables[0].Rows[0][1]) != "1")
                {
                    Response.Write("<script>alert('您不是管理员不能访问该页面哦,抱歉!');window.location.href='Planlist.aspx';</script>");
                    Response.End();
                }
            }
            if (!IsPostBack)
            {
                bind();
            }
        }
        //绑定数据
        public void bind()
        {

            DataTable data = DBHelper.GetDataTable($"select * from [Plan]");
            GridViewbook.DataSource = data.DataSet;
            GridViewbook.DataBind();
        }

        protected void GridViewbook_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
        {
            GridViewbook.EditIndex = -1;//将gridview从编辑模式切换成浏览模式
            bind();
        }


        protected void GridViewbook_RowEditing(object sender, GridViewEditEventArgs e)
        {
            GridViewbook.EditIndex = e.NewEditIndex;
            bind();
        }

        protected void GridViewbook_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            int id = Convert.ToInt32(this.GridViewbook.DataKeys[e.RowIndex].Value);
后面还有 44 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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