当前位置:文档之家› 高校公寓管理系统

高校公寓管理系统

高校公寓管理系统《c#程序荣荣》荣程荣荣荣告荣目, 高校公寓管理系荣学生姓名,学号 ,荣荣班荣, 指荣荣,教二00一三年五月七日1目荣1.荣荣目的……………………………………………………教学22.荣荣荣目描述和要求………………………………………教学23.荣荣荣告容………………………………………………教学内23.1荣荣荣荣及荣荣描述 (3)3.2据字典……………………………………数53.3主口荣面荣荣……………………………窗64.考文..................................................................参献85.附件,程序主要源代荣 (92)1.荣荣目的教学荣荣生公寓管理系荣~主要包括基于据荣荣荣和前期的学数C#荣用程序荣荣方面两个~荣荣荣荣目~主要是荣了更好的用据荣荣荣的知荣和提高所荣程荣言荣荣能力。

个运数学2.荣荣荣目描述和要求教学荣荣荣目描述,在高校的生公寓管理中~由于荣招~高校的生人荣增~荣荣的学学数管理方式已荣不能适合高校宿舍管理的需要~因此需要一功能完善~操作方便的个公寓管理信息系荣。

而荣系荣荣荣包含生公寓管理的基本功能,生管理、公寓相荣工作学学管理等。

生公寓管理系荣是荣荣生公寓管理的荣化~逐步荣室管理的人工管理方学学网脱寝式~提高生公寓管理效率而荣荣的。

学要求,在据荣荣荣方面~数要求后台据荣的建立和荣荣据一致性和完整性强。

荣于数数前端荣用程序的荣荣~要求程序能提供强大的据操作功能~界面友好~使用荣荣等。

数3.荣荣荣告容教学内根据荣目的要求~荣系荣主要包括,住宿管理、荣人荣管理、自行荣管理、荣修管理等来功能。

整程序的荣荣~就按照荣管理功能展荣。

分荣荣荣荣些管理系荣~建立相荣的个几个来数据荣。

整荣荣方案如下荣所示,体3荣荣生信息学添加生信息学学生住宿管理修改生信息学来荣人荣管理高校公寓管理系荣自行荣管理荣修管理添加荣修信息3.1荣荣荣荣及荣荣描述本程序的荣荣是在win7荣境下荣行~本系荣后台据荣采用数Access~前台采用C#作荣主要荣荣工具。

采用ADO技荣荣接据荣~完成荣据荣的一系列操作。

数数荣上~按照如下步荣荣行程序荣荣,体1.用荣;管理荣,首先荣入自己的荣密荣。

荣和密荣荣荣正荣后~方可荣入系荣荣行号当号确操作。

2.用荣可在荣出的界面荣荣操作~可以荣行荣合荣荣。

内43.程序荣荣主要荣荣生信息和管理荣添加信息~荣修信息。

学4.在据荣中添加各荣信息。

数登荣荣和密荣,号生部分信学息,部分宿舍信息,部分宿舍楼,荣修信息,5本荣所建据荣的数E-R荣,姓名学号性荣3.2数据字典荣名数据荣名数据荣含荣数据荣明数据荣型StuNo学号生荣char(8)学号StuName学生姓名char(8)姓名学生Sex学生性荣char(2)性荣Address学生籍荣char(10)祖籍StuProfess学学生所荣荣char(20)荣荣学号生所在班荣荣StuClasschar(8)班荣入住RNo宿舍荣号char(6)宿舍号ROne等于StuName宿舍生信息学char(8)舍荣1RTwo等于StuName宿舍生信息学char(8)舍荣2RThree等于StuName宿舍生信息学char(8)舍荣3宿舍宿舍荣号RProfess宿舍生所荣荣学学等于StuProfesschar(20)荣荣RClass学号生所在班荣荣等于StuClasschar(8)班荣DorNo宿舍荣荣楼号int宿舍楼号DorAdminist宿舍管荣信息楼楼等于WorNochar(10)宿管荣荣成WorNo宿管荣号char(8)荣号WorName宿管姓名char(8)姓名3.3主口荣面窗荣荣性荣分荣宿管楼登荣信息荣荣荣果,在据荣中~荣数定了相荣荣几个管理的荣和密荣。

号管理荣管理荣荣号6登荣成功后的主界面, 可以荣荣荣修信息~会荣出如下界面,也可以修改生信息学,7可以增加生信息,学4.考文参献[1]荣荣煊、王珊.《据荣系荣荣》~高等数概教育出版社~1983.7.[2]金雪云、荣建荣、荣荣玲.《VC#2008程序荣荣程》~荣大出版社~教清学2011.9.[3]王瑞、于速、荣雨~《VC++据荣系荣荣荣完全手》~人民荣荣出版社~数册2006.3.8[4]荣、荣荣珊、催荣勤、培~《刘刘涛VC#程序荣荣荣目荣》~荣大出版社与践清学~2011.1.[5] 明黄.《Access信息管理系荣荣荣荣例荣航》~北京:人民荣荣出版社, 2005.[6] 庄士荣.《高等校生宿舍管理》~北京荣荣大出版社学学学, 1989.3附件,程序主要源代荣荣接据荣,数public class DBHelper{private static string connStr = @"DataSource=.\C:\Users\DELL\Desktop\宿舍.mdb";public static SqlConnection connection = new SqlConnection(connStr);// SqlConnection conn = newSqlConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\\Users\\DELL\\Desktop\\宿舍.mdbb");//荣接据荣数public DBHelper(){String strConnection ="Provider=Microsoft.Jet.OleDb.4.0;";//strConnection存放的是荣接据荣所需要的荣接字数符串,他指定了要使用的据提供数数者和要使用的据源.strConnection += @"Data Source=C:\Users\DELL\Desktop\宿舍.mdb";SqlConnection objConnection = new SqlConnection(strConnection);SqlConnection.Open();SqlConnection.Close();}登荣界面代荣:public partial class Form1 : Form{public Form1(){InitializeComponent();}生公寓管理学a=new 生公寓管理学();private void Form1_Load(object sender, EventArgs e){cboType.Items.Add("管理荣");cboType.SelectedIndex = 0;}9private void button2_Click(object sender, EventArgs e)//取消按荣{Application.Exit();}private void button1_Click(object sender, EventArgs e)//登荣按荣{String strConnection = "Provider=Microsoft.Jet.OleDb.4.0;"; strConnection += @"Data Source=C:\Users\DELL\Desktop\宿舍.mdb"; SqlConnection objConnection = new SqlConnection(strConnection); SqlConnection.Open();SqlConnection.Close();if (ValidateInput()){string message = ""; //荣用ValidateUser()方法判断用荣是否存在bool isUser = ValidateUser(txtLoginId.Text, txtLoginPwd.Text, cboType.Text, ref message);if (isUser){UserHelper.loginId = txtLoginId.Text.Trim();UserHelper.loginPassword = txtLoginPwd.Text.Trim(); // UserHelper.loginType="";this.Visible = false; //荣藏登荣口窗}else{MessageBox.Show(message);}}}private bool ValidateInput(){if (txtLoginId.Text == ""){MessageBox.Show("荣荣入登荣荣号,");txtLoginId.Focus();return false;}else if (txtLoginPwd.Text == ""){MessageBox.Show("荣荣入密荣,");txtLoginPwd.Focus();return false;}else10{return true;}}private bool ValidateUser(string loginId, string loginpwd, string type, ref string message){bool isUser = false;string sql = ""; // 根据用荣荣型定荣sql荣句if (cboType.Text == "管理荣"){sql = string.Format("select * from DormAdmin where LoginId='{0}' and LoginPwd='{1}'", txtLoginId.Text.Trim(), txtLoginPwd.Text.Trim());// if (UserHelper.loginId == "sa" && UserHelper.loginPassword == "sa")}String strConnection = "Provider=Microsoft.Jet.OleDb.4.0;"; strConnection +=@"Data Source=C:\Users\DELL\Desktop\宿舍.mdb";SqlConnection con=new SqlConnection(strConnection);SqlDataAdapter sda = new SqlDataAdapter(sql, con);DataSet ds = new DataSet();sda.Fill(ds, "DormAdmin");if (ds.Tables[0].Rows.Count == 0)MessageBox.Show("登荣失荣,", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);else{MessageBox.Show("登荣成功,", "提示", MessageBoxButtons.OK, rmation);//this.Show()a.Show();}con.Open();//SqlConnection f = new SqlConnection(sql,strConnection);return isUser;}private void FormsOpen(){if (cboType.Text.Trim() == "管理荣"){11生公寓管理学adminForm = new 生公寓管理学();adminForm.Show();}}private void cboType_KeyUp(object sender, KeyEventArgs e){if (e.KeyCode == Keys.Enter){if (ValidateInput()){string message = "";//荣用ValidateUser()方法判断用荣是否存在bool isUser = ValidateUser(txtLoginId.Text, txtLoginPwd.Text, cboType.Text, ref message);if (isUser){UserHelper.loginId = txtLoginId.Text.Trim();UserHelper.loginType = txtLoginPwd.Text.Trim();FormsOpen();this.Visible = false; //荣藏登荣口窗}else{MessageBox.Show(message);}}}}}}添加住宿生信息:public partial class AddStudentForm : Form{public AddStudentForm(){InitializeComponent();}private void button2_Click(object sender, EventArgs e){this.Close();}private void AddStudentForm_Load(object sender, EventArgs e)12{GetMajorId(); //向荣荣荣荣合中荣入据号框数GetClassId(); //向班荣荣荣合中荣入据号框数GetDormId(); //向宿舍荣荣合中荣入据号框数GetDormitoryId(); //向房荣荣荣合中荣入据号框数GetDormAdminId(); ////向宿管荣荣荣合中荣入据号框数}private bool isInput(string stuName, string stuNo, string age, string address, refstring message){if (stuName == ""){message = "荣荣入生姓名学,"; return false;}else if (stuNo == ""){message = "荣荣入学号,"; return false;}else if (age == ""){message = "荣荣入年荣,"; return false;}else if (address == ""){message = "荣荣入地址,"; return false;}else{return true;}}}}修改住宿生信息:private void AmendStuForm_Load(object sender, EventArgs e) {//荣用荣合框数得到据的方法GetClassId();GetMajorId();GetDormId();GetTeacherId();13GetDormitoryId();GetDormAdminId();InitialAmendForm(); //荣用初始化修改窗口的方法}private void InitialAmendForm(){string stuName = "";string sex = "";int age = 0;string address = "";int majorId = 0;int classId = 0;string teacherId = "";string dormAdminId = "";int dormId = 0;int dormitoryId = 0;string phonNum = "";string Email = "";string sql = string.Format("select * from Student where StuNo='{0}'", this.stuNo);SqlCommand command = new SqlCommand(sql, DBHelper.connection);try{if (DBHelper.connection.State == ConnectionState.Closed){DBHelper.connection.Open();}SqlDataReader dataReader = command.ExecuteReader();if (dataReader.Read()){//stuNo = (string)dataReader["StuNo"];stuName = (string)dataReader["StuName"];sex = (string)dataReader["Sex"];age = (int)dataReader["Age"];address = (string)dataReader["Address"];majorId = (int)dataReader["MajorId"];classId = (int)dataReader["ClassId"];teacherId = (string)dataReader["TeacherId"]; dormAdminId = (string)dataReader["DormAdminId"]; dormId = (int)dataReader["DormId"];dormitoryId = (int)dataReader["DormitoryId"]; phonNum = (string)dataReader["PhonNum"];Email = (string)dataReader["Email"];txtStuNo.Text = this.stuNo;14txtStuName.Text = stuName;//荣荣性荣if (sex == "男"){rdoMale.Checked = true;}else{rdoFemale.Checked = true;}txtAge.Text = age.ToString();//txtAddress.Text = address;//txtPhon.Text = phonNum;cboMajorId.Text = majorId.ToString();cboClassId.Text = classId.ToString();//cboTeacherId.Text = teacherId.ToString();//cboDormAdminId.Text = dormAdminId;cboDormitoryId.Text = dormitoryId.ToString();cboDormId.Text = dormId.ToString();//txtEmail.Text = Email;}}catch (Exception ex){MessageBox.Show(ex.Message);}finally{DBHelper.connection.Close();}}//保存修改按荣private void btnSave_Click(object sender, EventArgs e){DialogResult result = MessageBox.Show("定要修改荣您确,", "修改提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);if (result == DialogResult.OK){//得到修改后的据数string stuNo = txtStuNo.Text.Trim();string stuName = txtStuName.Text;string sex = rdoMale.Checked ? rdoMale.Text.Trim() :rdoFemale.Text.Trim();string age = txtAge.Text.Trim();string majorId = cboMajorId.Text.Trim();15string classId = cboClassId.Text.Trim();string dormId = cboDormId.Text.Trim();string dormitoryId = cboDormitoryId.Text.Trim();int count = 0;string sql = string.Format("update Student setStuName='{0}',Sex='{1}',Age={2},Address='{3}',MajorId={4},ClassId={5 },TeacherId='{6}',DormAdminId='{7}',DormId={8},DormitoryId={9},PhonNum=' {10}',Email='{11}' where StuNo='{12}'", stuName, sex, age, majorId, classId, dormId, dormitoryId, this.stuNo);SqlCommand command = new SqlCommand(sql, DBHelper.connection);try{if (DBHelper.connection.State == ConnectionState.Closed){DBHelper.connection.Open();}count = command.ExecuteNonQuery(); //返回受影响数的行}catch (Exception ex){MessageBox.Show(ex.Message);}finally{DBHelper.connection.Close();}if (count != 1){MessageBox.Show("修改失荣,", "修改提示", MessageBoxButtons.OK, rmation);}else{MessageBox.Show("修改成功, ", "修改提示", MessageBoxButtons.OK, rmation);}}}/// <summary>/// 得到荣荣荣合的荣荣荣据列框号数/// </summary>private void GetMajorId()16{string sql = "select MajorId from Major";SqlCommand command = new SqlCommand(sql, DBHelper.connection); try{if (DBHelper.connection.State == ConnectionState.Closed){DBHelper.connection.Open();}SqlDataReader dataReader = command.ExecuteReader();while (dataReader.Read()){cboMajorId.Items.Add(dataReader["MajorId"]);}dataReader.Close();}catch (Exception ex){MessageBox.Show(ex.Message);}finally{DBHelper.connection.Close();}}private void GetClassId(){string sql = "select ClassId from Class";SqlCommand command = new SqlCommand(sql, DBHelper.connection); try{if (DBHelper.connection.State == ConnectionState.Closed){DBHelper.connection.Open();}SqlDataReader dataReader = command.ExecuteReader();while (dataReader.Read()){cboClassId.Items.Add(dataReader["ClassId"]);}dataReader.Close();}catch (Exception ex){MessageBox.Show(ex.Message);}finally{17DBHelper.connection.Close();}}private void GetTeacherId(){string sql = "select TeacherId from Teacher";SqlCommand command = new SqlCommand(sql, DBHelper.connection); try{if (DBHelper.connection.State == ConnectionState.Closed){DBHelper.connection.Open();}SqlDataReader dataReader = command.ExecuteReader();while (dataReader.Read()){cboTeacherId.Items.Add(dataReader["TeacherId"]);}dataReader.Close();}catch (Exception ex){MessageBox.Show(ex.Message);}finally{DBHelper.connection.Close();}}private void GetDormId(){string sql = "select DormId from Dorm";SqlCommand command = new SqlCommand(sql, DBHelper.connection); try{if (DBHelper.connection.State == ConnectionState.Closed){DBHelper.connection.Open();}SqlDataReader dataReader = command.ExecuteReader();if (dataReader.HasRows){while (dataReader.Read()){string dormId = dataReader["DormId"].ToString();cboDormId.Items.Add(dormId);}dataReader.Close();18}}catch (Exception ex){MessageBox.Show(ex.Message);}finally{DBHelper.connection.Close();}cboDormId.SelectedIndex = 0;}/// <summary>/// 得到房荣荣合的框号数房荣荣据列/// </summary>private void GetDormitoryId(){int floor1RoomNum = 100; //一楼号从房荣100荣始~分荣是,100 101 102 103 。

相关主题