2024年1月25日发(作者:)

一、学生注册:

using System;

using ;

using uration;

using tions;

using ;

using ty;

using ;

using trols;

using ts;

using ntrols;

using ;

using mydb;

public partial class manager_erroll_student :

{

protected void Page_Load(object sender, EventArgs e)

{

if (Session["Manager"] == null)

("");

}

protected void Submit1_ServerClick(object sender, EventArgs e)

{

String filepath = "~/Src/";

String savepath = h("..") + @"Src";

int filelength;

String filetype;

if (e)

{

filepath += me;

String filename = me;

savepath += filename;

(savepath);

filelength = tLength / 1024;

filetype = tType;

= "成功上传:"

+ filename + "

" + "文件大小:" +

filelength + "K

" + "文件类型:" +

filetype;

}

String userName = ;

String userID = ;

String userSex = "";

if (d)

userSex += ;

if (d)

userSex += ;

String E_mail = ;

String userPass = ;

String BeiZhu = ;

String Photo = filepath;

String Sdept = ;

String Grade = ;

//-----------------------------------------------------------------//

String sql = "insert into [users] values('" + userID + " ', '" +userPass + " ') ";

Class1 cc2 = new Class1();

ation(sql);

();

String sql1 = "insert into userinf(userID,userName,userSex,BeiZhu,E_mail,Photo,Grade,

Sdept) values('" + userID + " ', '" + userName + " ','" + userSex + " ','" + BeiZhu + " ','" +

E_mail + "','" + filepath + "','" + Grade + " ','" + Sdept + " ') ";

Class1 cc3 =new Class1();

ation(sql1);

();

String sql3 = "update [userinf] set Photo= '" + filepath + "' where userID= '" + userID

+ "'";

Class1 cc1 = new Class1();

ation(sql3);

();

String sql2 = "select * from [users] where userID='" + userID + " '";

Class1 cc4 = new Class1();

if ((sql2).HasRows)

{

+= "已经注册成功:" + "

" + "


";

}

else

{

("");

}

+= "欢迎您:" +

+ "
";

+= "您的学号:" +

+ "
";

if (d)

+= "性别:" +

+ "
";

if (d)

+= "性别:" +

+ "
";

+= "您的邮箱:" +

+ "
";

+= "您的个人说明:" + + "
";

+= "您的专业:" +

+ "
";

+= "您的年级:" +

e("n", "

");

();

}

protected void xh_TextChanged(object sender, EventArgs e)

{

}

}

二、class2

using System;

using ;

using uration;

using ;

using ty;

using ;

using trols;

using ts;

using ntrols;

using ;

namespace mydb2

{

///

/// Class2 的摘要说明

///

public class Class2 : Page

{

protected OleDbConnection conn;

protected OleDbCommand cmd;

protected OleDbDataReader dr;

protected string connString;

public Class2()

{

connString = @"Provider=.4.0; Data Source=" +

h("../App_");

}

public void databind(GridView myGrid, string sql)//GridView的数据绑定

{

OleDbConnection con = new OleDbConnection(connString);//创建连接对象

OleDbDataAdapter adp = new OleDbDataAdapter(sql, con);//DA从数据库con读取数据

DataSet ds = new DataSet();//内存中数据库DS

(ds);//DA将con读取的数据传到Ds中

urce = [0].DefaultView;//把【0】的数据都显示到GridView

//mber = "userinf";

nd();

();

}

}

}

三、删除页面跳转

using System;

using ;

using uration;

using tions;

using ;

using ty;

using ;

using trols;

using ts;

using ntrols;

using ;

using mydb;

public partial class manager_deletejump :

{

protected void Page_Load(object sender, EventArgs e)

{

if (Session["Manager"] == null)

ct("managerlogin_");

else

{

string idd = tring["idd"];

Class1 a = new Class1();

string sql = "delete from news where [ID]=" + idd;

ation(sql);

();

("");

}

}

}

四、密码修改

using System;

using ;

using uration;

using tions;

using ;

using ty;

using ;

using trols;

using ts;

using ntrols;

using ;

using mydb;

public partial class manager_change_passwordm :

{

protected void Page_Load(object sender, EventArgs e)

{

if ( Session["Manager"] == null)

("");

}

protected void Submit1_ServerClick(object sender, EventArgs e)

{

// String userID= ;

if ((Session["userpass"].ToString()))

{

String userPass = ;

String sql = "update Manage set [password]= '" + userPass + " ' where account='"

+ /*userID*/Session["Manager"].ToString() + " ' ";

Class1 cc4 = new Class1();

ation(sql);

+= "修改密码成功";

();

}

else

{

+= "密码修改失败,可能是原密码有误,请重试...";

}

}

}

五,课程处理

using System;

using ;

using uration;

using tions;

using ;

using ty;

using ;

using trols;

using ts;

using ntrols;

using ;

using mydb;

using ;

using mydb2;

public partial class Dealcourse :

{

protected void Page_Load(object sender, EventArgs e)

{

if (Session["Manager"] == null)

("");

if (!Back)//如果页面不是第一次加载

{

//如果是多个关键值

//yNames = new string[] { "userID", "userCourse", "userTerm" };

string idd = tring["idd"].ToString();

string sql = "SELECT CourseID AS 课程号,Coursename AS 课程名, CourseDate AS 开课学期,XS AS 学时, XF AS 学分, Kind AS 课程类型,CourseNo AS 课序号,CourseCol AS 学院,Teacher AS

授课教师 FROM Course where CourseID='" + idd + "'";

Class2 cc = new Class2();

nd(GridView1, sql);

}

}

protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)

{

string idd = tring["idd"].ToString();

string sql = "SELECT CourseID AS 课程号,Coursename AS 课程名, CourseDate AS 开课学期,XS

AS 学时, XF AS 学分, Kind AS 课程类型,CourseNo AS 课序号,CourseCol AS 学院,Teacher AS 授课教师 FROM Course where CourseID='" + idd + "'";

Class2 cc = new Class2();

dex = -1;//将gridview从编辑模式切换成浏览模式

nd(GridView1, sql);

}

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)

{

("");

string idd = tring["idd"].ToString();

//string userid = (string)ys[ex].Value;

string sql1 = "delete from Course where CourseID='" + idd + "'";

Class1 a = new Class1();

ation(sql1);

();

string sql = "SELECT CourseID AS 课程号,Coursename AS 课程名, CourseDate AS 开课学期,XS

AS 学时, XF AS 学分, Kind AS 课程类型,CourseNo AS 课序号,CourseCol AS 学院,Teacher AS 授课教师 FROM Course where CourseID='" + idd + "'";

Class2 cc = new Class2();

dex = -1;

nd(GridView1, sql);

}

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)

{

string idd = tring["idd"].ToString();

string CourseID =

((TextBox)([ex].Cells[2].Controls[0])).ng();

string Coursename =

((TextBox)([ex].Cells[3].Controls[0])).ng();

string CourseDate =

((TextBox)([ex].Cells[4].Controls[0])).ng();

string XS =

((TextBox)([ex].Cells[5].Controls[0])).ng();

string XF =

((TextBox)([ex].Cells[6].Controls[0])).ng();

string Kind =

((TextBox)([ex].Cells[7].Controls[0])).ng();

string CourseNo =

((TextBox)([ex].Cells[8].Controls[0])).ng();

string CourseCol =

((TextBox)([ex].Cells[9].Controls[0])).ng();

string Teacher =

((TextBox)([ex].Cells[10].Controls[0])).ng();

string sql2 = "update Course set CourseID='" + CourseID + "',Coursename='" + Coursename

+ "', CourseDate='" + CourseDate + "',XS='" + XS + " ', XF='" + XF + "', Kind='" + Kind +

"',CourseNo='" + CourseNo + "',CourseCol='" + CourseCol + "',Teacher='" + Teacher + "' where

CourseID='" + idd + "'";

Class1 a = new Class1();

ation(sql2);

();

dex = -1;

string sql = "SELECT CourseID AS 课程号,Coursename AS 课程名, CourseDate AS 开课学期,XS

AS 学时, XF AS 学分, Kind AS 课程类型,CourseNo AS 课序号,CourseCol AS 学院,Teacher AS 授课教师 FROM Course where CourseID='" + idd + "'";

Class2 cc = new Class2();

nd(GridView1, sql);

}

protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)

{

dex = tIndex;

string idd = tring["idd"].ToString();

string sql = "SELECT CourseID AS 课程号,Coursename AS 课程名, CourseDate AS 开课学期,XS

AS 学时, XF AS 学分, Kind AS 课程类型,CourseNo AS 课序号,CourseCol AS 学院,Teacher AS 授课教师 FROM Course where CourseID='" + idd + "'";

Class2 cc = new Class2();

nd(GridView1, sql);

}

}

6.登录代码

using System;

using ;

using uration;

using tions;

using ;

using ty;

using ;

using trols;

using ts;

using ntrols;

using ;

//using ssionState;

using mydb;

public partial class login_now :

{

protected void Page_Load(object sender, EventArgs e)

{

if (Back)

{

Session["ID"] = null;

//Session["userPass"] = null;

}

}

protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)

{

Session["ID"] += me;

Session["userPass"] += rd;

//t(30);

Class1 cc = new Class1();

string sql = "select * from users where userID='" + me + "' and

userPass='" + rd + "'";

if ((sql).HasRows)

ct("login_");

else

("");

();

}

}