简介
功能
1.发布公告
2.地理信息与天气信息的弹窗
3.学生信息的增删改查
4.宿舍信息的增删改查
5.管理员信息的增删改查
6.学生对宿舍物品的报修与核实
7.学生提交请假与销假
8.管理员对保修的审批
9.管理员对请假的审批
技术
1.采用C#\Winform开发的C\S系统
2.采用MD5对数据加密
3.数据库选用SQLServer
4.用户信息采用Xml来记录
5.界面使用了CSkin进行美化
6.使用了WebService获取地理位置信息与天气信息
一、需求分析:
1、功能性需求:是为了完成宿舍信息管理系统以及向其用户提供有用的功能所 需执行的动作,需要与用户进行沟通交流,核实用户需求。从软件帮助用户完成所需要的行为。2非功能性需求:作为对功能性的补充主要包括软件使用时对性能使用方面的需求,运行环境的需求。软件设计必须遵循相关标准、规范、用户界面设计的具体细节、未来可能的扩充方案等。
二、主要功能描述:
在用户登录系统,输入正确的用户名及密码,如果正确进入程序,如果输入用户名或密码错误将弹出友好界面提示。选择进入的界面学员查询自己的宿舍信息。修改密码、提交报修、申请离宿、报修成功、确认归宿、接收通知功能。宿管包括发布通知、宿舍学员的增删改查、管理报修、管理离宿情况。
三、概要设计
四、数据库设计
1.登陆表
2.成绩表
五、详细设计
六、关键技术
SQL server数据库管理系统、窗体、Windows XP环境
连接数据库:static SqlConnection conn = new SqlConnection(@"Data Source=507-59;AttachDbFilename=F:\软件开发实训\WTS\WTS\school.mdf;Integrated Security=True");
登录窗口的确定:DataSet ds = DBHelper.readDB("select * from customer where name ='" + name + "' and password='" + password + "'");
读数据库:DataSet ds = DBHelper.readDB("select * from student");
数据的删除:"delete student where no=" + no + ""
数据的修改:"update student set name='" + name + "',chinese='" + chinese + "',math='" + math + "',english='" + english + "'where no=" + no + ""
数据的增加:"insert into student values(" + no + ",'" + name + "'," + chinese + "," + math + "," + english + ")"
数据的统计:"select no,name,chinese,math,english,chinese+math+english as 总分 from student"
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;namespace 宿舍管理系统
{static class Program{/// <summary>/// 应用程序的主入口点。/// </summary>[STAThread]static void Main(){Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Application.Run(new WFLogin());}}
}
SutdentManager.cs
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 CCWin;
using Tools;
using System.Xml;
using System.IO;namespace 宿舍管理系统
{public partial class StudentManager : Skin_Mac{#region 字段属性private WFLogin Fm;//登陆的窗体public int Sno { get; set; }//自己的学号private bool isHide = true;//标记是否隐藏通知private bool isChecked = false;//标记报修是否选择其他private string Pwd;//登录的密码public int Dormitoryno { get; set; }//此学生的宿舍号private DataSet dataset;//用于数据比对#endregion/// <summary>/// 构造函数/// </summary>/// <param name="fm">登陆窗体</param>/// <param name="sno">学号</param>/// <param name="pwd">密码</param>public StudentManager(WFLogin fm,string sno,string pwd){this.Fm = fm;this.Sno = Convert.ToInt32(sno);this.Pwd = pwd;InitializeComponent();}/// <summary>/// 窗体加载事件/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void StudentManager_Load(object sender, EventArgs e){//操作我的信息DataSet ds = DBHelper.Select("select * from StudentInfo where sno='"+Sno+"'");this.skinDataGridView1.DataSource = ds.Tables[0].DefaultView;//将宿舍号记录并赋值Dormitoryno = Convert.ToInt32(skinDataGridView1.Rows[0].Cells[0].Value.ToString().Trim());this.skinDataGridView1.Columns[0].HeaderText = "宿舍号";this.skinDataGridView1.Columns[1].HeaderText = "学号";this.skinDataGridView1.Columns[2].HeaderText = "姓名";this.skinDataGridView1.Columns[3].HeaderText = "性别";this.skinDataGridView1.Columns[4].HeaderText = "床铺号";this.skinDataGridView1.Columns[5].HeaderText = "入住时间";this.skinDataGridView1.Columns[0].Width = 83;this.skinDataGridView1.Columns[1].Width = 83;this.skinDataGridView1.Columns[2].Width = 83;this.skinDataGridView1.Columns[3].Width = 83;this.skinDataGridView1.Columns[4].Width = 83;this.skinDataGridView1.Columns[5].Width = 83;this.skinDataGridView1.Enabled = false;//操作宿舍舍友信息 根据宿舍号&性别进行查询DataSet ds2 = DBHelper.Select("select * from StudentInfo where dormitoryno='"+ Dormitoryno + "' and sgender='"+ skinDataGridView1.Rows[0].Cells[3].Value.ToString().Trim() + "'");this.skinDataGridView2.DataSource = ds2.Tables[0].DefaultView;//设置datagridview2样式this.skinDataGridView2.Columns[0].HeaderText = "宿舍号";this.skinDataGridView2.Columns[1].HeaderText = "学号";this.skinDataGridView2.Columns[2].HeaderText = "姓名";this.skinDataGridView2.Columns[3].HeaderText = "性别";this.skinDataGridView2.Columns[4].HeaderText = "床铺号";this.skinDataGridView2.Columns[5].HeaderText = "入住时间";this.skinDataGridView2.Columns[0].Width = 84;this.skinDataGridView2.Columns[1].Width = 84;this.skinDataGridView2.Columns[2].Width = 84;this.skinDataGridView2.Columns[3].Width = 84;this.skinDataGridView2.Columns[4].Width = 84;this.skinDataGridView2.Columns[5].Width = 84;#region 通知栏代码XmlDocument doc = new XmlDocument();doc.Load("事物表.xml");XmlElement Users = doc.DocumentElement;XmlNode xnl = Users.SelectSingleNode("/Users/manager[@no='1234']");this.label1.Text = xnl.InnerText;#endregiondataset = DBHelper.Select("select * from DormSum where dormitoryno='" + Dormitoryno + "'");this.Text += this.skinDataGridView1.Rows[0].Cells[2].Value.ToString();this.skinTabControl1.SelectedIndex = 0;}#region 事件//不让datagridview被选中的代码private void skinDataGridView1_SelectionChanged(object sender, EventArgs e){this.skinDataGridView1.ClearSelection();}//通知按钮private void btnUpOrDown_Click(object sender, EventArgs e){if (isHide){skinGroupBox1.Hide();btnUpOrDown.Text = "查看通知";}else if (!isHide){skinGroupBox1.Show();btnUpOrDown.Text = "我知道了";}isHide = !isHide;}//控制报修 其他内容的代码private void skinCheckBox8_CheckedChanged(object sender, EventArgs e){isChecked = !isChecked;if (isChecked){txtAreaQue.Enabled = true;}else{txtAreaQue.Enabled = false;}}//关闭窗口时关闭程序private void StudentManager_FormClosed(object sender, FormClosedEventArgs e){Fm.Close();}//提交报修的方法private void btnSubmit_Click(object sender, EventArgs e){//如果任何项都没有选择,就返回if (cb1.Checked == false && cb2.Checked == false && cb3.Checked == false && cb4.Checked == false && cb5.Checked == false && cb6.Checked == false && cb7.Checked == false && cb8.Checked == false){MessageBoxEx.Show("选择您要修理的项!");return;}dataset = DBHelper.Select("select * from DormSum where dormitoryno='" + Dormitoryno + "'");if (dataset.Tables[0].Rows[0][4].ToString() == "无修理项"){string fixItem = "";string things = "";fixItem += cb1.Checked ? cb1.Text + " " : "";fixItem += cb2.Checked ? cb2.Text + " " : "";fixItem += cb3.Checked ? cb3.Text + " " : "";fixItem += cb4.Checked ? cb4.Text + " " : "";fixItem += cb5.Checked ? cb5.Text + " " : "";fixItem += cb6.Checked ? cb6.Text + " " : "";fixItem += cb7.Checked ? cb7.Text : "";if (cb8.Checked == true){things = txtAreaQue.Text.Trim();}if (DBHelper.Update("update DormSum set isfix='已提交',fixItem='" + fixItem+ "',things='" + things + "' where dormitoryno='" + Dormitoryno + "'")){MessageBoxEx.Show("提交成功!");#region 重置按钮cb1.Checked = false;cb2.Checked = false;cb3.Checked = false;cb4.Checked = false;cb5.Checked = false;cb6.Checked = false;cb7.Checked = false;cb8.Checked = false;txtAreaQue.Text = "请填写您的问题。。。";#endregion}}else if (dataset.Tables[0].Rows[0][4].ToString() == "已提交" || dataset.Tables[0].Rows[0][4].ToString() == "维修中"){MessageBoxEx.Show("您的宿舍已经提交了请求,请等待。。");}else{MessageBoxEx.Show("发生未知错误!");}}//重置按钮private void btnReset_Click(object sender, EventArgs e){cb1.Checked = false;cb2.Checked = false;cb3.Checked = false;cb4.Checked = false;cb5.Checked = false;cb6.Checked = false;cb7.Checked = false;cb8.Checked = false;txtAreaQue.Text = "请填写您的问题。。。";}//退出按钮private void 退出ToolStripMenuItem_Click(object sender, EventArgs e){this.Close();}//注销按钮private void 注销ToolStripMenuItem_Click(object sender, EventArgs e){Fm.ReLogin();Fm.Show();this.Dispose();}private void 更改密码ToolStripMenuItem_Click(object sender, EventArgs e){new UpdataPwd(Sno, Pwd, "student").ShowDialog();}private void btnFix_Click(object sender, EventArgs e){dataset = DBHelper.Select("select * from DormSum where dormitoryno='" + Dormitoryno + "'");if (dataset.Tables[0].Rows[0][4].ToString() == "否"){MessageBoxEx.Show("您的宿舍还没有提交修理内容!");return;}new WFDormSch(Dormitoryno).ShowDialog();}//提交离宿private void btnDate_Click(object sender, EventArgs e){System.DateTime dt = dateTimePicker1.Value.Date;System.DateTime dt2 = dateTimePicker2.Value.Date;if (dt.CompareTo(dt2) > 0){MessageBoxEx.Show("日期有误!");return;}XmlDocument doc = new XmlDocument();doc.Load("事物表.xml");XmlElement Users = doc.DocumentElement;if (Users.SelectSingleNode("/Users/student[sno='" + Sno + "']") != null){MessageBoxEx.Show("您还有假期未消除!");return;}XmlElement student = doc.CreateElement("student");XmlElement sno = doc.CreateElement("sno");XmlElement leavetime = doc.CreateElement("leavetime");XmlElement arrivetime = doc.CreateElement("arrivetime");XmlElement state = doc.CreateElement("state");Users.AppendChild(student);student.AppendChild(sno);student.AppendChild(leavetime);student.AppendChild(arrivetime);student.AppendChild(state);sno.InnerText = Sno.ToString();leavetime.InnerText = dt.Date.ToString();arrivetime.InnerText = dt2.Date.ToString();state.InnerText = "未消假";doc.Save("事物表.xml");MessageBoxEx.Show("申请成功!");}//查看自己请假信息private void btnHld_Click(object sender, EventArgs e){XmlDocument doc = new XmlDocument();doc.Load("事物表.xml");XmlElement Users = doc.DocumentElement;if (Users.SelectSingleNode("/Users/student[sno='" + Sno + "']") == null){MessageBoxEx.Show("您已经没有请假信息!");return;}new WFHld(Sno).ShowDialog();}#endregion}
}
七、程序截图
七、联系与交流
q:969060742 完整代码、sql、程序资源