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

上传人:b****2 文档编号:2863226 上传时间:2023-05-04 格式:DOCX 页数:43 大小:166.43KB
下载 相关 举报
#高校学生宿舍信息管理系统.docx_第1页
第1页 / 共43页
#高校学生宿舍信息管理系统.docx_第2页
第2页 / 共43页
#高校学生宿舍信息管理系统.docx_第3页
第3页 / 共43页
#高校学生宿舍信息管理系统.docx_第4页
第4页 / 共43页
#高校学生宿舍信息管理系统.docx_第5页
第5页 / 共43页
#高校学生宿舍信息管理系统.docx_第6页
第6页 / 共43页
#高校学生宿舍信息管理系统.docx_第7页
第7页 / 共43页
#高校学生宿舍信息管理系统.docx_第8页
第8页 / 共43页
#高校学生宿舍信息管理系统.docx_第9页
第9页 / 共43页
#高校学生宿舍信息管理系统.docx_第10页
第10页 / 共43页
#高校学生宿舍信息管理系统.docx_第11页
第11页 / 共43页
#高校学生宿舍信息管理系统.docx_第12页
第12页 / 共43页
#高校学生宿舍信息管理系统.docx_第13页
第13页 / 共43页
#高校学生宿舍信息管理系统.docx_第14页
第14页 / 共43页
#高校学生宿舍信息管理系统.docx_第15页
第15页 / 共43页
#高校学生宿舍信息管理系统.docx_第16页
第16页 / 共43页
#高校学生宿舍信息管理系统.docx_第17页
第17页 / 共43页
#高校学生宿舍信息管理系统.docx_第18页
第18页 / 共43页
#高校学生宿舍信息管理系统.docx_第19页
第19页 / 共43页
#高校学生宿舍信息管理系统.docx_第20页
第20页 / 共43页
亲,该文档总共43页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

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

《#高校学生宿舍信息管理系统.docx》由会员分享,可在线阅读,更多相关《#高校学生宿舍信息管理系统.docx(43页珍藏版)》请在冰点文库上搜索。

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

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

高校学生宿舍管理系统

姓名:

毛显淇

学号:

20080702208

专业:

08级信息管理与信息系统2班

指导教师:

张旭东

时间:

2011年12月2日

1课程设计目的

2课程设计题目描述和要求

3课程设计报告内容

一、课程设计目的

通过课程设计,使学生能够掌握C#语言的基本内容及程序设计的基本方法与编程技巧,使学生具有应用计算机解决实际问题的基本能力,培养学生掌握使用计算机处理问题的思维方法与途径,培养良好的程序设计风格,使学生能够独立编制和调试各种结构的面向对象的C#语言程序。

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

完成所选设计题目,上机调试通过该程序系统所有功能;编写设计说明书,内容包括:

课程设计的目的、意义;设计任务;总体设计方案;软件设计(各功能模块的流程图及详细的文字说明);软件系统的使用说明;收获、体会等。

二、课程设计题目描述和要求

1、开发系统的功能介绍

(1)系统管理窗体

系统设置信息

(2)资源管理窗体

管理宿舍信息

(3)学生管理窗体

管理学生住宿信息。

(4)报修管理窗体

管理宿舍维修信息。

(5)违规管理窗体

管理违规学生信息

三、课程设计报告内容

操作流程

用户—>注册—>登录—>操作界面—>系统管理->系统设置信息资源管理->管理宿舍信息

学生管理->管理学生住宿信息

报修管理—>管理宿舍维修信息

违规管理—>管理违规学生信息

管理违规学生信息

(四)系统功能结构

根据高校学生宿舍信息管理系统的特点,可将其分为:

系统登录、系统注册用户,主界面、系统管理界面、资源管理界面、学生管理界面等。

(五)系统预览

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

登录页面:

注册页面:

主窗体页面:

学生信息登记界面:

学生宿舍基本信息界面

(六)构建开发环境:

系统开发环境:

MicrosoftVisualStudio2010集成开发环境。

系统开发语言:

C#

系统数据库:

MicrosoftSqlserver2008

开发运行环境:

WindowsXP、Vista、7

系统服务运行环境:

MFramework4.0.

最佳效果:

1024*768。

(七)数据库设计

本系统采用Sqlserver2008数据库,名称为VirgoDB_StuInfo表:

DB_DormInfo表:

(九)公共类设计

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

代码如下:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Data;

usingSystem.Data.SqlClient;

usingSystem.Windows.Forms;

namespaceVirgoMis

{

///

///此类维护数据库连接字符串和Connection对象

///

classDBHelper

{

privatestaticSqlCommandcmd=null;

privatestaticSqlDataReaderdr=null;

//数据库连接字符串

//privatestaticstringconnectionString="Server=HUAIHUAI-8B2819;Database=Virgo;IntegratedSecurity=SSPI";

privatestaticstringconnectionString=@"DataSource=.;AttachDbFilename=F:

\学习\C#\网上下载\新建文件夹\\源程序代码\VirgoMis\Virgo.mdf;IntegratedSecurity=True";

//数据库连接Connection对象

publicstaticSqlConnectionconnection=newSqlConnection(connectionString);

publicDBHelper()

{}

#region返回结果集

publicstaticSqlDataReaderGetResult(stringsql)

{

try

{

cmd=newSqlCommand();

cmd.CommandText=sql;

cmd.Connection=connection;

cmd.Connection.Open();

dr=cmd.ExecuteReader();

returndr;

}

catch(Exceptionex)

{

MessageBox.Show(ex.Message);

returnnull;

}

finally

{

//dr.Close();

//cmd.Connection.Close();

}

}

#endregion

#region对Select语句,返回int型结果集

publicstaticintGetSqlResult(stringsql)

{

try

{

cmd=newSqlCommand();

cmd.CommandText=sql;

cmd.Connection=connection;

cmd.Connection.Open();

inta=(int)cmd.ExecuteScalar();

returna;

}

catch(Exceptionex)

{

MessageBox.Show(ex.Message);

return-1;

}

finally

{

cmd.Connection.Close();

}

}

#endregion

#region对Update,Insert和Delete语句,返回该命令所影响的行数

publicstaticintGetDsqlResult(stringsql)

{

try

{

cmd=newSqlCommand();

cmd.CommandText=sql;

cmd.Connection=connection;

cmd.Connection.Open();

cmd.ExecuteNonQuery();

return1;

}

catch(Exceptionex)

{

MessageBox.Show(ex.Message);

return-1;

}

finally

{

cmd.Connection.Close();

}

}

#endregion

}

}

(十)各界面代码及功能实现

(1)登录界面:

功能:

登陆

登陆界面代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

namespaceVirgoMis

{

publicpartialclassLogin:

Form

{

publicLogin()

{

InitializeComponent();

}

#region验证用户的输入,成功返回true,失败返回false

privateboolIsValidataInput()

{

if(txtLoginNo.Text.Trim()=="")

{

MessageBox.Show("请输入账号!

","登陆提示",MessageBoxButtons.OK,MessageBoxIcon.Information);

txtLoginNo.Focus();

returnfalse;

}

elseif(txtLoginPwd.Text=="")

{

MessageBox.Show("请输入密码!

","登陆提示",MessageBoxButtons.OK,MessageBoxIcon.Information);

txtLoginPwd.Focus();

returnfalse;

}

elseif(cboLoginType.Text=="")

{

MessageBox.Show("请选择登陆类型!

","登陆提示",MessageBoxButtons.OK,MessageBoxIcon.Information);

cboLoginType.Focus();

returnfalse;

}

returntrue;

}

#endregion

#region验证用户是否合法

//传递用户账号、密码、登陆类型,合法返回true,不合法返回false

//message参数用来记录验证失败的原因

privateboolIsValidataUser(stringloginNo,stringloginPwd,stringloginType,refstringmessage)

{

stringsql=String.Format("selectcount(*)fromDB_ManageInfowhereloginNo='{0}'andloginPwd='{1}'andloginType='{2}'",loginNo,loginPwd,loginType);

inta=DBHelper.GetSqlResult(sql);

if(a<1)

{

message="该用户名或密码不存在!

";

returnfalse;

}

else

{

returntrue;

}

}

#endregion

//登陆事件

privatevoidbtnLogin_Click(objectsender,EventArgse)

{

//标识是否为合法用户

boolisValidUser=false;

stringmessage="";

if(IsValidataInput())

{

//验证用户是否为合法用户

isValidUser=IsValidataUser(txtLoginNo.Text.Trim(),txtLoginPwd.Text,cboLoginType.Text,refmessage);

if(isValidUser)

{

//记录登陆用户名和用户类型

UserHelper.loginName=txtLoginNo.Text.Trim();

UserHelper.loginType=cboLoginType.Text;

//登陆类型是楼管会

if(cboLoginType.Text=="楼管会")

{}

//登陆类型是维修部

elseif(cboLoginType.Text=="维修部")

{}

//登陆类型是总务处

elseif(cboLoginType.Text=="总务处")

{

WFMainsfm=newWFMain();

sfm.Show();

this.Hide();

}

}

else

{

MessageBox.Show(message,"登陆提示",MessageBoxButtons.OK,MessageBoxIcon.Asterisk);

}

}

}

privatevoidbtnCanel_Click(objectsender,EventArgse)

{

DialogResultresult=MessageBox.Show("您确定要退出吗?

","操作提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Question);

if(result==DialogResult.OK)

{

Application.Exit();

}

}

privatevoidLogin_Shown(objectsender,EventArgse)

{

//光标焦点默认在输入账号上

txtLoginNo.Focus();

}

privatevoidLogin_Load(objectsender,EventArgse)

{

}

privatevoidLogin_FormClosed(objectsender,FormClosedEventArgse)

{

Application.Exit();

}

}

}

(2)注册界面:

功能:

注册。

代码如下:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

namespaceVirgoMis

{

publicpartialclassMRegister:

Form

{

publicMRegister()

{

InitializeComponent();

}

privatevoidWFRegison_Load(objectsender,EventArgse)

{

txtLoginNo.Focus();

}

#region判断是否为有效输入

privateboolIsValidataInput()

{

if(txtLoginNo.Text.Trim()=="")

{

MessageBox.Show("请输入账号!

","注册提示",MessageBoxButtons.OK,MessageBoxIcon.Information);

txtLoginNo.Focus();

returnfalse;

}

elseif(txtLoginPwd.Text=="")

{

MessageBox.Show("请输入密码!

","注册提示",MessageBoxButtons.OK,MessageBoxIcon.Information);

txtLoginPwd.Focus();

returnfalse;

}

elseif(DtxtLoginPwd.Text=="")

{

MessageBox.Show("请再次确认输入密码!

","注册提示",MessageBoxButtons.OK,MessageBoxIcon.Information);

DtxtLoginPwd.Focus();

returnfalse;

}

elseif(!

txtLoginPwd.Text.Equals(DtxtLoginPwd.Text))

{

MessageBox.Show("两次输入的密码不一致,请重新输入!

","注册提示",MessageBoxButtons.OK,MessageBoxIcon.Information);

DtxtLoginPwd.Clear();

txtLoginPwd.Clear();

txtLoginPwd.Focus();

returnfalse;

}

elseif(cboLoginType.Text=="")

{

MessageBox.Show("请选择登陆类型!

","注册提示",MessageBoxButtons.OK,MessageBoxIcon.Information);

cboLoginType.Focus();

returnfalse;

}

returntrue;

}

#endregion

privateboolIsValidataUser(stringloginNo,stringloginPwd,stringloginType,refstringmessage)

{

stringsql=String.Format("selectcount(*)fromDB_ManageInfowhereloginNo='{0}'andloginType='{1}'",loginNo,loginType);

intcount=DBHelper.GetSqlResult(sql);

if(count==1)

{

message="该账号已经存在,请重新注册!

";

returnfalse;

}

else

{

returntrue;

}

}

privatevoidbtnEnter_Click(objectsender,EventArgse)

{

boolisValidUser=false;

stringmessage="";

if(IsValidataInput())

{

//验证用户是否为合法用户

isValidUser=IsValidataUser(txtLoginNo.Text.Trim(),txtLoginPwd.Text,cboLoginType.Text,refmessage);

if(isValidUser)

{

stringsql=String.Format("insertintoDB_ManageInfo(loginNo,loginPwd,loginType)values('{0}','{1}','{2}')",txtLoginNo.Text.Trim(),txtLoginPwd.Text,cboLoginType.Text);

intresult=DBHelper.GetDsqlResult(sql);

if(result==1)

{

MessageBox.Show("注册成功!

","注册提示",MessageBoxButtons.OK,MessageBoxIcon.Asterisk);

}

else

{

MessageBox.Show("注册失败!

","注册提示",MessageBoxButtons.OK,MessageBoxIcon.Asterisk);

}

}

else

{

MessageBox.Show(message,"注册提示",MessageBoxButtons.OK,MessageBoxIcon.Asterisk);

}

txtLoginNo.Clear();

txtLoginPwd.Clear();

DtxtLoginPwd.Clear();

cboLoginType.SelectedIndex=-1;

txtLoginNo.Focus();

}

}

privatevoidbtnExit_Click(objectsender,EventArgse)

{

this.Close();

}

privatevoidbtnCanel_Click(objectsender,EventArgse)

{

this.Close();

}

}

}

(3)主界面:

功能:

数据的显示,操作,各窗口跳转。

代码如下:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

namespaceVirgoMis

{

publicpartialclassWFMain:

Form

{

publicWFMain()

{

InitializeComponent();

}

privateTOpenUniqueMDIChildWindow(FormmdiParent)whereT:

Form,new()

{

foreach(FormsubForminmdiParent.MdiChildren)

{

if(!

subForm.GetType().Equals(typeof(T)))

{

subForm.Close();

}

else

{

subForm.Activate();

returnsubFormasT;

}

}

TnewForm=newT();

newForm.MdiParent=mdiParent;

//newForm.FormBorderStyle=FormBorderStyle.None;

//newForm.WindowState=FormWindowState.Maximized;

//newForm.MaximizeBox=false;

//newForm.MinimizeBox=false;

newForm.StartPosition=FormStartPosition.CenterScreen;

newForm.Show();

returnnewForm;

}

privatevoidWFManage_Load(objectsender,E

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 初中教育 > 语文

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2