2016-2017学年第一学期《Windows程序设计》课程设计报告题目:小区住户信息管理系统的设计专业:班级:姓名:指导教师:成绩:学院二0一六年十一月十五日目录1.总体设计 (1)1.1 设计概述 (1)1.2 系统总体结构及功能模块划分 (1)1.2.1查询用户信息功能简介 (1)1.2.2管理用户信息功能简介 (1)1.2.3用户登录安全性 (1)2.详细设计 (1)2.1 概述 (1)2.2 系统程序流程图 (2)2.3 系统主要功能模块 (1)2.3.1主函数程序设计 (1)2.3.2系统登录界面 (2)2.3.3添加功能的实现 (4)2.3.4删除功能的实现 (6)2.3.5查找功能的实现 (8)2.3.6修改功能的实现 (9)3、总结 (12)4、参考文献 (13)1.总体设计1.1 设计概述把整体系统分化成不同的模块,每个模块完成一个特性的子功能。
把着些模块结合起来组成一个整体。
逐一实现各种功能。
1.2 系统总体结构及功能模块划分经过对系统的分析,小区住户信息管理系统主要划分为三部分:小区住户信息查询,小区住户信息管理,小区住户信息录入三个功能模块。
1.2.1查询用户信息功能简介小区住户信息查询:住户可以根据门牌号、姓名、身份证号进行查询。
1.2.2管理用户信息功能简介小区住户信息管理:主要是用于小区住户信息更新、插入、删除。
1.2.3用户登录安全性系统设计了登陆界面,每个合法用户有用户名及密码,只有当用户输入正确的用户名及密码组合后才能够对小区住户信息进行操作。
2.详细设计2.1 概述详细设计阶段的根本目标是确定应该怎么样具有的实现所要求的系统,也就是说,经过这个阶段的设计工作,应该得出目标系统的精确描述,从而在编码阶段可以把这个描述直接翻译成用某个程序设计语言写的程序.2.2 系统程序流程图程序流程图又称为程序框架图,它是历史悠久使用最广泛的描述软件的方法。
它可将整个程序的总体流程清楚明白的显示出来。
如图系统总流程图结构。
图1.系统设计流程图2.3 系统主要功能模块2.3.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 DataAccessLayer;namespace ResidentMIS {public partial class FormMain : Form{public FormMain(){InitializeComponent();}private void 信息录入ToolStripMenuItem_Click(object sender, EventArgs e) {FormAddResident add = new FormAddResident();add.ShowDialog();if (add.DialogResult == DialogResult.OK){bind();}}BindingSource bs = new BindingSource();public void bind()//刷新网格{bs.DataSource = new SQLHelper().CreateTable();dataGridViewResident.DataSource = bs;}private void FormMain_Load(object sender, EventArgs e){bind();}private void 信息删除ToolStripMenuItem_Click(object sender, EventArgs e) {FormDeleteResident delete = new FormDeleteResident();delete.ShowDialog();if (delete.DialogResult == DialogResult.OK){bind();}}private void 查找信息ToolStripMenuItem_Click(object sender, EventArgs e){FormRearchResident search = new FormRearchResident();search.ShowDialog();if (search.DialogResult == DialogResult.OK){bind();}}private void 修改信息ToolStripMenuItem_Click(object sender, EventArgs e){FormUpdateResident update = new FormUpdateResident();update.ShowDialog();if (update.DialogResult == DialogResult.OK){bind();}}}}2.3.2系统登录界面用户凭借用户名及密码登录,成功登录后可以对住户信息进行操作。
用户界面如图所示图2.登陆界面图3.管理系统主界面代码设计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 DataAccessLayer;namespace ResidentMIS {public partial class FormLogin : Form {public FormLogin(){InitializeComponent();}private void buttonok_Click(object sender, EventArgs e){int total = new SQLHelper().login(textBoxusername.Text.Trim(),textBoxpassword.Text.Trim());if (total > 0) {FormMain main = new FormMain();main.Show();this.Hide();}else{MessageBox.Show("用户名或密码错误", "提示");textBoxusername.Text = "";textBoxpassword.Text = "";textBoxusername.Focus();}}private void buttoncancel_Click(object sender, EventArgs e){textBoxusername.Text = "";textBoxpassword.Text = "";textBoxusername.Focus();}}}2.3.3添加功能的实现学生信息添加:在程序主界面(图3程序主界面)通过信息录入项进入信息添加模块。
通过此模块,学生可以向数据库中添加学号、姓名、生日及选择性别。
如图所示图4.录入功能界面代码设计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 DataAccessLayer;using System.Data.SqlClient;namespace ResidentMIS {public partial class FormAddResident : Form{public FormAddResident(){InitializeComponent();}private void buttonok_Click(object sender, EventArgs e){string sno = textBoxSno.Text.Trim();string sname = textBoxSname.Text.Trim();string sex = comboBoxsex.Text.Trim();string birthday = textBoxbirthday.Text.Trim();new ResidentDAO().insert(sno,sname,sex,birthday);this.DialogResult = DialogResult.OK;MessageBox.Show("输入成功");}private void buttoncancel_Click(object sender, EventArgs e){textBoxSno.Text = "";textBoxSname.Text = "";comboBoxsex.Text = "";textBoxbirthday.Text = "";textBoxSno.Focus();}}}2.3.4删除功能的实现学生信息删除:信息删除模块如图,可以通过删除模块进行学号或姓名进行信息的删除图5.删除功能界面代码设计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 DataAccessLayer;namespace ResidentMIS {public partial class FormDeleteResident : Form{public FormDeleteResident(){InitializeComponent();}private void buttonok_Click(object sender, EventArgs e){new ResidentDAO().deletebysno(textBoxsno.Text.Trim());this.DialogResult = DialogResult.OK;new ResidentDAO().deletebyname(textBoxsname.Text.Trim()); MessageBox.Show("删除成功");this.DialogResult = DialogResult.OK;}private void buttoncancel_Click(object sender, EventArgs e){textBoxsno.Text = "";textBoxsname.Text = "";textBoxsno.Focus();}}2.3.5查找功能的实现学生信息查找:信息查找模块如图,可以通过查找模块进行学号或姓名的查找。