宿舍管理系统c_第1页
宿舍管理系统c_第2页
宿舍管理系统c_第3页
宿舍管理系统c_第4页
宿舍管理系统c_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

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

文档简介

1、 兰州财经大学陇桥学院 信息工程系课程设计报告 课 程 名 称: C#面向对象程序设计 设 计 题 目:学生宿舍管理系统 班 级:电子商务1401 学 生 姓 名:卯成飞 学 生 学 号:20140680126 指 导 教 师:于泳海 年 月 日目录一、系统开发的背景1二、系统分析与设计1(一)系统功能要求1(二)系统模块结构设计2三、系统的设计与实现3(一)学生宿舍管理系统基本流程3(二)学生宿舍管理流程图3四、系统测试4(一)测试登录4(二)测试部分主菜单5五、总结8六、附件(代码、部分图表)86.1登陆代码86.2查询学生信息代码96.3添加学生信息96.4删除学生信息106.5入住查询

2、116.6查询宿舍信息126.7添加宿舍信息126.8入住查询136.9入住添加14宿舍管理系统一、系统开发的背景学生宿舍管理系统对于一个学校来说是必不可少的组成部分。目前好多学校还停留在宿舍管理人员手工记录数据的最初阶段,手工记录对于规模小的学校来说还勉强可以接受,但对于学生信息量比较庞大,需要记录存档的数据比较多的高校来说,人工记录是相当麻烦的。而且当查找某条记录时,由于数据量庞大,还只能靠人工去一条条的查找,这样不但麻烦还浪费了许多时间,效率也比较低。当今社会是飞速进步的世界,原始的记录方式已经被社会所淘汰了,计算机化管理正是适应时代的产物。信息世界永远不会是一个平静的世界,当一种技术不

3、能满足需求时,就会有新的技术诞生并取代旧技术。21世纪的今天,信息社会占着主流地位,计算机在各行各业中的运用已经得到普及,自动化、信息化的管理越来越广泛应用于各个领域。二、系统分析与设计(一) 系统功能要求为了使系统使用者感到操作方便,提供便利的数据查询与增删改除工作。成功的开发出学生宿舍管理系统。可以查询、添加、删除员工、学生、宿舍的信息,便于管理,节省人力。从而达到管理的目的。由于数据库存储容量相当大,而且比较稳定,适合较长时间的保存,也不容易丢失。这无疑是为信息存储量比较大的学校提供了一个方便、快捷的操作方式。本系统具有运行速度快、安全性高、稳定性好的优点,并且具备完善的报表生成、修改功

4、能,能够快速的查询学校所需的住宿信息,方便高校对学生宿舍的管理。学生宿舍管理系统应提供简单、层次关系明了、清晰的操作界面,使用户一目了然。尽可能的为用户的录入、查询等功能操作提供方便。在设计该系统时,应尽可能的贴近学生,便于用户操作。系统在实现上应该具有如下功能: 1、 系统要求用户必须输入正确的用户名和密码才能进入系统。2、 系统应提供查询功能,以方便用户对学生基本信息的查询(要实现按多种条件的查询)及楼房信息的查询。3、 系统还应具有添加、修改、删除基本信息的功能。(二) 系统模块结构设计通过对系统功能的分析,学生宿舍管理系统功能如图X所示。用户登陆信息查询信息管理修改信息学生信息查询宿舍

5、查询员工信息查询入住查询添加学生信息删除学生信息删除员工信息添加宿舍信息图1 学生宿舍系统功能图通过上图的功能分析,把整个系统划分为8个模块:1、 学生信息查询、添加、删除。2、 宿舍信息的查询、添加。3、 入住信息的查询。三、系统的设计与实现(一) 学生宿舍管理系统基本流程(1)用户登录用户只需要填写姓名和密码就可以完成登录操作,登录成功自动跳转到主菜单页面。(2)信息查询用户在此可以通过输入宿舍、班级、学号等进行分类查询,查看相对应的学生基本信息。查询完后可以通过链接跳转到其他页面进行相关操作。(3)宿舍管理本页面主要进行对晚归学生的登记管理,还有对入住情况及员工信息的查询。操作完成后可以

6、通过链接跳转到其他页面进行相关操作。(4)修改信息用户在此可以通过添加新宿舍和新生信息来修改基本宿舍信息。操作完成后可以通过链接跳转到其他页面进行相关操作。(二) 学生宿舍管理流程图分析:首先输出表头,然后依次经过查询、信息管理、修改信息。流程图如图2所示。用户登陆信息查询信息管理修改信息图2 宿舍管理系统流程图四、系统测试(一) 测试登录图3 登录界面(二) 测试部分主菜单图4 主菜单界面图5 添加学生信息界面图6 删除学生信息界面图7 查询学生信息界面图8 删除学生信息界面图9 修改学生信息界面图10 入住查询界面图11 入住添加界面五、总结通过两周的努力,大学生宿舍管理系统基本上完成了。

7、通过这一个小项目,我收获了很多。尤其是在数据库的SQL语句的练习方面。很多以前不熟练的SQL语句现在都能熟练地写出来了;还有就是一些基本的控件的使用,Label、TextBox、Button等,以前不知道德一些属性现在也了解了那么多。不过该系统还是有一些漏洞的,比如在员工管理上,对于员工信息没有加入数据库表中, 也没在系统内显现出来,不是很完善。不过在以后的学习和练习中会不断改正和解决不懂的问题。六、附件(代码、部分图表)6.1登陆代码using System.Data.SqlClient;conn.ConnectionString = "Data Source=.;Initial

8、Catalog=宿舍;Integrated Security=True" conn.Open(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select 密码 from 登录 where 用户名='" +textBox1.Text + "'" cmd.Connection = conn; string pass = Convert.ToString(cmd.ExecuteScalar(); if (textBox2.Text = pass) 主菜单 n = ne

9、w 主菜单(); MessageBox.Show("欢迎进入高校宿舍管理系统", "登陆成功"); this.Hide(); n.Show(); this.Hide(); else MessageBox.Show("用户名或密码错误请重新确输入, "登录失败"); conn.Close(); 6.2查询学生信息代码using System.Data.SqlClient;string connString = "Data Source=.;Initial Catalog=宿舍;Integrated Security=

10、True" SqlConnection connection = new SqlConnection(connString); string 学号 = textBox1.Text; string sql = String.Format("select * from 学生信息 where 学号 like'%0%'", textBox1.Text); SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, connection); DataSet dataSet = new DataSet("

11、宿T舍¦¨¢"); dataAdapter.Fill(dataSet); dataGridView1.Columns0.DataPropertyName = "学号" dataGridView1.Columns1.DataPropertyName = "班级" dataGridView1.Columns2.DataPropertyName = "姓名" dataGridView1.Columns3.DataPropertyName = "性别" dataGridView1.D

12、ataSource = dataSet.Tables0; private void button2_Click(object sender, EventArgs e) this.Hide(); 6.3添加学生信息using System.Data.SqlClient;string connString = "Data Source=.;Initial Catalog=宿舍;Integrated Security=True" SqlConnection connection = new SqlConnection(connString); string sql = Strin

13、g.Format("INSERT INTO 学生信息(学号,班级,姓名,性别) VALUES('"+textBox1.Text+"','"+textBox2.Text+"','"+textBox3.Text+"','"+textBox4.Text+"')" ); try connection.Open(); SqlCommand command = new SqlCommand(sql, connection); int count

14、 = command.ExecuteNonQuery(); if (count > 0) MessageBox.Show("添加学生信息成功, "添加成功", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show("添加学生失败", "添加失败¹", MessageBoxButtons.OK, MessageBoxIcon.Information); catch (Exception ex) MessageBox.Sho

15、w(ex.Message, "操作数据库出错", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); finally connection.Close(); private void button2_Click(object sender, EventArgs e) this.Hide(); 6.4删除学生信息using System.Data.SqlClient;string connString = "Data Source=.;Initial Catalog=宿舍;Integrated Security=Tr

16、ue" SqlConnection connection = new SqlConnection(connString); string sql = String.Format("delete from 学生信息where 学号like'%0%'and 班级like'%1%'", textBox1.Text, textBox2.Text); try connection.Open(); SqlCommand command = new SqlCommand(sql, connection); int count = command.

17、ExecuteNonQuery(); if (count > 0) MessageBox.Show("删除学生信息成功", "删除成功", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show("删除学生信息失败¹", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Information); catch (Exception ex) MessageBox.Show(e

18、x.Message, "操作数据库出错", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); finally connection.Close(); private void button2_Click(object sender, EventArgs e) this.Hide(); 6.5入住查询using System.Data.SqlClient;string connString = "Data Source=.;Initial Catalog=宿舍;Integrated Security=True&qu

19、ot; SqlConnection connection = new SqlConnection(connString); string 楼£¤号? = textBox1.Text; string 宿T舍¦¨¢号? = textBox2.Text; string sql = String.Format("select * from 入住where 楼号like'%0%' and 宿舍号like'%1%'", textBox1.Text, textBox2.Text); SqlDataAdapt

20、er dataAdapter = new SqlDataAdapter(sql, connection); DataSet dataSet = new DataSet("宿舍"); dataAdapter.Fill(dataSet); dataGridView1.Columns0.DataPropertyName = "楼号" dataGridView1.Columns1.DataPropertyName = "宿舍号" dataGridView1.Columns2.DataPropertyName = "是否住满"

21、; dataGridView1.Columns3.DataPropertyName = " 可住/满员" dataGridView1.DataSource = dataSet.Tables0; private void button2_Click(object sender, EventArgs e) this.Hide(); 6.6查询宿舍信息using System.Data.SqlClient;string connString = "Data Source=.;Initial Catalog=宿舍;Integrated Security=True"

22、; SqlConnection connection = new SqlConnection(connString); string 楼£¤号? = textBox1.Text; string 宿T舍¦¨¢号? = textBox2.Text; string sql = String.Format("select * from 宿舍信息where 楼号 like'%0%' and 宿舍号 like '%1%'", textBox1.Text, textBox2.Text); SqlDataAd

23、apter dataAdapter = new SqlDataAdapter(sql, connection); DataSet dataSet = new DataSet("宿舍"); dataAdapter.Fill(dataSet); dataGridView1.Columns0.DataPropertyName = "楼号" dataGridView1.Columns1.DataPropertyName = "宿舍号" dataGridView1.Columns2.DataPropertyName = "学号&quo

24、t; dataGridView1.Columns3.DataPropertyName = "姓名" dataGridView1.Columns4.DataPropertyName = "班级" dataGridView1.Columns5.DataPropertyName = "入住日期" dataGridView1.DataSource = dataSet.Tables0; private void button2_Click(object sender, EventArgs e) this.Hide(); 6.7添加宿舍信息usi

25、ng System.Data.SqlClient;string connString = "Data Source=.;Initial Catalog=宿T舍¦¨¢Integrated Security=True" SqlConnection connection = new SqlConnection(connString); string sql = String.Format("INSERT INTO 宿舍信息 (楼号,宿舍号,学号,姓名,班级,入住日期) VALUES('" + textBox1.Text +

26、 "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "')"); try connection.Open(); SqlCommand command = new SqlCommand(sql, conn

27、ection); int count = command.ExecuteNonQuery(); if (count > 0) MessageBox.Show("添加宿T舍信息成功", "添加成功", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show("添加宿舍信息失败", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Information); catch (Excepti

28、on ex) MessageBox.Show(ex.Message, "操作数据库出错", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); finally connection.Close(); private void button2_Click(object sender, EventArgs e) this.Hide(); 6.8入住查询string connString = "Data Source=.;Initial Catalog=宿舍;Integrated Security=True"

29、SqlConnection connection = new SqlConnection(connString); string 楼£¤号? = textBox1.Text; string 宿T舍¦¨¢号? = textBox2.Text; string sql = String.Format("select * from 入住where 楼号 like'%0%' and 宿舍号 like'%1%'", textBox1.Text, textBox2.Text); SqlDataAdapter

30、 dataAdapter = new SqlDataAdapter(sql, connection); DataSet dataSet = new DataSet("宿舍"); dataAdapter.Fill(dataSet); dataGridView1.Columns0.DataPropertyName = "楼号" dataGridView1.Columns1.DataPropertyName = "宿舍号" dataGridView1.Columns2.DataPropertyName = "是否住满"

31、dataGridView1.Columns3.DataPropertyName = " 可住/满员" dataGridView1.DataSource = dataSet.Tables0; private void button2_Click(object sender, EventArgs e) this.Hide(); 6.9入住添加string connString = "Data Source=.;Initial Catalog=宿舍;Integrated Security=True" SqlConnection connection = new

32、 SqlConnection(connString); string sql = String.Format("use 宿舍 INSERT INTO 入住 (楼号,宿舍号,是否住Á?满,可住/满员)VALUES('" + textBox1.Text + "','"+textBox2.Text+"','" +textBox3.Text+"','"+textBox4.Text+"')" ); try connection.Open(); SqlCommand command = new SqlCommand(sql, connection); int count = command.ExecuteNonQuery(); if (count > 0) MessageBox.Show("添加

温馨提示

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

评论

0/150

提交评论