UI/aadmin/adminadd.aspx.cs

(开头部分) 1KB

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

using System;
using System.Collections;
using System.Configuration;
using System.Data;

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.Data.SqlClient;
using Model;
using BLL;
public partial class admin_adminadd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Convert.ToInt32(Request.Cookies["login"].Values["_role"])==1)
        {        
            admin admin1 = new admin();
            admin1.name = txt_name.Text;

            BLLadmin blladmin1 = new BLLadmin();
            SqlDataReader sdr = blladmin1.checkAdmin(admin1);
            if (sdr.Read())
            {
                Common.MessageAlert.Alert(Page, "该管理员已存在");
                txt_name.Text = "";
                txt_pwd.Text = "";
                sdr.Close();
            }
            else
            {
                admin admin2 = new admin();
                admin2.name = txt_name.Text;
                admin2.pwd =Common.DESEncrypt.Encrypt(txt_pwd.Text);
                admin2.role =Convert.ToInt32(dl_select.SelectedValue);

                BLLadmin blladmin2 = new BLLadmin();
                int result = blladmin2.insertAdmin(admin2);
                if (result > 0)
                {
                    Common.MessageAlert.AlertLocation(Page, "alert('添加管理员成功');location.href='adminList.aspx'");
                }
            }
        }
        else
        {
            Common.MessageAlert.Alert(Page,"对不起您不能执行此操作");
            txt_name.Text = "";
            txt_pwd.Text = "";
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
后面还有 5 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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