《C#.NET程序设计》课程设计说明书教师管理系统_第1页
《C#.NET程序设计》课程设计说明书教师管理系统_第2页
《C#.NET程序设计》课程设计说明书教师管理系统_第3页
《C#.NET程序设计》课程设计说明书教师管理系统_第4页
《C#.NET程序设计》课程设计说明书教师管理系统_第5页
已阅读5页,还剩15页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、c#.net程序设计课程设计说明书设计题目: 教师管理系统 学院、系: 软件学院 专业班级: 软升本10-4班 学生姓名: 指导教师: 成 绩: 2011 年 7 月 12 日一、课程设计目的通过完成从用户需求分析、数据库设计、目录结构与通用模块、管理主界面设计及各个具体管理模块设计到上机编程、调试和应用等全过程,进一步了解和掌握c#.net程序设计技术。2、 课程设计任务与要求1. 基本要求:1)要求利用c#的编程思想以及组件开发原理来完成系统的设计;2)突出c#语言与其它语言不同点(即体现c#的高级功能,如属性概念、接口、事件、委托等);3)体现可视化编程基本思想,如系统带有菜单、工具栏、

2、状态栏以及一些常用的高级控件。2. 创新要求:在基本要求达到后,可进行创新设计。完成该系统数据库设计;实现相应信息的添加、删除、删除、查看等功能。三、需求分析在设计数据库结构时,应尽量可能满足用户所提出的各项要求,同时避免冗余数据的产生。由于教师管理系统中需要采集大量的信息,包括院系信息、课程信息、教师信息、收入信息等,如果不能有效合理地组织数据表的结构以及每张表所含的字段,那么在后期进行数据整理及汇总时,将增加开发人员的工作难度和工作量。根据教师基本信息及相关特点,可以总结出一下规律:l 一个院系包括一名或多名教师l 一名教师可以教多门课程l 每名教师都有不同的教师编码l 每名教师都有自己对

3、应的月收入l 一个角色对应一个或多个用户四、概要设计1. 系统功能模块划分教师管理系统院系设置课程设置教师设置收入设置添加院系浏览院系修改院系添加课程删除课程修改课程添加教师修改教师浏览教师添加收入修改收入2. 数据库逻辑结构设计系统数据库名称为hanqifang,数据库中包括:(1)院系信息表dbo.yuanxi;(2)教师表信息dbo.jiaoshi;(3)课程信息表dbo.kecheng.下面列出各个表的数据结构 院系信息表字段名 类 型描 述yuanxibianmayuanximingcheng int varchar院系编码(主键)院系名称 教师信息表 字段名 类 型描 述jiaos

4、hibianmajiaoshixingmingjiaoshixingbiejiaoshixueli yuanximingchengkechengbianmaintvarcharvarcharvarcharvarcharint教师编码(主键)教师姓名教师性别教师学历院系名称课程编码 课程信息表 字段名 类 型描 述kechengbianmakechengmingchengkechengmiaosuintvarcharvarchar课程编码(主键)课程名称课程描述五、详细设计主界面设计主界面设计的作用就是显示本系统所有的功能菜单项,本且把用户经常用到的功能设计成菜单项,以方便用户操作,然后当用户单

5、击相应的菜单项或菜单按钮时,打开对应的模块窗口。本系统的主界面如图。由图可知“院系”菜单下有子菜单,包括“修改”和“添加”。主界面编码:zhuyemian.csusing system;using system.collections.generic;using system.componentmodel;using system.data;using system.drawing;using system.linq;using system.text;using system.windows.forms;using windowsformsapplication1hanqifang.yuan

6、xi;/导入用于院系的命名空间using windowsformsapplication1hanqifang.jiaoshi;namespace windowsformsapplication1hanqifang public partial class zhuyemian : form public zhuyemian() initializecomponent(); private void zhuyemian_load(object sender, eventargs e) private void timer1_tick(object sender, eventargs e) this

7、.ttstime.text = 时间为: + datetime.now.tostring(); tianjia a; private void b_click(object sender, eventargs e) if (a= null | a.isdisposed) a = new tianjia (); for (int x = 0; x this.mdichildren.length; x+) form tempchild = (form)this.mdichildrenx; tempchild.close(); a.mdiparent = this; a.show(); liulan

8、 c; private void 浏览toolstripmenuitem_click(object sender, eventargs e) if (c = null | c.isdisposed) c = new liulan (); for (int x = 0; x this.mdichildren.length; x+) form tempchild = (form)this.mdichildrenx; tempchild.close(); c.mdiparent = this; c.show(); liulan1 c1; private void 浏览toolstripmenuite

9、m1_click(object sender, eventargs e) if (c1 = null | c1.isdisposed) c1 = new liulan1(); for (int x = 0; x this.mdichildren.length; x+) form tempchild = (form)this.mdichildrenx; tempchild.close(); c1.mdiparent = this; c1.show(); tianjia3 a1; private void 修改toolstripmenuitem1_click(object sender, even

10、targs e) if (a1 = null | a.isdisposed) a1 = new tianjia3 (); for (int x = 0; x this.mdichildren.length; x+) form tempchild = (form)this.mdichildrenx; tempchild.close(); a1.mdiparent = this; a1.show(); jiaoshi:liulan1.cs:using system;using system.collections.generic;using system.componentmodel;using

11、system.data;using system.drawing;using system.linq;using system.text;using system.windows.forms;using system.data.sqlclient;namespace windowsformsapplication1hanqifang.jiaoshi public partial class liulan1 : form public liulan1() initializecomponent(); public static string strconn = data source=(loca

12、l);initial catalog=hanqifang;integrated security=true; private void liulan1_load(object sender, eventargs e) showinf(); private void showinf() using (sqlconnection con = new sqlconnection(strconn) if (con.state = connectionstate.closed) con.open(); ; try string sql = select jiaoshibianma as 编号,jiaos

13、hixingming as 教师姓名,jiaoshixingbie as 教师性别 from jiaoshi order by jiaoshibianma; sqldataadapter adp = new sqldataadapter(sql, con); dataset ds = new dataset(); ds.clear(); adp.fill(ds, job); this.datagridview1.datasource = ds.tables0.defaultview; catch (exception ex) messagebox.show(错误: + ex.message,

14、错误提示, messageboxbuttons.okcancel, messageboxicon.error); finally if (con.state = connectionstate.open) con.close(); con.dispose(); xiugai2 frmmodifydepart; private void btnupdate_click(object sender, eventargs e) if (this.datagridview1.currentcell != null) frmmodifydepart = new xiugai2(); frmmodifyd

15、epart.tag = this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim(); /frmmodifydepart.txtdname.text = this.dgvdepartinfo1, this.dgvdepartinfo.currentcell.rowindex.value.tostring().trim(); /frmmodifydepart.txtdleader.text = this.dgvdepartinfo2, this.dgvdepartinfo.currentc

16、ell.rowindex.value.tostring().trim(); /frmmodifydepart.txtdreark.text = this.dgvdepartinfo3, this.dgvdepartinfo.currentcell.rowindex.value.tostring().trim(); frmmodifydepart.startposition = formstartposition.centerparent; frmmodifydepart.showdialog(); if (frmmodifydepart.dialogresult = dialogresult.

17、ok) showinf(); private void btndelete_click(object sender, eventargs e) using (sqlconnection con = new sqlconnection(strconn) if (con.state = connectionstate.closed) con.open(); ; try if (this.datagridview1.currentcell != null) string sql = select kechengmingcheng from dbo.kecheng wherekechengbianma

18、 = + this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim() + and kechengbianma not in (select distinct kechengbianma from dbo.kecheng inner join dbo.jiaoshi on dbo.kecheng.kechengbianma=dbo.jiaoshi.kechengbianma); sqlcommand cmd = new sqlcommand(sql, con); sqldatareade

19、r dr; dr = cmd.executereader(); if (!dr.read() messagebox.show(删除院系 + this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim() + 失败!, 提示); dr.close(); else dr.close(); sql = delete from dbo.kecheng where kechengbianma= + this.datagridview10, this.datagridview1.currentcell

20、.rowindex.value.tostring().trim() + and kechengbianma not in (select distinct kechengbianma from dbo.jiaoshi); cmd.commandtext = sql; cmd.executenonquery(); messagebox.show(删除院系 + this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim() + 成功, 提示); catch (exception ex) mes

21、sagebox.show(错误: + ex.message, 错误提示, messageboxbuttons.okcancel, messageboxicon.error); finally if (con.state = connectionstate.open) con.close(); con.dispose(); showinf(); private void btnexit_click(object sender, eventargs e) this.close(); yuanxi liulan.cs:using system;using system.collections.gen

22、eric;using system.componentmodel;using system.data;using system.drawing;using system.linq;using system.text;using system.windows.forms;using system.data.sqlclient;namespace windowsformsapplication1hanqifang.yuanxi public partial class liulan : form public liulan() initializecomponent(); public stati

23、c string strconn = data source=(local);initial catalog=hanqifang;integrated security=true; private void liulan_load(object sender, eventargs e) showinf(); private void showinf() using (sqlconnection con = new sqlconnection(strconn) if (con.state = connectionstate.closed) con.open(); ; try string sql

24、 = select yuanxibianma as 编号,yuanximingcheng as 院系名称 from dbo.yuanxi order by yuanxibianma; sqldataadapter adp = new sqldataadapter(sql, con); dataset ds = new dataset(); ds.clear(); adp.fill(ds, job); this.datagridview1.datasource = ds.tables0.defaultview; catch (exception ex) messagebox.show(错误: +

25、 ex.message, 错误提示, messageboxbuttons.okcancel, messageboxicon.error); finally if (con.state = connectionstate.open) con.close(); con.dispose(); xiugai frmmodifyjob; private void btnupdate_click(object sender, eventargs e) if (this.datagridview1.currentcell != null) frmmodifyjob = new xiugai(); frmmo

26、difyjob.tag = this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim(); /frmmodifyjob.datagridview1.text = this.datagridview11, this.datagridview1.currentcell.rowindex.value.tostring().trim(); frmmodifyjob.startposition = formstartposition.centerparent; frmmodifyjob.showd

27、ialog(); if (frmmodifyjob.dialogresult = dialogresult.ok) showinf(); private void btndelete_click(object sender, eventargs e) using (sqlconnection con = new sqlconnection(strconn) if (con.state = connectionstate.closed) con.open(); ; try if (this.datagridview1.currentcell != null) string sql = selec

28、t yuanximingcheng from dbo.yuanxi where yuanxibianma= + this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim() + and yuanxibianma not in (select distinct dbo.yuanxi.yuanxibianma from dbo.yuanxi inner join dbo.jiaoshi on dbo.jiaoshi.yuanximingcheng=dbo.yuanxi.yuanximingc

29、heng); sqlcommand cmd = new sqlcommand(sql, con); sqldatareader dr; dr = cmd.executereader(); if (!dr.read() messagebox.show(删除院系 + this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim() + 失败,请先删除与此院系相关的教师!, 提示); dr.close(); else dr.close(); sql = delete from dbo.yuanxi

30、 where yuanxibianma= + this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim() + and yuanximingcheng not in (select yuanximingcheng from dbo.yuanxi); cmd.commandtext = sql; cmd.executenonquery(); messagebox.show(删除院系 + this.datagridview10, this.datagridview1.currentcell.

31、rowindex.value.tostring().trim() + 成功, 提示); catch (exception ex) messagebox.show(错误: + ex.message, 错误提示, messageboxbuttons.okcancel, messageboxicon.error); finally if (con.state = connectionstate.open) con.close(); con.dispose(); showinf(); private void btnexit_click(object sender, eventargs e) this

32、.close(); private void datagridview1_cellcontentclick(object sender, datagridviewcelleventargs e) xiugai.cs:using system;using system.collections.generic;using system.componentmodel;using system.data;using system.drawing;using system.linq;using system.text;using system.windows.forms;using system.dat

33、a.sqlclient;namespace windowsformsapplication1hanqifang.yuanxi public partial class xiugai : form public xiugai() initializecomponent(); private void label3_click(object sender, eventargs e) public static string strconn = data source=(local);initial catalog=hanqifang;integrated security=true; privat

34、e void tnok_click(object sender, eventargs e) if (this.textbox1.text.trim() = | this.textbox2.text.trim() = ) messagebox.show(请输入完整信息!, 提示, 0); else using (sqlconnection con = new sqlconnection(strconn) if (con.state = connectionstate.closed) con.open(); ; try sqlcommand cmd = new sqlcommand(select

35、* from dbo.yuanxi where yuanximingcheng= + textbox2.text.trim() + and yuanxibianma + this.tag.tostring().trim(), con); if (cmd.executescalar() != null) messagebox.show(学院名称发生重复,请重新输入!, 提示, 0); else string sql = update dbo.yuanxi set yuanximingcheng= + textbox2.text.trim() + where yuanxibianma= + thi

36、s.tag.tostring().trim(); cmd.commandtext = sql; cmd.executenonquery(); messagebox.show(学院信息修改成功!, 提示, 0); catch (exception ex) messagebox.show(错误: + ex.message, 错误提示, messageboxbuttons.okcancel, messageboxicon.error); finally if (con.state = connectionstate.open) con.close(); con.dispose(); private void btnexit_click(object sender, eventargs e) this.close(); private void xiugai_loa

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论