当前位置:文档之家› 高校学生宿舍信息管理系统

高校学生宿舍信息管理系统

高校学生宿舍管理系统课程设计*名:***学号:***********专业:08级信息管理与信息系统2班指导教师:***时间:2011年12月2日目录1 课程设计目的2 课程设计题目描述和要求3课程设计报告内容一、课程设计目的通过课程设计,使学生能够掌握C#语言的基本内容及程序设计的基本方法与编程技巧,使学生具有应用计算机解决实际问题的基本能力,培养学生掌握使用计算机处理问题的思维方法与途径, 培养良好的程序设计风格,使学生能够独立编制和调试各种结构的面向对象的C#语言程序。

初步掌握软件开发过程的问题分析、系统设计、程序编码、测试等基本方法和技能;提高综合运用所学的理论知识和方法独立分析和解决问题的能力。

完成所选设计题目,上机调试通过该程序系统所有功能;编写设计说明书,内容包括:课程设计的目的、意义;设计任务;总体设计方案;软件设计(各功能模块的流程图及详细的文字说明);软件系统的使用说明;收获、体会等。

二、课程设计题目描述和要求1、开发系统的功能介绍(1)系统管理窗体系统设置信息(2)资源管理窗体管理宿舍信息(3)学生管理窗体管理学生住宿信息。

(4)报修管理窗体管理宿舍维修信息。

(5)违规管理窗体管理违规学生信息三、课程设计报告内容操作流程用户—>注册—>登录—>操作界面—>系统管理->系统设置信息资源管理->管理宿舍信息学生管理->管理学生住宿信息报修管理—>管理宿舍维修信息违规管理—>管理违规学生信息管理违规学生信息(四)系统功能结构根据高校学生宿舍信息管理系统的特点,可将其分为:系统登录、系统注册用户,主界面、系统管理界面、资源管理界面、学生管理界面等。

(五)系统预览为了初步了解家庭理财系统,下面分别给出系统中的四个界面。

登录页面:注册页面:主窗体页面:学生信息登记界面:学生宿舍基本信息界面(六)构建开发环境:系统开发环境:Microsoft Visual Studio 2010集成开发环境。

系统开发语言:C#系统数据库:Microsoft Sqlserver2008开发运行环境:Windows XP、Vista、7系统服务运行环境: Framework 4.0.最佳效果:1024*768。

(七)数据库设计本系统采用Sqlserver2008数据库,名称为VirgoDB_StuInfo表:DB_DormInfo表:(九)公共类设计在开发过程中,经常会用到一些公共的模块,如数据库的连接及操作的类,字串的处理的类等,因此,在开发系统前,首先要设计这些公共模块,下面将介绍高校学生宿舍信息管理系统中所需要的数据库操作类,数据库操作类用来完成数据库的连接操作,以及数据库的查询,添加,删除修改操作,现将这几种操作编写到一个公共类里,可以减少代码的编写工作,有利于代码的维护。

代码如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using System.Data.SqlClient;using System.Windows.Forms;namespace VirgoMis{/// <summary>/// 此类维护数据库连接字符串和Connection对象/// </summary>class DBHelper{private static SqlCommand cmd = null;private static SqlDataReader dr = null;//数据库连接字符串//private static string connectionString = "Server = HUAIHUAI-8B2819; Database = Virgo; Integrated Security = SSPI";private static string connectionString = @"Data Source=.;AttachDbFilename=F:\学习\C#\网上下载\新建文件夹\\源程序代码\VirgoMis\Virgo.mdf;Integrated Security=True";//数据库连接Connection对象public static SqlConnection connection = new SqlConnection(connectionString);public DBHelper(){ }#region 返回结果集public static SqlDataReader GetResult(string sql){try{cmd = new SqlCommand();mandText = sql;cmd.Connection = connection;cmd.Connection.Open();dr = cmd.ExecuteReader();return dr;}catch (Exception ex){MessageBox.Show(ex.Message);return null;}finally{//dr.Close();//cmd.Connection.Close();}}#endregion#region 对Select语句,返回int型结果集public static int GetSqlResult(string sql) {try{cmd = new SqlCommand();mandText = sql;cmd.Connection = connection;cmd.Connection.Open();int a = (int)cmd.ExecuteScalar(); return a;}catch (Exception ex){MessageBox.Show(ex.Message);return -1;}finally{cmd.Connection.Close();}}#endregion#region 对Update,Insert和Delete语句,返回该命令所影响的行数public static int GetDsqlResult(string sql){try{cmd = new SqlCommand();mandText = sql;cmd.Connection = connection;cmd.Connection.Open();cmd.ExecuteNonQuery();return 1;}catch (Exception ex){MessageBox.Show(ex.Message);return -1;}finally{cmd.Connection.Close();}}#endregion}}(十)各界面代码及功能实现(1)登录界面:功能:登陆登陆界面代码:using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace VirgoMis{public partial class Login : Form{public Login(){InitializeComponent();}#region 验证用户的输入,成功返回true,失败返回falseprivate bool IsValidataInput(){if (txtLoginNo.Text.Trim() == ""){MessageBox.Show("请输入账号!","登陆提示",MessageBoxButtons.OK,rmation);txtLoginNo.Focus();return false;}else if (txtLoginPwd.Text == ""){MessageBox.Show("请输入密码!","登陆提示",MessageBoxButtons.OK,rmation);txtLoginPwd.Focus();return false;}else if (cboLoginType.Text == ""){MessageBox.Show("请选择登陆类型!","登陆提示",MessageBoxButtons.OK,rmation);cboLoginType.Focus();return false;}return true;}#endregion#region 验证用户是否合法//传递用户账号、密码、登陆类型,合法返回true,不合法返回false//message参数用来记录验证失败的原因private bool IsValidataUser(string loginNo, string loginPwd, string loginType, ref string message){string sql = String.Format("select count(*) from DB_ManageInfo where loginNo = '{0}' and loginPwd = '{1}' and loginType = '{2}'",loginNo,loginPwd,loginType);int a = DBHelper.GetSqlResult(sql);if (a < 1){message = "该用户名或密码不存在!";return false;}else{return true;}}#endregion//登陆事件private void btnLogin_Click(object sender, EventArgs e) {//标识是否为合法用户bool isValidUser = false;string message = "";if (IsValidataInput()){//验证用户是否为合法用户isValidUser = IsValidataUser(txtLoginNo.Text.Trim(),txtLoginPwd.Text,cboLoginTy pe.Text,ref message);if (isValidUser){//记录登陆用户名和用户类型UserHelper.loginName = txtLoginNo.Text.Trim();UserHelper.loginType = cboLoginType.Text;//登陆类型是楼管会if (cboLoginType.Text == "楼管会"){ }//登陆类型是维修部else if (cboLoginType.Text == "维修部"){ }//登陆类型是总务处else if (cboLoginType.Text == "总务处"){WFMain sfm = new WFMain();sfm.Show();this.Hide();}}else{MessageBox.Show(message,"登陆提示",MessageBoxButtons.OK,MessageBoxIcon.Asterisk);}}}private void btnCanel_Click(object sender, EventArgs e) {DialogResult result = MessageBox.Show("您确定要退出吗?", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);if (result == DialogResult.OK){Application.Exit();}}private void Login_Shown(object sender, EventArgs e) {//光标焦点默认在输入账号上txtLoginNo.Focus();}private void Login_Load(object sender, EventArgs e){}private void Login_FormClosed(object sender, FormClosedEventArgs e){Application.Exit();}}}(2)注册界面:功能:注册。

相关主题