1、沈阳理工大学ASPNET课程设计报告淮阴工学院ASP.NET+数据库设计开发实习报告系(院): 计 算 机 工 程 学 院 专 业: 计算机科学与技术 班 级: NIIT1111 学生姓名: 耿 帅 学号: 1111305106 指导教师: 王媛媛 张海艳 学年学期: 2013 2014 学年 第 1 学期 2013 年 12 月 15 日目 录1 需求分析 11.1 学生需求分析 11.2 教师需求分析 11.3 管理员需求分析 12数据库、数据表设计 12.1 创建数据库 12.2 创建数据表 22.3 数据库关系图 33数据库、数据表设计 43.1 系统框架 43.2 母版页 53.3
2、学生界面 83.4 教师界面 123.5 注册界面 134使用到的技术 184.1 后台 184.2 前台 195 测试 191 需求分析1.1 学生需求分析学生可以登录到系统,如果还没有账户,首先注册账户,或者在学生登失败时提醒注册账户。学生登录到系统后可以查看有关课程、自己的信息、已选课信息,查收收到的信息,修改自己的信息(包括登录密码、联系方式等),学生可以选课、听课、下载资料、上传问题等。1.2 教师需求分析 教师可以登录到系统,如果还没有账户,首先注册账户,或者在教师登失败时提醒先注册账户。教师登录系统后,可以向管理员申请注册新的授课信息,查看自己授课信息。1.3 管理员需求分析管理
3、员可以登录到系统,注册账号,删除学生和教师的账户信息,安排本系统可以进行的课程,发布公告,推荐最新课程等。2数据库、数据表设计因为预计远程教育系统的修改操作会比查询操作多,故在设计数据库是大部分表采用了3NF,这样在修改时会比较方便。我初期设计了八个表,以满足系统的基本需求,在后期的系统实现过程中,根据需要添加或修改相应表。八个表分别是UserAccount,StudentInfo,InstructorInfo,ManagerInfo,Course,SelectCourse,DivingClass(GivingCourse),Information。2.1 创建数据库CREATE DATABA
4、SE RemoteEduON PRIMARY( NAME=RemoteEdu, FILENAME=E:RemoteEduRemoteEdu.mdf, -在目录E:RemoteEdu下创建数据-库RemoteEdu SIZE=3MB, MAXSIZE=50MB, FILEGROWTH=1MB )2.2 创建数据表1.创建UserAccount表:create table UserAccount ( Account char(8) primary key, Name char(4) not null, Duty char(10) not null, Password char(8) not nul
5、l,)2.创建StudentInfo表:create table StudentInfo( IdentityNo char(18) primary key, name char(4) not null, Account char(8) foreign key references UserAccount(Account), Sex char(2) not null, PhoneNum char(11) not null, Email varchar(20) not null, Birth datetime not null, discribtion varchar(200),)3.创建Inst
6、ructorInfo表:create table InstructorInfo( IdentityNo char(18) primary key, name char(4) not null, Account char(8) foreign key references UserAccount(Account), Sex char(2) not null, PhoneNum char(11) not null, Email varchar(20) not null, Birth datetime not null, Discribtion varchar(200)4.创建ManagerInfo
7、表:create table ManagerInfo( IdentityNo char(18) primary key, name char(4) not null, Account char(8) foreign key references UserAccount(Account), Sex char(2) not null, PhoneNum char(11) not null, Email varchar(20) not null, Birth datetime not null, discribtion varchar(200),)5.创建Course表:create table C
8、ourse( CourseNo char(8) primary key, CourseName char(20) not null, CourseDescribe varchar(100), Price float, Type char(10)6.创建DivingClass表:create table DivingClass( CourseNo char(8) not null foreign key references Course(CourseNo), IdentityNo char(18)not null foreign key references InstructorInfo(Id
9、entityNo), date datetime, primary key(CourseNo,IdentityNo)7.创建SelectCourse表:create table SelectCourse( IdentityNo char(18) not null foreign key references StudentInfo(IdentityNo), CourseNo char(8) not null foreign key references Course(CourseNo), date datetime, primary key(IdentityNo,CourseNo)8.创建In
10、formation表:create table Information( 我收到的信息varchar(500), 发送者char(8) foreign key references UserAccount(Account), 接收者char(8)foreign key references UserAccount(Account), 日期datetime, primary key(发送者,接收者)2.3 数据库关系图图2-1 数据库关系图3数据库、数据表设计3.1 系统框架图3-1 系统框架3.2 母版页3.2.1 主要代码html: #Top width:840px; height:80px
11、; margin:0 auto; background-color:Orange; #SiteMap width:840px; height:25px; margin:0 auto; background-color:#ccc; position:relative; #ContentPlaceHolder width:840px; height:500px; margin :0 auto; #Footer width:840px; height:50px; margin:0 auto; background-color:Gray; position:relative; a text-decor
12、ation:none; C#:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data.SqlClient;using System.Data;public partial class MasterPage : System.Web.UI.MasterPage string duty; string constring = Data Source=SDW
13、M-20130407KXSQLEXPRESS;Initial Catalog=RemoteEdu;Integrated Security=true;MultipleActiveResultSets=True; SqlConnection con; protected void Page_Load(object sender, EventArgs e) con = new SqlConnection(); con.ConnectionString = constring; con.Open(); protected void RadioButtonList1_SelectedIndexChang
14、ed(object sender, EventArgs e) if (RadioButtonList1.Text.Equals(学生) duty = 学生; if (RadioButtonList1.Text.Equals(教师) duty = 教师; if (RadioButtonList1.Text.Equals(管理员) duty = 管理员; SqlCommand cmd = new SqlCommand(select Account,Password from UserAccount, con); SqlDataReader dr = cmd.ExecuteReader(); whi
15、le (dr.Read() if (dr0.ToString().Equals(TextBox1.Text) if (duty.Equals(学生) string str_id = TextBox1.Text; SessionID = str_id; Response.Redirect(StudentInterface.aspx); if (duty.Equals(教师) string str_id = TextBox1.Text; SessionID = str_id; Response.Redirect(TeacherInterface.aspx); if (duty.Equals(管理员
16、) string str_id = TextBox1.Text; SessionID = str_id; Response.Redirect(ManagerInterface.aspx); Response.Write(输入不正确); 3.2.2 部分功能设置一个Banner盒子,用来显示系统的标识;一个SiteMap盒子,用来显示整个系统路径;一个Footer盒子,用来显示系统制作这的信息。点击“登录”,弹出登录对话框,根据输的信息进入不同的用户界面。3.2.3 截图图3-2母版页3.3 学生界面3.3.1 主要代码html:我的选课信息我的账户管理收到的信息的收藏我的笔录选择课程上课资料下
17、载 $(function () $(#登录).click(function () $(#登录界面).toggle(); ); $(#我的选课信息).click(function () $(#收到信息).hide(); $(#gridView1).show(); $(#区域二).hide(); $(#区域四).hide(); $(#区域五).hide(); $(#区域六).hide(); $(#区域七).hide(); $(#区域八).hide(); $(#默认).hide(); );); C#:using System;using System.Collections.Generic;usin
18、g System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data.SqlClient;using System.Data;public partial class StudentInterface : System.Web.UI.Page string constring = Data Source=SDWM-20130407KXSQLEXPRESS;Initial Catalog=RemoteEdu;Integrated Security=true;Mult
19、ipleActiveResultSets=True; SqlConnection con; protected void Page_Load(object sender, EventArgs e) con = new SqlConnection(); con.ConnectionString = constring; con.Open(); SqlCommand cmd = new SqlCommand(select UserAccount.Name,UserAccount.Account,Sex,PhoneNum,UserAccount.Duty,IdentityNo,Birth,Passw
20、ord,Email from UserAccount join StudentInfo on UserAccount.Account=StudentInfo.Account where UserAccount.Account= + SessionID.ToString() + , con); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(select SelectCourse.CourseNo,CourseName,CourseDescribe,Price,Type from SelectCourse jo
21、in Course on SelectCourse.CourseNo=Course.CourseNo join StudentInfo on StudentInfo.IdentityNo=SelectCourse.IdentityNo where StudentInfo.Account= + SessionID.ToString() + , con); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); DataSet ds2 = new DataSet(); SqlDataAdapter da2 = new SqlDat
22、aAdapter(select 我收到的信息,发送者,日期from Information where 接收者= + SessionID.ToString() + , con); da2.Fill(ds2); GridView2.DataSource = ds2; GridView2.DataBind(); DataSet ds3 = new DataSet(); SqlDataAdapter da3 = new SqlDataAdapter(select DivingClass.CourseNo as 课号,Course.CourseName as 课程名称,InstructorInfo.n
23、ame as 授课老师,InstructorInfo.IdentityNo as 教师号,CourseDescribe as 课程简介,Price as 价格,type as 分类from DivingClass join Course on DivingClass.CourseNo=Course.CourseNo join InstructorInfo on InstructorInfo.IdentityNo=DivingClass.IdentityNo, con); da3.Fill(ds3); GridView3.DataSource = ds3; GridView3.DataBind(
24、); SqlDataReader dr=cmd.ExecuteReader(); while(dr.Read() Label1.Text = dr0.ToString(); Label2.Text = dr1.ToString(); Label3.Text = dr0.ToString(); Label4.Text = dr2.ToString(); Label5.Text = dr3.ToString(); Label6.Text = dr4.ToString(); Label7.Text = dr5.ToString(); Label8.Text = dr6.ToString(); pro
25、tected void Button2_Click(object sender, EventArgs e) SessionID1 = Label2.Text; Response.Redirect(编辑区域.aspx); protected void GridView3_SelectedIndexChanged(object sender, EventArgs e) Session课号 =GridView3.SelectedRow.Cells1.Text; Session教师号 = GridView3.SelectedRow.Cells4.Text; Session学生账号 = SessionI
26、D; /Response.Write(Session学生账号.ToString(); Response.Redirect(SelectCourse.aspx); 3.3.2 部分功能学生里面有我的选课信息、我的账户管理、收到的信息、的收藏、我的笔录、选择课程等几个功能模块,点击分别切换界面。3.3.3 截图图3-3图3-4 学生选课信息图3-5 学生编辑界面3.4 教师界面3.4.1 主要代码C#:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.U
27、I;using System.Web.UI.WebControls;using System.Data.SqlClient;using System.Data;public partial class TeacherInterface : System.Web.UI.Page string constring = Data Source=SDWM-20130407KXSQLEXPRESS;Initial Catalog=RemoteEdu;Integrated Security=true;MultipleActiveResultSets=True; SqlConnection con; protected void Page_Load(object sender, EventArgs e) con = new SqlConnection(); con.C
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1