您好,欢迎来到爱go旅游网。
搜索
您的当前位置:首页教务辅助管理系统:

教务辅助管理系统:

来源:爱go旅游网


课 程 设 计

课 程 名 称: 实训程序设计基础 专 业 班 级 :

学 生 姓 名 : 学 号 : 指 导 教 师 : 学 期 :2010-2011学年第二学期

1

专业课程设计任务书

学生姓名 题 目 课题性质 指导教师 其它 专业班级 学号 教务辅助管理系统 课题来源 同组姓名 老师 无 学习掌握并熟练运用C#语言进行程序设计; 主要内容 学习使用窗体; 根据具体题目进行简单的需求分析,给出设计方案。 综合运用和融化所学理论知识,提高分析和解决实际问题的能力,做一个教务辅助管理系统 主要实现以下功能: 任务要求 1) 对上课教师基本信息进行管理。 2) 对全院开设的课程进行管理。 3) 录入教师基本上课信息。 4) 实现自动排课功能。 5) 计算工作量 《C#程序设计教程》(第二版)电子工业出版社 刘浦迎 王蓉 刘光会 《C#数据库程序设计》清华大学出版社 林成春 马朝东 孟湘来 参考文献 指导教师签字: 审查意见 教研室主任签字: 年 月 日 2

1 需求分析

教务辅助管理系统:

是帮助学校进行更好的管理,其中包括教师信息,学生信息和上课信息的查询,录入,添加,修改。对上课信息进行处理,分析,自动排出课程表。减轻学校管理的工作量。

1) 对上课教师基本信息进行管理。

在系统界面可以对老师的基本信息进行查询,其中包括教师的编号,姓名,年龄,性别,学历

2) 对全院开设的课程进行管理。

对于全院的公开课程查询,包括课程的编号,课程名,课程序号,代课教师, 上课教室,学分等。其中管理员可以对课程内容进行修改,例如增加新的课程等。 学生登录只能查询,不能对其做任何的修改。 3) 录入教师基本上课信息。

教师的基本上课信息包括教师编号,教师名,所教课程,上课时间。学生只能查询不能修改。 4) 实现自动排课功能。

在上课信息中,点击按钮,进入选课界面,然后学生进行选课,当选课完毕后,按确定按钮,直接显示课程表。当所选课程上课时间有冲突时则不能显示课程表。

5) 计算工作量。

在每一个界面都将显示,所有记录总数和当前记录所在的位置。注意显示的是数据库中的记录总数,在插入时,记录总数自动增加,单击保存后才将数据回流到数据库。

2 概要设计

⑴ 数据结构

教师信息表:

教师编号(char(10))不准许为空; 教师姓名(char(10))不准许为空;

3

性别(char(2))不准许为空; 学历(char(10))不准许为空; 年龄(int)准许为空; 全员公开课程表:

课程名(char(10))不准许为空; 课程号(char(10))不准许为空; 课程序号(char(2))不准许为空; 代课老师(char(10))不准许为空; 教室(char(4))不准许为空; 学分(char(2))不准许为空; 上课信息表:

教师编号(char(10))不准许为空; 教师名(char(10))不准许为空; 课程名(char(10))不准许为空; 星期几(char(6))不准许为空; 第几大节(char(8))不准许为空; 密码表:

T_U_USERNAME(char(10))不准许为空; T_U_PASSWORD(char(10))不准许为空;

说明:在上面的数据表中依次将“教师编号”“课程号”“课程名”设置为主键。

⑵ 模块划分

共划分为四个模块:

第一:登录模块,当程序运行时,首先进入登陆模块,输入用户名和密码,当密码正确,进入到“选择登陆界面”界面。三次输入不正确,系统自动退出。

第二:到达登陆界面可以选择进入“”教师信息“公开课程”“上课信息”,同时也可以退出。

第三:1、当进入教师信息查询模块时,在此模块中,显示记录总数,当

4

前记录,可对信息全部查询“上一条”“下一条”“首记录”“未记录”“添加”“删除”“保存”“选择查询”“进入课程查询”“进入录入上课信息”“退出”。进行查看信息。信息包括教师编号,教师姓名, 性别,学历,年龄。

2、当进入公开课查询时,可以查到课程的编号,课程序号,课程名,代课老师,教室,学分等信息。

3、当进入上课信息查询时,可以看到教师编号,教师名,课程名,上课时间等。说明:在每个查询界面都有相应的按钮,帮助你查询。“上一条”“下一条”“首记录”“未记录”还可以进行“选择查询”。管理员可以进行“添加”“删除”“保存”等功能。

⑶ 程序总体框架

开始

输入密码 退出 密码错误3次 密码正确 输出选项 教师信息

公开课程 上课信息 退出 3 详细设计

第一、登陆界面:

5

单击“确定”有系统判断密码是否正确,则必须先连接到数据库,TABLE_USER表来判断:

string connectionString = GetConnectionString(); SqlConnection connection = new SqlConnection(connectionString);

SqlCommand command = new SqlCommand();

command.CommandText = \"Select * From TABLE_USER where T_U_USERNAME='\" + textBox1.Text.Trim() + \"' and T_U_PASSWORD='\" + textBox2.Text.Trim() + \"';\";

connection.Open();

static private string GetConnectionString() {

return \"Integrated Security=Yes;Initial Catalog=db_jiaowu;Server=d9\\\\SQLEXPRESS\"; }

延时时间为15秒:command.Connection = connection; command.CommandTimeout = 15; 密码正确进入界面: Form5 f5 = new Form5(); F5.Show(); 密码不正确进行清空:

this.textBox2.Text = \"\";

this.textBox1.Text = \"\"; this.textBox1.Focus(); 密码三次错误自动退出: int error=0; if (error>1) {

Application.Exit();

6

} error++; 退出:this.Close(); 第二、选择界面进入查询:

private void button1_Click(object sender, EventArgs e) {

Form1 f1 = new Form1(); f1.Show(); }(教师信息)

private void button2_Click(object sender, EventArgs e) {

Form2 f2 = new Form2(); f2.Show();(公开课程) }

private void button3_Click(object sender, EventArgs e) {

Form3 f3 = new Form3(); f3.Show(); }(上课信息)

退出: private void button4_Click(object sender, EventArgs e) {

this.Close(); }

第三教师信息查询: 数据的绑定:

string connectionString = GetConnectionString(); SqlConnection connection = new SqlConnection(connectionString);

7

String MySQL = \"Select * From t_jiaoshi;\";

MyAdapter = new SqlDataAdapter(MySQL, connection); scb = new SqlCommandBuilder(MyAdapter);

MyAdapter.Fill(MyDataSet, \"t_jiaoshi\");

tjiaoshiBindingSource = new BindingSource(MyDataSet, \"t_jiaoshi\");

this.textBox1.DataBindings.Add(\"Text\", tjiaoshiBindingSource, \"教师编号\");

this.textBox2.DataBindings.Add(\"Text\", tjiaoshiBindingSource, \"教师姓名\");

this.textBox3.DataBindings.Add(\"Text\", tjiaoshiBindingSource, \"性别\");

this.textBox4.DataBindings.Add(\"Text\",tjiaoshiBindingSource, this.textBox5.DataBindings.Add(\"Text\", tjiaoshiBindingSource, \"年龄\"); this.DisPlayNumber();

}

static private string GetConnectionString() {

return \"Integrated Security=Yes;Initial Catalog=db_jiaowu;Server=d9\\\\SQLEXPRESS\"; } 定义:

BindingSource tjiaoshiBindingSource; SqlDataAdapter MyAdapter;

8

\"学历\");

DataSet MyDataSet = new DataSet(); SqlCommandBuilder scb; 上一条:

if (this.tjiaoshiBindingSource.Position > 0) {

this.tjiaoshiBindingSource.MovePrevious(); } else

{

this.tjiaoshiBindingSource.MoveFirst();

MessageBox.Show(\"已经到了第一条记录!\"); } 下一条:

if (this.tjiaoshiBindingSource.Position + 1 < this.tjiaoshiBindingSource.Count) {

this.tjiaoshiBindingSource.MoveNext(); } else {

MessageBox.Show(\"已经到了最后一条记录!\"); } 首记录:

this.tjiaoshiBindingSource.MoveFirst(); 未记录:

this.tjiaoshiBindingSource.MoveLast(); 添加:

this.tjiaoshiBindingSource.AddNew(); 删除:

9

this.tjiaoshiBindingSource.RemoveCurrent(); 保存:

this.tjiaoshiBindingSource.EndEdit();

this.MyAdapter.Update(MyDataSet , \"t_jiaoshi\"); 选择查询(教师编号或者教师姓名):

tjiaoshiBindingSource.Filter = \"\" + this.comboBox1.Text + \"='\" + this.textBox6.Text + \"'\"; 总记录数和当前记录显示: private void DisPlayNumber() {

this.label7.Text = \"当前记录:\" +

(this.tjiaoshiBindingSource.Position + 1).ToString(); this.label8.Text = \"总记录数:\" + this.tjiaoshiBindingSource.Count.ToString(); } 命名空间加上:

using System.Data.SqlClient; 第四、公开课程查询: 数据的绑定:

private void Form2_Load(object sender, EventArgs e) {

string connectionString = GetConnectionString(); SqlConnection connection = new SqlConnection(connectionString);

String MySQL = \"Select * From t_kecheng;\";

MyAdapter = new SqlDataAdapter(MySQL, connection); scb = new SqlCommandBuilder(MyAdapter);

MyAdapter.Fill(MyDataSet, \"t_kecheng\");

10

tkechengBindingSource = new BindingSource(MyDataSet, \"t_kecheng\");

this.textBox1.DataBindings.Add(\"Text\", tkechengBindingSource, \"课程号\");

this.textBox2.DataBindings.Add(\"Text\", tkechengBindingSource, \"课程名\");

this.textBox3.DataBindings.Add(\"Text\", tkechengBindingSource, \"课程序号\");

this.textBox4.DataBindings.Add(\"Text\", tkechengBindingSource, \"代课老师\");

this.textBox5.DataBindings.Add(\"Text\", tkechengBindingSource, \"教室\");

this.textBox6.DataBindings.Add(\"Text\", tkechengBindingSource, \"学分\"); this.DisPlayNumber(); }

static private string GetConnectionString() {

return \"Integrated Security=Yes;Initial Catalog=db_jiaowu;Server=d9\\\\SQLEXPRESS\"; } 定义:

BindingSource tkechengBindingSource;

SqlDataAdapter MyAdapter;

DataSet MyDataSet = new DataSet(); SqlCommandBuilder scb; 总记录数和当前记录:

private void DisPlayNumber() {

11

this.label2.Text = \"当前记录:\" + (this.tkechengBindingSource.Position + 1).ToString(); this.label3.Text = \"总记录数:\" + this.tkechengBindingSource.Count.ToString(); } 首记录:

this. tkechengBindingSource.MoveFirst(); 未记录:

this. tkechengBindingSource.MoveLast(); 添加:

this. tkechengBindingSource.AddNew(); 删除:

this tkechengBindingSource.RemoveCurrent(); 保存:

this. tkechengBindingSource.EndEdit();

this.MyAdapter.Update(MyDataSet , \"t_kecheng\"); 选择查询(课程号、课程名、课程序号): tkechengBindingSource.Filter

=

\"\"

+

this.comboBox1

+\"='\"+this.textBox7.Text + \"'\"; 命名空间加上:

using System.Data.SqlClient; 上一条:

if (this. tkechengBindingSource.Position > 0) {

this. tkechengBindingSource.MovePrevious(); } else

{

this. tkechengBindingSource.MoveFirst();

12

.Text

MessageBox.Show(\"已经到了第一条记录!\"); } 下一条:

if (this. tkechengBindingSource.Position + 1 < this. tkechengBindingSource.Count) {

this. tkechengBindingSource.MoveNext(); } else {

MessageBox.Show(\"已经到了最后一条记录!\"); } 第五、上课信息 数据的绑定:

private void Form3_Load(object sender, EventArgs e) {

string connectionString = GetConnectionString(); SqlConnection connection = new SqlConnection(connectionString);

String MySQL = \"Select * From t_shangke;\"; MyAdapter = new SqlDataAdapter(MySQL, connection); scb = new SqlCommandBuilder(MyAdapter); MyAdapter.Fill(MyDataSet, \"t_shangke\");

tshangkeBindingSource = new BindingSource(MyDataSet, \"t_shangke\");

this.textBox1.DataBindings.Add(\"Text\", tshangkeBindingSource, \"教师名\");

this.textBox2.DataBindings.Add(\"Text\", tshangkeBindingSource, \"教师编号\");

13

this.textBox3.DataBindings.Add(\"Text\", tshangkeBindingSource, \"课程名\");

this.comboBox1.DataBindings.Add(\"Text\", tshangkeBindingSource, \"星期\");

this.comboBox2.DataBindings.Add(\"Text\", tshangkeBindingSource, \"时间\"); this.DisPlayNumber(); }

static private string GetConnectionString() {

return \"Integrated Security=Yes;Initial Catalog=db_jiaowu;Server=d9\\\\SQLEXPRESS\"; } 首记录:

this. tshangkeBindingSource.MoveFirst(); 未记录:

this. tshangkeBindingSource.MoveLast(); 添加:

this. tshangkeBindingSource.AddNew(); 删除:

this tshangkeBindingSource.RemoveCurrent(); 保存:

this. tshangkeBindingSource.EndEdit();

this.MyAdapter.Update(MyDataSet , \"t_shangke\"); 总记录数和当前记录: private void DisPlayNumber() {

this.label8.Text = \"当前记录:\" +

(this.tshangkeBindingSource.Position +1).ToString();

14

this.label7.Text = \"总记录数:\" + this.tshangkeBindingSource.Count.ToString(); }

4 调试分析

在程序的调试过程中,数据库的连接是关键。数据的绑定容易出现错误。在设计界面时,背景图片和字体,不能相衬,注意将字体改为透明。在登陆界面注意输入密码应显“*****”字符。数据回流数据库一定要保证数据库的联通。

5测试结果

启动时进入登陆界面:

输入用户名密码:

15

进入到:

选择教师信息:

16

选择教师编号查询,查询号码为20007

当是第一条记录,按上一条时:

17

当是末记录,按下一条时:

点击插入:

18

插入填写:

点击保存,到数据库查看:

19

进入公开课

删除:

20

点击保存,查看数据库:

上课信息界面:

21

录入填写:

点击保存,查看数据库:

22

课程设计总结

为期两周的实训课程设计结束了,在这段时间里,我发现了很多问题,自己的基础知识薄弱,需要努力呀!

在这段时间里是我通过老师知道和同学的讨论,让我对C#有了更深的了解,自己的能力也有所提高。通过课程设计我还发现我们身边有很多的小系统,通过自己的努力,就能够实现,C#真的很实用。

通过这次课程设计还让我知道了无论做什么事情一定要认真细心,坚持不懈,脚踏实地,不能敷衍了事!否则,将一事无成!

感谢老师在百忙之中辅导我们,我一定会更加努力的学习。

加油!

23

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- igat.cn 版权所有 赣ICP备2024042791号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务