⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editmanager.aspx.cs

📁 接入网络时的绑定管理系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace NETManage.Web.Admin
{
    public partial class EditManager : PageBase//System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            IsLogin();
            if (!Page.IsPostBack)
            {
                string Login_Name = string.Empty;
                try
                {
                    Login_Name = Request.QueryString["Login_Name"].ToString();
                }
                catch
                { }
                if (Login_Name != null && Login_Name.Length > 0)
                {
                    ShowInfo(Login_Name);
                    this.Button_OK.Text = "修改";
                }
            }
        }

        private void ShowInfo(string Login_Name)
        {
            NETManage.BLL.Manager bll = new NETManage.BLL.Manager();
            NETManage.Model.Manager model = bll.GetModel(Login_Name);
            this.txtLogin_Name.Text = model.Login_Name;
            this.txtRealName.Text = model.RealName;
            this.txtPhone.Text = model.Phone;
            this.txtOther.Text = model.Other;
        }

        protected void Button_OK_Click(object sender, EventArgs e)
        {
            string strErr = "";
            if (this.txtLogin_Name.Text == "")
            {
                strErr += "登录名不能为空!\\n";
            }
            if (this.Button_OK.Text == "修改")
            {
                if (this.txtLoginPass.Text.Length > 0)
                {
                    if (this.txtLoginPass.Text == "")
                    {
                        strErr += "登陆密码不能为空!\\n";
                    }
                    if (this.txtLoginPassR.Text == "")
                    {
                        strErr += "重复登陆密码不能为空!\\n";
                    }
                    if (this.txtLoginPass.Text != this.txtLoginPassR.Text)
                    {
                        strErr += "两次密码不一致!\\n";
                    }
                }
            }
            else
            {
                if (this.txtLoginPass.Text == "")
                {
                    strErr += "登陆密码不能为空!\\n";
                }
                if (this.txtLoginPassR.Text == "")
                {
                    strErr += "重复登陆密码不能为空!\\n";
                }
            }
            if (strErr != "")
            {
                MsgBox(strErr);
                return;
            }

            string Login_Name = this.txtLogin_Name.Text;
            string LoginPass = this.txtLoginPass.Text;
            string RealName = this.txtRealName.Text;
            string Phone = this.txtPhone.Text;
            string Other = this.txtOther.Text;

            NETManage.BLL.Manager bll = new NETManage.BLL.Manager();
            NETManage.Model.Manager model = new NETManage.Model.Manager();
            model.Login_Name = Login_Name;
            if (this.Button_OK.Text == "修改")
            {
                string Oldpass = bll.GetModel(Login_Name).LoginPass;
                if (LoginPass.Length > 0)
                {
                    model.LoginPass = HashString(LoginPass);
                }
                else
                {
                    model.LoginPass = Oldpass;
                }
            }
            else
            {
                model.LoginPass = HashString(LoginPass);
            }
            model.RealName = RealName;
            model.Phone = Phone;
            model.Other = Other;
            
            try
            {
                if (this.Button_OK.Text == "修改")
                {
                    bll.Update(model);
                }
                else
                {
                    bll.Add(model);
                }
                Response.Redirect("Manager.aspx");
            }
            catch
            {
                MsgBox("失败!");
            }
        }

        protected void Button_C_Click(object sender, EventArgs e)
        {
            Response.Redirect("Manager.aspx");
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -