《家谱管理系统》课程设计报告
学 院:班 级:制 作 人:****:
信息科学与工程学院 计算机科学与技术08-4班 邢尚文
*** 山 东 科 技 大 学 2011年9月1日
需求分析:本系统主要完成对家谱的相关操作和家谱人员信息的管理,包括打开家谱、新加家谱、保存家谱和家谱人员的姓名查找、某代信息查找、信息删除等。
系统的核心是利用对话框的连接和文本处理来存储和修改家谱管理系统的信息联系,其中的每一个动作都可能影响到其他的功能。 本系统实现以下功能:
1). 输入文件以存放最初家谱中各成员的信息。 成员的信息中均应包含以下内容:
姓名、辈分、父辈姓名、电话。 2). 实现数据的存盘和读盘。 3). 以图形方式显示家谱。 4). 显示第n 代所有人的信息。 5). 按照姓名查询,输出成员信息 6). 删除某成员。
本系统的作用不是为了代替家谱,而是为了更好的建立家庭之间成员的联系,提供一个查询的平台,里面的族谱及文化介绍可以有效的介绍家族历史,让成员了解家族历史,向外界展示。
E-R图
程序界面与代码:
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;
namespace WindowsFormsApplication12 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent(); }
private void button4_Click(object sender, EventArgs e) {
if (textBox1.Text == \"\" && textBox2.Text == \" \") {
MessageBox.Show(\"信息不全请重新填写\"); }
if (textBox1.Text == \"admin\" && textBox2.Text == \"admin\") {
Form2 form = new Form2(); form.Show(); }
else {
textBox1.Text = \"\"; textBox2.Text = \"\";
MessageBox.Show(\"请重新输入用户名密码?\"); } }
private void button1_Click(object sender, EventArgs e) {
Form6 form = new Form6(); form.Show(); }
private void button3_Click(object sender, EventArgs e) {
Form7 form = new Form7(); form.Show(); }
private void button2_Click(object sender, EventArgs e) {
MessageBox.Show(\"本软件的设¨计?是º?为a了¢?让¨?用®?户¡ì能¨¹够?更¨¹好?地Ì?管¨¹理¤¨ª家¨°谱¡Á以°?及¡ã方¤?便À?家¨°谱¡Á的Ì?修T改?,ê?使º1用®?注Á¡é册¨¢过y的Ì?账?号?的Ì?登Ì?陆?后¨®就¨ª可¨¦以°?使º1用®?本À?软¨¨ª件t!ê? \"); } } }
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;
namespace WindowsFormsApplication12 {
public partial class Form2 : Form {
public Form2() {
InitializeComponent(); }
private void 祖Á?先¨¨功|德Ì?ToolStripMenuItem_Click(object sender, EventArgs e) {
Form3 form = new Form3(); form.Show(); }
private void zToolStripMenuItem_Click(object sender, EventArgs e) {
Form4 form = new Form4(); form.Show(); }
private void 祭¨¤祖Á?文?化¡¥ToolStripMenuItem_Click(object sender, EventArgs e) {
Form5 form = new Form5(); form.Show(); }
private void 家¨°谱¡Á管¨¹理¤¨ªToolStripMenuItem_Click(object sender, EventArgs e) {
Form8 form = new Form8(); form.Show(); }
private void dsdfsdToolStripMenuItem_Click(object sender, EventArgs e) {
Form9 form = new Form9(); form.Show(); }
private void 通ª¡§讯?录?添¬¨ª加¨®ToolStripMenuItem_Click(object sender, EventArgs e) {
Form10 form = new Form10(); form.Show(); }
private void 制?作Á¡Â人¨?ToolStripMenuItem1_Click(object sender, EventArgs e) {
MessageBox.Show(\"制?作Á¡Â人¨?计?算?机¨²08-3班㨤:êo李¤?蓟?涛¬?,ê?李¤?赟²S,ê?张?拓ª?,ê?苏?晓t慧?\");
}
private void 通ª¡§讯?录?ToolStripMenuItem_Click(object sender, EventArgs e) {
MessageBox.Show(\"要°a做Á?出?修T改?需¨¨要°a提¬¨¢供?管¨¹理¤¨ª员¡À权¨¡§限T!ê?\");
Form11 form = new Form11(); form.Show(); }
private void 制?作Á¡Â人¨?ToolStripMenuItem_Click(object sender, EventArgs e) {
Form13 form = new Form13(); form.Show(); } } }
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;
namespace WindowsFormsApplication12 {
public partial class Form3 : Form {
public Form3() {
InitializeComponent(); } } }
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;
namespace WindowsFormsApplication12 {
public partial class Form4 : Form {
public Form4() {
InitializeComponent(); } } }
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;
namespace WindowsFormsApplication12 {
public partial class Form5 : Form {
public Form5() {
InitializeComponent(); } } }
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;
namespace WindowsFormsApplication12 {
public partial class Form6 : Form {
public Form6() {
InitializeComponent(); } } }
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;
namespace WindowsFormsApplication12 {
public partial class Form7 : Form {
public Form7() {
InitializeComponent(); } } }
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 System.Data.OleDb;
namespace WindowsFormsApplication12 {
public partial class Form9 : Form {
public Form9() {
InitializeComponent(); }
private void Form9_Load(object sender, EventArgs e) {
// TODO: 这a行D代䨲码?将?数ºy据Y加¨®载?到Ì?表À¨ª“¡ãdb1DataSet11.表À¨ª2”¡À中D。¡ê您¨²可¨¦以°?根¨´据Y需¨¨要°a移°?动¡¥或¨°删¦?除y它¨¹。¡ê this.表À¨ª2TableAdapter.Fill(this.db1DataSet11.表À¨ª2);
}
private void button1_Click(object sender, EventArgs e) {
string acc = \"\";
string s = textBox1.Text; OleDbConnection conn = new
OleDbConnection(\"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=F:/xitong/Projects/WindowsFormsApplication12/WindowsFormsApplication12/db1.mdb\");
acc = string.Format(\"select p_name,p_general,fa_name,tele_num FROM 表À¨ª2 where p_name='{0}'\", textBox1.Text); conn.Open();
DataSet dataset = new DataSet();
OleDbDataAdapter adapter = new OleDbDataAdapter(acc, conn); adapter.Fill(dataset);
dataGridView1.DataSource = dataset.Tables[0]; } } }
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 System.Data.OleDb;
namespace WindowsFormsApplication12 {
public partial class Form10 : Form {
public Form10()
{
InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) {
OleDbConnection conn = new
OleDbConnection(@\"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=F:/xitong/Projects/WindowsFormsApplication12/WindowsFormsApplication12/db1.mdb\");
String cmdString = \"insert into 表À¨ª2(p_name,p_general,fa_name,tele_num) values ('\";
cmdString += textBox1.Text + \"','\"; cmdString += textBox2.Text + \"','\"; cmdString += textBox3.Text + \"','\"; cmdString += textBox4.Text + \"')\"; conn.Open();
OleDbCommand cmd = new OleDbCommand(cmdString, conn);
// OleDbCommand cmd = new OleDbCommand(); //cmd.CommandText = cmdString; //cmd.Connection = conn;
//Console.WriteLine(\"SQL: \" + cmdString);
cmd.ExecuteNonQuery(); conn.Close(); }
private void textBox1_TextChanged(object sender, EventArgs e) {
}
private void Form10_Load(object sender, EventArgs e) {
// TODO: 这a行D代䨲码?将?数ºy据Y加¨®载?到Ì?表À¨ª“¡ãdb1DataSet10.表À¨ª2”¡À中D。¡ê您¨²可¨¦以°?根¨´据Y需¨¨要°a移°?动¡¥或¨°删¦?除y它¨¹。¡ê this.表À¨ª2TableAdapter.Fill(this.db1DataSet10.表À¨ª2);
} } }
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;
namespace WindowsFormsApplication12 {
public partial class Form11 : Form {
public Form11() {
InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) {
if (textBox1.Text == \"123\" && textBox2.Text == \"123\") {
Form12 form = new Form12(); form.Show(); }
if (textBox1.Text == \"\" && textBox2.Text == \" \") {
MessageBox.Show(\"信?息¡é不?全¨?,请?重?新?填¬?写¡ä\"); }
if (textBox1.Text == \"123\" && textBox2.Text == \"123\") {
Form2 form = new Form2(); form.Show(); }
{
textBox1.Text = textBox2.Text = MessageBox.Show( } } } }
else \"\"; \"\";
\"请?重?新?输º?入¨?用®?户¡ì名?和¨ª密¨¹码?\");
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 System.Data.OleDb;
namespace WindowsFormsApplication12 {
public partial class Form12 : Form {
public Form12() {
InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) {
/* OleDbConnection myconn = DB.CreateConnection(); myconn.Open();
string newID = Request.QueryString[\"ID \"].ToString(); string sql = \"delete from news where ID= \" + newID; OleDbCommand cmd = new OleDbCommand(sql, myconn); cmd.ExecuteNonQuery(); myconn.Close();
Response.Redirect(\"defnews.aspx \"); */ }
private void Form12_Load(object sender, EventArgs e) {
// TODO: 这a行D代䨲码?将?数ºy据Y加¨®载?到Ì?表À¨ª“¡ãdb1DataSet12.表À¨ª2”¡À中D。¡ê您¨²可¨¦以°?根¨´据Y需¨¨要°a移°?动¡¥或¨°删¦?除y它¨¹。¡ê this.表À¨ª2TableAdapter.Fill(this.db1DataSet12.表À¨ª2);
} } }
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 System.Data.OleDb;
namespace WindowsFormsApplication12 {
public partial class Form13 : Form {
public Form13() {
InitializeComponent(); }
private void Form13_Load(object sender, EventArgs e) {
// TODO: 这a行D代䨲码?将?数ºy据Y加¨®载?到Ì?表À¨ª“¡ãdb1DataSet9.表
À¨ª2”¡À中D。¡ê您¨²可¨¦以°?根¨´据Y需¨¨要°a移°?动¡¥或¨°删¦?除y它¨¹。¡ê this.表À¨ª2TableAdapter.Fill(this.db1DataSet9.表À¨ª2); }
private void button1_Click(object sender, EventArgs e) {
string acc = \"\";
string s = textBox1.Text; OleDbConnection conn = new
OleDbConnection(\"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=F:/xitong/Projects/WindowsFormsApplication12/WindowsFormsApplication12/db1.mdb\");
acc = string.Format(\"select p_name,p_general,fa_name,tele_num FROM 表À¨ª2 where p_general={0}\", textBox1.Text); conn.Open();
DataSet dataset = new DataSet();
OleDbDataAdapter adapter = new OleDbDataAdapter(acc, conn); adapter.Fill(dataset);
dataGridView1.DataSource = dataset.Tables[0];
} } }
实验总结
经过这些天的设计和开发,系统基本开发完毕。在本次课程设计中困难遇到不少。比如容器类相关的成员函数,全局参数的传递等都忘了很多,有的是在百度和书籍中查找到的,并且有些不懂得问题也请教了老师、同学。也为自己今后的学习解决了一些问题。 这次课程设计,我们选取的题目是《家谱管理系统》,对如何运用C#编程语言和编程环境有了进一步的了解,炼了动手能力,能让所学有所用,真正体会到在实际中运用知识的魅力,体会了其中的无穷乐趣,获得了更多实用的知识。
不过,这个系统还有很多的不足之处,比如对数据的输入方面没有太多的限制,这可能导致用户输入异常的发生;对系统查询的设置也不灵活,系统的可扩展性不强,功能的实现也不太完善等等。该系统还有很多不尽如人意的地方,比如用户界面不够美观,功能不够完善等多方面问题
因篇幅问题不能全部显示,请点此查看更多更全内容