register.aspx.cs.svn-base

来自「大学英语学习系统」· SVN-BASE 代码 · 共 97 行

SVN-BASE
97
字号
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;

public partial class SystemManage_Register : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    private void Dialog(String Str)
    {
        Response.Write(@"<script type='text/JavaScript'>");
        Response.Write(@"alert('" + Str + "');");
        //Response.Write(@"window.location='./list_logingroup.aspx';");
        Response.Write(@"</script>");
    }
    protected void BtnAddUser_Click(object sender, EventArgs e)
    {
        SqlData sql = new SqlData();
        String[] StrAll ={ "注册成功", "注册失败!" ,"注册的内容不能为空!","此学号已经存在","读数据库发生错误","密码与验证不一致"};
        String StrSno = TxtSno.Text.ToString();
        String StrSname = TxtSname.Text.ToString();
        String StrSPassword = TxtSPassword.Text.ToString();
        String StrComfirm = TxtConfirm.Text.ToString();
        String StrSClass = TxtSClass.Text.ToString();
        String[] InsertStr ={ StrSno, StrSname, StrSClass, StrSPassword };
        if (StrSno != "" && StrSname != "" && StrSPassword != "" && StrComfirm != "" && StrSClass != "")
        {
            String TableName = "TAB_STUDENT";
            String ColumnName = "SNO";
            if (sql.CheckStringUnique(TableName, ColumnName, StrSno) == 2)
            {
                if (StrSPassword == StrComfirm)
                {
                    if (sql.InsertRow(TableName, InsertStr, InsertStr.Length) == true)
                    {
                        Dialog(StrAll[0]);
                        Response.Write(@"<script type='text/JavaScript'>");
                        Response.Write(@"window.location='./Login.aspx';");
                        Response.Write(@"</script>");
                    }
                    else
                    {
                        Dialog(StrAll[1]);
                    }
                }
                else
                {
                    Dialog(StrAll[5]);
                }
            }
            else if (sql.CheckStringUnique(TableName, ColumnName, StrSno) == 1)
            {
                Dialog(StrAll[3]);
            }
            else
            {
                Dialog(StrAll[4]);
            }
        }
        else
        {
            Dialog(StrAll[2]);
        }
    }
    protected void BtnGoback_Click(object sender, EventArgs e)
    {
        if (Session["USERSTYLE"] =="STUDENT")
        {
            Response.Write(@"<script type='text/JavaScript'>");
            Response.Write(@"window.location='./Main.aspx';");
            Response.Write(@"</script>");
        }
        else
        {  
            Response.Write(@"<script type='text/JavaScript'>");
            Response.Write(@"window.location='./Login.aspx';");
            Response.Write(@"</script>");
        }
        
    }

    protected void AddUserBut_Click(object sender, EventArgs e)
    {

    }

}

⌨️ 快捷键说明

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