




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、摘要作为计算机专业的信院来说,机房实验是必不可少的教学内容,但是在建设和管理上面临着挑战。机房规模的扩大、软硬件的不断更新、机房角色的多元化以及学生层次的良莠不齐,给管理带来了极大的难度,开发一个计算机系统进行自动化的管理势在必行。本文以信院的机房管理为背景,实现了机房管理系统的教师管理模块,能用来为老师提供本院学生的信息,进行试验的安排,为计算机管理员提供有关机器的信息,能给计算机管理员带来极大的方便。该系统是在VS2010开发平台上开发的,是基于.NET Framework语言库的C#语言编写的。使用Microsoft SQL Server数据库作为存储数据。关键词 机房管理,教师管理,S
2、QL Server数据库1绪论时代的进步以及网络的发展与普及,给机房管理系统的应用提供了便利的硬件环境。机房管理系统与SQL Server数据库相互的配合,显示出了新时代教学方式的独特优势。再次介绍计算机管理系统的背景及意义,以及开发本系统所使用的工具和平台。1.1开发背景及意义二十一世纪是信息的时代,而且目前大学的网络建设趋于完善。大学的教育方式也在技术上得到了根本的改变,多媒体教学已经进入到每一个课堂,教师与老师的远程通信,也逐渐出现在我们的身边。为此随着计算机进入到机房,尤其是有关计算机方面的学院,我们迫切的需要计算机机房管理系统,来对机房,教师,学生,实验进行统一的管理。通过此系统,教
3、师可以高效的对学生信息,学生上机实验进行跟踪管理,省去大量的时间和精力。而且,计算机管理员使用此系统可以轻松的查询机房中机器的使用情况,统计计算机的使用寿命以及计算机运行是否良好。而我们也会通过努力,不断的探索,来完善内部的架构,使得系统层次分明,模块功能完整,从而加强整个系统的兼容性,安全性,可维护性和健壮性。1.2开发工具介绍本系统采用C#开发语言,C#是microsoft强力退出的新一代语言,它集合了java,VC的优势,成为了现在开发web和GUI信息管理系统的首选语言,C#采用了java的完全面向对象机制,方便开发者对现实世界进行抽象建模,。而C#和visio的结合更是珠联璧合,很多
4、系统代码可以自动生成,省去了大量的人力,时间。也提供了统一的验证模式,开发者只要调用验证的类,就可以轻松的进行各种数据的验证,其中包括邮箱格式,电话和时期的验证。而且VS2010提供了SQL Server2008数据库服务独特于其它的开发平台,在VS中可以直接运行数据库文件。使用SQL Server 2008数据库管理系统。本系统默认两个管理员Administrator和sa,对系统数据库和用户数据库惊醒管理。提供分析查询功能,可以在里边写SQl语法,创建存储过程,视图,表等。2系统需求分析本系统为中小型管理系统,主要功能是对计算机上机实验进行管理,包括老师对学生的上机管理,教师的基本信息资料
5、与学生的基本信息资料等,满足教师、计算机管理员的工作需要。学生只能通过登录客户端来访问服务器,获得服务器文件,等待机房管理通知等,系统与SQL Server相结合,实现教师,学生,机房电脑的大量数据存储。2.1系统任务概述机房管理系统可以运行在windows系统上,它的实现主要是帮助教师、机房管理员对实验进行合理的安排,并且本系统帮助教师与学生之间完成远程通信。本节主要论述了机房管理系统的运行时环境和需求分析2.1.1运行环境本系统属于中小型管理系统,硬件环境只需要128M内存空间。本系统主要运行在windows操作系统上,采用microsoft SQL Server数据库系统,运行在.NET
6、 Framework2.0-.NET Framework 4.0版语言包基础上。2.1.2系统功能系统工分为五大部分,本节之论述用户登录与注册,学生管理与实验安排,两部分。工列为4项来阐述。(1) 在服务器端,教师和机房管理员可以通过输入账号和密码,选择登录类型,进入到操作界面中。如果账号和密码输入有误,系统则提示报错信息。(2) 机房管理员可以对学生的资料包括学号姓名联系电话家庭住址进行修改,查询,删除等操作。(3) 机房管理员可以对学生实验进行查询等(4) 教师可以查询自己学生的信息,可以把一些学生的信息添加到自己的班级中,把一些学生删除自己的班级。2.2数据采集本系统主要收集关于机房、教
7、师、学生的数据。而且要对数据进行验证,通过规定用户的权限,使各个用户浏览相应的信息。2.2.1需要收集的数据机房的数据,包括机房电脑的存储容量,现在存储数量。学生的资料,包括学生的姓名,学号,地址,联系电话,专业,年级等。教师的资料,包括教师的姓名,联系电话,住址,所带的课程。2.2.2数据约束的条件 学生只能查新自己的基本资料,查询自己所选的实验课和自己教师的信息。机房管理员可以对本院所有实验课的教师进行查询,而且还可以查询所有学生的信息以及他们的实验安排。教师可以申请机房的使用权,可以查询自己所带实验课的学生的信息,可以给自己的班级安排实验。数据库设计本章对机房管理系统中的数据设计进行说明
8、。主要内容包括教师表,学生表,机房表,教师管理机房,学生机房安排表。在存储过程,数据字段的定义方面进行了详细的说明。(1)计算机机房管理系统中一个重要的实体是计算机。计算机的属性包括ID(用机房号加上此电脑存入机房的顺序来表示的)、存入的时间、存放的位置(行号和列好表示)、运行情况、外键机房号。(2)机房机房的主要属性是机房号,机房中计算机的存储容量,已经存入的计算机的数量,一个外键是机房管理员的ID号,记录机房由哪一个管路员来管理。机房号的格式为楼层号+机房在楼层中的顺序(如三楼第三个房间为303)。(3)教师表(4)学生表(5) 学生与机房关系表包括学生的学号,上机的星期,和上机的时间段,
9、上机的课程(6) 教师与机房的关系包括老师的编号,上机的星期,上机的时间段,上机的课程(7) 登录的用户表机房管理系统登录注册主界面查询选择天的课程查询学生信息并可以修改和删除查询老师信息并可以修改查询机房信息新增学生新增教师前台设计(1)登录页面登录页面:当姓名或者密码为空时检验,提示不能为空,当输入的用户名和密码与数据库中的内容不一致时提示用户名或者密码输入错误。using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;us
10、ing System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace ComputerRoomMangementpublicpartialclassLogin : Form public Login() InitializeComponent(); privatevoid button2_Click(object sender, EventArgs e) RegisteForm rForm = newRegisteForm(); rForm.login = this;
11、 rForm.ShowDialog(); publicvoid GetUserName(string name) txtName.Text = name; privatevoid button1_Click(object sender, EventArgs e) bool result = check();if (result = true) SqlConnection conn = newSqlConnection("Data Source=.;Initial Catalog=DB_ComputerManagement;User ID =sa;pwd=1");string
12、 sql = string.Format("select count(*) from TB_User where Username=0 and Password=1",txtName.Text.Trim(),txtPassword.Text.Trim();SqlCommand cmd = newSqlCommand(sql, conn); conn.Open();int count =cmd.ExecuteNonQuery();if (count > 0) else lbcheck.Visible = true; privatebool check() bool re
13、sult = true;if (txtName.Text.Trim() = string.Empty) lbNameError.Visible = true; result = false; else lbNameError.Visible = false; if (txtPassword.Text.Trim() = string.Empty) lbPasswordError.Visible = true; result = false; else lbPasswordError.Visible = false; return result; privatevoid Login_Load(ob
14、ject sender, EventArgs e) 注册页面首先检验用户名和密码和确认密码是否为空,为空的话提示不能为空,再检验输入的密码和确认密码是否一致,不一致的话提示出错。并当注册成功时把用户名自动填写到登录页面的用户上。点击取消时推出注册页面。using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Form
15、s;using System.Data.SqlClient;namespace ComputerRoomMangementpublicpartialclassRegisteForm : Form publicLogin login; public RegisteForm() InitializeComponent(); privatevoid RegisteForm_Load(object sender, EventArgs e) privatevoid btnRegister_Click(object sender, EventArgs e) bool result = checkError
16、();if (result = true) SqlConnection conn = newSqlConnection("Data Source.;Initial Catalog=DB_ComputerManagement;User ID=sa;pwd=1");string sql = string.Format("insert into FamilyUser values('0','1')", txtName.Text.Trim(), txtPassword.Text.Trim();SqlCommand cmd = ne
17、wSqlCommand(sql, conn); conn.Open();int count = cmd.ExecuteNonQuery(); conn.Close();if (count = 1) MessageBox.Show("成¨¦功|注Á¡é册¨¢了¢?一°?个?用®?户¡ì"); login.GetUserName(txtName.Text.Trim();this.Close(); privatebool checkError() bool re
18、sult = true; if (txtName.Text.Trim() = string.Empty) lblNameError.Visible = true; result = false; else lblNameError.Visible = false; if (txtPassword.Text.Trim() = string.Empty) lblPasError.Visible = true; result = false; else lblPasError.Visible = false; if (txtConfirmPassword.Text.Trim() = string.E
19、mpty) lblConError.Visible = true; result = false; else lblConError.Visible = false;if (txtPassword.Text.Trim() != txtConfirmPassword.Text.Trim() lblConError.Text = " 两次密码不一致?" lblConError.Visible = true; result = false; else lblConError.Visible = false; return result; privatevoid btnCancel
20、_Click(object sender, EventArgs e) this.Close(); 当注册成功时提示,并且登录页面自动添加注册的用户名主界面在主界面上添加日历。在资源管理器里右键引用主界面代码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.Data.Sql
21、Client;namespace ComputerRoomMangementpublicpartialclassMainForm : Form publicSelectCourseOfOneDay sele = newSelectCourseOfOneDay();public MainForm() InitializeComponent(); privatevoid MainForm_Load(object sender, EventArgs e) / TODO: 这a行D代䨲码?将?数ºy据Y加¨®载?到Ì?表
22、2;¨ª“¡ãdB_ComputerManagementDataSet.TB_Computer”¡À中D。¡ê您¨²可¨¦以°?根¨´据Y需¨¨要°a移°?动¡¥或¨°删¦?除y它¨¹。¡êthis.tB_ComputerTableAdapter.Fill(this.dB_ComputerManagementDataS
23、et.TB_Computer);/ TODO: 这a行D代䨲码?将?数ºy据Y加¨®载?到Ì?表À¨ª“¡ãdB_ComputerManagementDataSet.TB_Computer”¡À中D。¡ê您¨²可¨¦以°?根¨´据Y需¨¨要°a移°?动¡¥或¨°删¦?除y它&
24、#168;¹。¡êDataSet ds = this.dB_ComputerManagementDataSet.TB_Computer.DataSet;this.tB_ComputerTableAdapter.Fill(this.dB_ComputerManagementDataSet.TB_Computer); publicstaticstring weekstr;privatevoid monthCalendar1_DateChanged(object sender, DateRangeEventArgs e) richTextBox1.Text = mont
25、hCalendar1.SelectionRange.Start.ToShortDateString(); weekstr = monthCalendar1.SelectionRange.Start.DayOfWeek.ToString();switch (weekstr) case"Monday": weekstr = "星?期¨²一°?" break;case"Tuesday": weekstr = "星?期¨²二t" break;case"Wednes
26、day": weekstr = "星?期¨²三¨y" break;case"Thursday": weekstr = "星?期¨²四?" break;case"Friday": weekstr = "星?期¨²五?" break;case"Saturday": weekstr = "星?期¨²六¢¨´" break;case&q
27、uot;Sunday": weekstr = "星?期¨²日¨?" break; privatevoid timer1_Tick(object sender, EventArgs e) DateTime dt = DateTime.Now;string date = dt.ToLongDateString();string tine = dt.ToLongTimeString(); lblTime.Text = date + tine; privatevoid button1_Click(object sender, EventArg
28、s e) SelectCourseOfOneDay select = newSelectCourseOfOneDay(); select.Show(); privatevoid button2_Click(object sender, EventArgs e) SelectStuMessage stu = newSelectStuMessage(); stu.Show(); privatevoid button3_Click(object sender, EventArgs e) SelectTeaMessage teacher = newSelectTeaMessage(); teacher
29、.Show(); privatevoid 关?于®¨²ToolStripMenuItem_Click(object sender, EventArgs e) MessageBox.Show("韩?艳T超?制?作Á¡Â"); privatevoid button6_Click(object sender, EventArgs e) ComputerRoomMessage comRoom = newComputerRoomMessage(); comRoom.Show(); privatevoid button4_Cl
30、ick(object sender, EventArgs e) AddStudent addstu = newAddStudent(); addstu.Show(); privatevoid button5_Click(object sender, EventArgs e) AddTeacher addTeac = newAddTeacher(); addTeac.Show(); 点击查询选择天数的课程弹出窗口本窗口代码using System;using System.Collections.Generic;using System.ComponentModel;using System.D
31、ata;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace ComputerRoomMangementpublicpartialclassSelectCourseOfOneDay : Form public SelectCourseOfOneDay() InitializeComponent(); privatevoid SelectCourseOfOneDay_Load(object sender, E
32、ventArgs e) SqlConnection conn = newSqlConnection("Data Source=.;Initial Catalog=DB_ComputerManagement;User ID =sa;pwd=1");string sql = string.Format("select TB_StudentRoom.* ,Name from TB_StudentRoom ,TB_Teacher where TB_StudentRoom.sCourse=TB_Teacher.Course and TB_StudentRoom.sDay=&
33、#39;0'",MainForm.weekstr ); conn.Open();DataSet ds = newDataSet();SqlDataAdapter sda = newSqlDataAdapter(sql, conn); sda.Fill(ds, "s"); dataGridView1.DataSource = ds.Tables"s" conn.Close(); 点击查询学生信息弹出窗口选择一条信息底部窗口打开(或者点击打开进行展开)本窗口可以对学生信息进行修改和删除using System;using System.Co
34、llections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace ComputerRoomMangementpublicpartialclassSelectStuMessage : Form public SelectStuMessage() InitializeComponent(); pr
35、ivatevoid SelectStuMessage_Load(object sender, EventArgs e) setpnlBottomVisible(true);SqlConnection conn = newSqlConnection("Data Source=.;Initial Catalog=DB_ComputerManagement;User ID =sa;pwd=1");string sql = string.Format("select * from TB_Student"); conn.Open();DataSet ds = ne
36、wDataSet();SqlDataAdapter sda = newSqlDataAdapter(sql, conn); sda.Fill(ds, "s"); dataGridView1.DataSource = ds.Tables"s" conn.Close(); privatevoid button3_Click(object sender, EventArgs e) privatevoid setpnlBottomVisible(bool hide) if (hide=true) this.Size = newSize(this.Size.Wid
37、th, 330); pnlBottom.Visible = false;this.btnChange.Location = newPoint(this.btnChange.Location.X, this.btnChange.Location.Y - 125); btnChange.Text = "打䨰开a" else this.Size = newSize(this.Size.Width, 447); pnlBottom.Visible = true; pnlBottom.Enabled = true;this.btnChange.Loc
38、ation = newPoint(this.btnChange.Location.X, this.btnChange.Location.Y + 125); btnChange.Text = "关?闭À?" privatevoid btnChange_Click(object sender, EventArgs e) if (btnChange.Text = "打䨰开a") setpnlBottomVisible(false); else setpnlBottomVisible(true); privatevoi
39、d pnlBottom_Paint(object sender, PaintEventArgs e) privatevoid button2_Click(object sender, EventArgs e) SqlConnection conn = newSqlConnection("Data Source=.;Initial Catalog=DB_ComputerManagement;User ID=sa;pwd=1");string sql = string.Format("update TB_student set Name='0',Sex
40、='1',Tel='2',Asress='3',email='4',Grade='5',Class='6',Major='7' where num='8'",txtName.Text.Trim(),txtSex.Text.Trim(),txtTel.Text.Trim(),txtAddre.Text.Trim(),txtEmail.Text.Trim(),txtGride.Text.Trim(),txtCalss.Text.Trim(),txtMajor.T
41、ext.Trim(),txtId.Text.Trim();SqlCommand cmd = newSqlCommand(sql, conn); conn.Open();int rowCount = Convert.ToInt32(cmd.ExecuteNonQuery();if (rowCount > 0) MessageBox.Show("更¨¹新?成¨¦功|"); else MessageBox.Show("更¨¹新?失º¡ì败㨹&
42、quot;); conn.Close(); privatevoid dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) setpnlBottomVisible(false); btnModify.Enabled = true; txtId1.Text = dataGridView1.SelectedRows0.Cells0.Value.ToString(); txtName1.Text = dataGridView1.SelectedRows0.Cells1.Value.ToString(); txtSex1.
43、Text = dataGridView1.SelectedRows0.Cells2.Value.ToString(); txtTel1.Text = dataGridView1.SelectedRows0.Cells3.Value.ToString(); txtAddre1.Text = dataGridView1.SelectedRows0.Cells4.Value.ToString(); txtEmail1.Text = dataGridView1.SelectedRows0.Cells5.Value.ToString(); txtGride1.Text = dataGridView1.S
44、electedRows0.Cells6.Value.ToString(); txtCalss1.Text = dataGridView1.SelectedRows0.Cells7.Value.ToString(); txtMajor1.Text = dataGridView1.SelectedRows0.Cells8.Value.ToString(); privatevoid button2_Click_1(object sender, EventArgs e) SqlConnection conn = newSqlConnection("Data Source=.;Initial
45、Catalog=DB_ComputerManagement;User ID=sa;pwd=1");string sql = string.Format("delete from TB_Student where Num=0", txtId1.Text);SqlCommand cmd = newSqlCommand(sql, conn); conn.Open();int rowCount = Convert.ToInt32(cmd.ExecuteNonQuery();if (rowCount > 0) MessageBox.Show("删除成
46、8;功"); else MessageBox.Show("删除失败"); conn.Close(); 点击查询老师信息弹出窗口选择一条信息或者点击打开,打开底部窗口本窗口只可以对信息进行修改而不可以删除代码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
47、System.Data.SqlClient;namespace ComputerRoomMangementpublicpartialclassSelectTeaMessage : Form public SelectTeaMessage() InitializeComponent(); privatevoid SelectTeaMessage_Load(object sender, EventArgs e) setpnlBottomVisible(true);SqlConnection conn = newSqlConnection("Data Source=.;Initial Ca
48、talog=DB_ComputerManagement;User ID=sa;pwd=1");string sql = String.Format("select * from TB_Teacher"); conn.Open();DataSet ds = newDataSet();SqlDataAdapter sda = newSqlDataAdapter(sql, conn); sda.Fill(ds,"s"); dataGridView1.DataSource = ds.Tables"s" conn.Close(); p
49、rivatevoid setpnlBottomVisible(bool hide) if (hide = true) this.Size = newSize(this.Size.Width, 340); pnlBottom.Visible = false;this.btnChange.Location = newPoint(this.btnChange.Location.X, this.btnChange.Location.Y - 120); btnChange.Text = "打䨰开a" else this.Size = newSize(
50、this.Size.Width, 454); pnlBottom.Visible = true; pnlBottom.Enabled = true;this.btnChange.Location = newPoint(this.btnChange.Location.X, this.btnChange.Location.Y + 120); btnChange.Text = "关?闭À?" privatevoid btnChange_Click(object sender, EventArgs e) if (btnChange.Text = "打ä
51、¨°开a") setpnlBottomVisible(false); else setpnlBottomVisible(true); privatevoid btnModify_Click(object sender, EventArgs e) SqlConnection conn = newSqlConnection("Data Source=.;Initial Catalog=DB_ComputerManagement;User ID=sa;pwd=1");string sql = string.Format("update TB_Teacher set Name='0',Sex='1',Tel='2',Adre
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 电动汽车核心竞争力测试试题及答案
- 聚焦2025年:罕见病药物研发政策利好与产业发展前景分析报告
- 旅游口语复试题及答案解析
- 市政道路设计与施工试题及答案
- 能源与资源行业政策解读报告:新能源补贴政策与市场影响
- 游戏化学习试题及答案经验
- 持续提升土木考试试题及答案
- 无机化学与环境保护的关系试题及答案
- 新能源汽车制造产业布局下的充电设施建设与发展报告
- 物理实验基础与技能评估试题及答案
- 社会组织建设与人才队伍建设-宁夏课件
- NPT5空气压缩机检修
- Q∕SY 13123-2017 物资仓储技术规范
- 防洪度汛检查表
- 手术通知单模板
- GB∕T 26077-2021 金属材料 疲劳试验 轴向应变控制方法
- GB∕T 3853-2017 容积式压缩机 验收试验
- 招商合同范本4篇-合同范本
- 《二次函数图像与性质》学习评价量规
- 2019版人教版教材习题高中物理必修3
- 直肠类癌rectalcarcinoid课件
评论
0/150
提交评论