第一范文网 - 专业文章范例文档资料分享平台

网上选课系统的设计与实现

来源:用户分享 时间:2025/9/26 6:40:09 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

新疆师范大学2010届本科毕业生毕业论文(设计)

SqlConnection conn = new SqlConnection(SqlString); conn.Open();

SqlCommand seleco = new SqlCommand(sqlString0, conn); int CourseCount = Convert.ToInt32(seleco.ExecuteScalar()); conn.Close();

if (CourseCount == 0) {

string sqlString = \

CourseInfo(CourseName,TeacherID,CourseDes,MajorID,Credits,Lesson) values('\ + CourseName + \ + TeacherID + \ + CourseDes + \ + MajorID + \ + Credits + \ + Lesson + \;

SqlHelper.ExecuteNonQuery(SqlString, CommandType.Text, sqlString); } else {

System.Web.HttpContext.Current.Response.Write(\此课程已

添加!'); \);

} }

(2)在Admin文件夹的courseadd.aspx.cs中的代码为:

//在courseadd.aspx.cs的btbOK(按钮)下实现添加的功能

protected void btnOK_Click(object sender, System.EventArgs e) { //判断条件,名称不允许未空,名称长度不超过个字符 if(txtName.Text==\) Response.Write(\名称不允许未空');\); else if(txtName.Text.Length>20) { Response.Write(\最多个字符');\); } else { CourseBiz.Course course = new CourseBiz.Course(); CourseBiz.Teacher teacher = new CourseBiz.Teacher(); if(Request[\]==\)//添加课程 {

course.InsertCourseInfo(txtName.Text.Trim(),

int.Parse(ddlTeacher.SelectedValue), txtDes.Text,

int.Parse(ddlDept.SelectedValue), int.Parse(Credits.Text.Trim()), int.Parse(Lesson.Text.Trim()));

} else//更新课程 {

course.UpdateCourseInfo(txtName.Text.Trim(),

14

新疆师范大学2010届本科毕业生毕业论文(设计)

int.Parse(ddlTeacher.SelectedValue), txtDes.Text,

int.Parse(ddlDept.SelectedValue), int.Parse(txtNumber.Text), int.Parse(Credits.Text.Trim()), int.Parse(Lesson.Text.Trim()));

}

string str = \

language=javascript>window.dialogArguments.document.location.href='Course.aspx';window.close();\; Response.Write(str);

} }

4.2.2 学生选课子系统

学生选课子系统可分为个人信息维护、学生选课和查看选课信息三个小模块,具体讲述学生选课子模块。

1.界面设计

学生选课界面如图 16 学生选课界面所示:

图 16 学生选课界面

2.后台设计

学生选课的部分代码如下:

(1) 在App_Code/Student.cs中的代码:

///

/// 插入一条学生选课记录 ///

///

public void InsertStudentCourse(int StuID, int CourseID) {

string sqlString = \values(\+StuID+\+CourseID+\;

15

新疆师范大学2010届本科毕业生毕业论文(设计)

}

SqlHelper.ExecuteNonQuery(SqlString, CommandType.Text, sqlString);

(2) 在Student/stuaddcourse.aspx.cs中的代码:

protected void btnAdd_ServerClick(object sender, System.EventArgs e) { //循环插入学生选的课程 foreach(DataGridItem item in dgBulletin.Items) {

if(item.ItemType==ListItemType.Item ||

item.ItemType==ListItemType.AlternatingItem)

{ CheckBox chkID = (CheckBox)item.FindControl(\); if(chkID.Checked==true) { int CourseID = int.Parse(item.Cells[1].Text); int StuID = int.Parse(Session[\].ToString()); CourseBiz.Student stu = new CourseBiz.Student(); stu.InsertStudentCourse(StuID, CourseID); } } } Response.Redirect(\); }

4.2.3 教师查询子系统

教师查询子系统可分为担任课程课表查询、选课学生信息查询两个小模块,具体讲述选课学生信息查询子模块。

1.界面设计

选课学生信息查询界面如图 17 选课学生信息查询界面所示:

图 17 选课学生信息查询界面

16

新疆师范大学2010届本科毕业生毕业论文(设计)

2.后台设计

选课学生信息查询的部分代码如下: (1) 在App_Code/Teacher.cs中的代码:

///

/// 取得选课的学生信息 ///

///

public DataSet GetStuInfoByTID(int TeacherID) {

string sqlString = \

st.CourseID=sc.CourseID inner join StudentInfo stc on st.StudentID=stc.StudentID inner join MajorInfo smi on stc.MajorID=smi.MajorID where sc.TeacherID=\+TeacherID; return SqlHelper.ExecuteDataset(SqlString, CommandType.Text, sqlString); }

(2) 在Teacher/coursestuinfo.aspx.cs中的代码:

///教师查询学生选课信息 public void DgBind() { CourseBiz.Teacher teacher = new CourseBiz.Teacher(); DataSet ds = teacher.GetStuInfoByTID(int.Parse(Session[\].ToString())); if(ds!=null && ds.Tables.Count>0 && ds.Tables[0].Rows.Count>0) { dgBulletin.DataSource = ds; dgBulletin.DataBind(); } else { lblNo.Visible = true; dgBulletin.Visible = false; } }

17

搜索更多关于: 网上选课系统的设计与实现 的文档
网上选课系统的设计与实现.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c0j9i86mjg32r4yi9c21q_5.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top