VC++.net课程设计学生成绩管理系统设计说明书 .doc
VC+.net课程设计学生管理系统设计说明书学校: 广西工学院 系别: 计算机 工程系 班别: 计y052班 姓名: 学号: 目录一、课程设计项目3二、 学生管理系统需求分析31. 学生管理系统功能需求31.1信息操作功能31.2查询功能31.3统计功能31.4分析功能32. 学生管理系统性能需求42.1时间相应42.2容错能力4三. 学生管理系统设计41. 学生管理系统模块设计41.1主模块41.2信息插入模块51.3信息删除模块51.4信息修改模块51.5信息查询模块62. 学生管理系统数据库设计62.1学生表62.2班级信息表62.3课程表72.4成绩表73.内部类设计73.1学生类73.2班级类83.3课程类83.4成绩类9四、 学生管理系统代码实现91. 学生管理系统模块代码实现91.1主模块91.2信息插入模块121.2信息删除模块151.3信息修改模块191.4信息查询模块232. 内部类代码实现252.1学生类252.2班级类282.3课程类312.4成绩类34五、学生管理系统功能测试371插入信息测试372删除信息测试383修改信息测试404查询信息测试41六 课程设计总结和感想42一、课程设计项目学生管理系统。二、 学生管理系统需求分析1. 学生管理系统功能需求本次.net课程设计实习所涉及的学生信息管理系统是一个简单的管理系统,用于为某个院系按专业管理学生的基本信息、课程信息和学生成绩信息以及班级信息。系统功能主要分为:信息操作功能、查询功能、统计功能和分析功能。1.1信息操作功能1) 学生基本信息的增加、删除、修改。学生信息包括:学号,姓名,性别,出生日期,籍贯和家庭住址。2) 学生成绩信息的添加、删除、修改。学生成绩信息包括:学号、课程号和成绩。3) 班级信息添加、删除、修改。班级信息包括:班号、所在院系、专业名称、学制和入学时间。4) 课程信息的添加、删除、修改。课程信息包括:课程号、课程名称、课程类型、开课学期、课时数和学分。1.2查询功能1) 查询学生基本信息。(通过学号、姓名、系别、籍贯等)2) 查询成绩基本信息。(通过学号、课程号、等)3) 查询课程基本信息。(通过课程号、课程名等)4) 查询班级基本信息。(通过班级号、班级名、所在院系等)1.3统计功能1) 统计某个学生的在所有学期课程总平均分,并且在状态栏上显示。1.4分析功能1) 对某个班级某一门课程的成绩分布进行分析,并且以直方图的形式显示出来。2. 学生管理系统性能需求2.1时间相应1) 在用户可以忍受的范围内,相应用户的操作。2.2容错能力1) 能够有一定的容错提示,数据库连接出错时或者查询出错时候给出错误提示。三. 学生管理系统设计1. 学生管理系统模块设计1.1主模块1.2信息插入模块1.3信息删除模块1.4信息修改模块1.5信息查询模块2. 学生管理系统数据库设计2.1学生表2.2班级信息表2.3课程表2.4成绩表3.内部类设计我单独分别设计了4个类,来完成对数据库中的表进行操作。这些类把用户界面和数据库操作分离开来,实现了用户界面层和数据操作层的分离,更加清晰的把整个软件架构表达出来。3.1学生类class Student public String strCon; public OleDbConnection conn; public OleDbCommand cmd; public Student(); public void insert(string studentno, string studentname, string studentsex, string studentbirth, stringstudentnative, string studentaddress); public void delete(string studentno); public DataSet select(string selectype,string item); public DataSet selectAll(); public void update(string studentno, string studentname, string studentsex, string studentbirth, string studentnative, string studentaddress);3.2班级类class Classinfo public String strCon; public OleDbConnection conn; public OleDbCommand cmd; public Classinfo(); public void insert(string classno, string classdepart, string special, string studyyears, string entertime); public void delete(string classno); public DataSet select(string selectype,string item); public DataSet selectAll(); public void update(string classno, string classdepart, string special, string studyyears, string entertime);3.3课程类class Coursepublic String strCon;public OleDbConnection conn;public OleDbCommand cmd;public Course(); public void insert(string courseno, string coursename, string coursetype, string courseopenteam, string coursehours, string coursecredi); public void delete(string courseno); public DataSet select(string selectype,string item); public DataSet selectAll(); public void update(string courseno, string coursename, string coursetype, string courseopenteam, string coursehours, string coursecredi); 3.4成绩类class Score public String strCon; public OleDbConnection conn; public OleDbCommand cmd; public Score() ; public void insert(string studentno, string courseno, string coursescore); public void delete(string studnetno,string courseno); public DataSet select(string type, string studentno, string courseno); public DataSet selectAll(); public void update(string studentno, string courseno, string coursescore);四、 学生管理系统代码实现1. 学生管理系统模块代码实现1.1主模块namespace StudentManagerSys public partial class Form1 : Form public Form1() InitializeComponent(); private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) switch (e.Node.Text) case "学生信息": shouwStudentInfo(); break; case "班级信息": shouwClassInfo(); break; case "课程信息": shouwCoureinfo(); break; case "成绩信息": shouwScoreInfo(); break; private void shouwStudentInfo() Student stu = new Student(); DataSet stuInfo; stuInfo = stu.selectAll(); dataGridView1.DataSource = stuInfo; dataGridView1.DataMember = "infom" private void shouwClassInfo() Classinfo cla = new Classinfo(); DataSet claInfo; claInfo = cla.selectAll(); dataGridView1.DataSource = claInfo; dataGridView1.DataMember = "infom" private void shouwCoureinfo() Course cou = new Course(); DataSet couInfo; couInfo = cou.selectAll(); dataGridView1.DataSource = couInfo; dataGridView1.DataMember = "infom" private void shouwScoreInfo() Score sco = new Score(); DataSet scoInfo; scoInfo = sco.selectAll(); dataGridView1.DataSource = scoInfo; dataGridView1.DataMember = "infom" private void 插入数据ToolStripMenuItem_Click(object sender, EventArgs e) InsertFrom from = new InsertFrom(); from.Show(); private void 删除数据ToolStripMenuItem_Click(object sender, EventArgs e) DeleteForm from = new DeleteForm(); from.Show(); private void 修改数据ToolStripMenuItem_Click(object sender, EventArgs e) ModifyForm from = new ModifyForm(); from.Show(); private void 查询数据ToolStripMenuItem_Click(object sender, EventArgs e) SearchForm from = new SearchForm(); from.Show(); private void 关于这个软件ToolStripMenuItem_Click(object sender, EventArgs e) MessageBox.Show("作者信息:计Y052班 罗鑫 200502001071n"); 1.2信息插入模块namespace StudentManagerSys public partial class InsertFrom : Form /插入学生信息用到的数据 public string studnetno; public string studentname; public string sex; public string ative; public string address; public string birth; /插入班级信息用到的数据 public string classno; public string depart; public string specical; public string studyears; public string entertime; /插入课程信息用到的数据 public string courseno; public string coursename; public string coursetype; public string openterm; public string ccoursehours; public string credit; /插入成绩信息需要的数据 public string score; public InsertFrom() InitializeComponent(); /插入学生信息,确认按钮消息相应函数 private void button1_makesure_Click(object sender, EventArgs e) studnetno = textBox1.Text; studentname = textBox2.Text; if (comboBox1.Text = "男") sex = "0" else sex = "1" ative = textBox3.Text; address = textBox4.Text; birth = dateTimePicker1.Value.ToString("yyyy-MM-dd"); Student stu = new Student(); stu.insert(studnetno, studentname, sex, birth, ative, address); this.Close(); /插入学生信息,重置按钮消息相应函数 private void button1_reset_Click(object sender, EventArgs e) textBox1.Text = "" textBox2.Text = "" textBox3.Text = "" textBox4.Text = "" dateTimePicker1.Text = "" comboBox1.Text = "男" /插入班级信息,确认按钮消息相应函数 private void button1_Click(object sender, EventArgs e) classno = textBox5.Text; depart = textBox8.Text; specical = textBox9.Text; studyears = textBox6.Text; entertime = dateTimePicker2.Value.ToString("yyyy-MM-dd"); Classinfo cla = new Classinfo(); cla.insert(classno, depart, specical, studyears, entertime); this.Close(); /插入班级信息,重置按钮消息相应函数 private void button2_Click(object sender, EventArgs e) textBox5.Text = "" textBox8.Text = "" textBox9.Text = "" textBox6.Text = "" dateTimePicker2.Text = "" /插入课程信息,确认按钮消息相应函数 private void button4_Click(object sender, EventArgs e) courseno = textBox10.Text; coursename = textBox11.Text; coursetype = textBox12.Text; openterm = textBox13.Text; ccoursehours = textBox14.Text; credit = textBox15.Text; Course cou = new Course(); cou.insert(courseno, coursename, coursetype, openterm, ccoursehours, credit); this.Close(); /插入课程信息,重置按钮消息相应函数 private void button3_Click(object sender, EventArgs e) textBox10.Text = "" textBox11.Text = "" textBox12.Text = "" textBox13.Text = "" textBox14.Text = "" textBox15.Text = "" /插入成绩信息,确认按钮消息相应函数 private void button6_Click(object sender, EventArgs e) courseno = textBox16.Text; studnetno = textBox17.Text; score = textBox18.Text; Score sco = new Score(); sco.insert(studnetno, courseno, score); this.Close(); /插入成绩信息,取消按钮消息相应函数 private void button5_Click(object sender, EventArgs e) textBox16.Text = "" textBox17.Text = "" textBox18.Text = "" 1.2信息删除模块namespace StudentManagerSys public partial class DeleteForm : Form public string delStudentNo = " " public string delClassNo = " " public string delCourseNo = " " public string delScoreid = " " public DeleteForm() InitializeComponent(); /显示所有相应表格的数据 public void ShowAllData(string type) DataSet set; if (type = "学生") Student stu = new Student(); set = stu.selectAll(); dataGridView1.DataSource = set; dataGridView1.DataMember = "infom" else if (type = "班级") Classinfo cla = new Classinfo(); set = cla.selectAll(); dataGridView2.DataSource = set; dataGridView2.DataMember = "infom" else if (type = "课程") Course cou = new Course(); set = cou.selectAll(); dataGridView3.DataSource = set; dataGridView3.DataMember = "infom" else if (type = "成绩") Score sco = new Score(); set = sco.selectAll(); dataGridView4.DataSource = set; dataGridView4.DataMember = "infom" private void tabControl1_Selected(object sender, TabControlEventArgs e) if (e.TabPage = tabPage1) ShowAllData("学生"); else if (e.TabPage = tabPage2) ShowAllData("班级"); else if (e.TabPage = tabPage3) ShowAllData("课程"); else if (e.TabPage = tabPage4) ShowAllData("成绩"); /删除学生信息 private void button1_delstu_Click(object sender, EventArgs e) if (MessageBox.Show(this, "要删除所选记录吗?", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign) = DialogResult.No) return; foreach (Control ctrl in this.Controls)/通过个一循环得到信息 string ctrlName = ctrl.Name.Trim(); if (ctrlName.StartsWith("pid")/查询信息根据的主键 ctrl.Enabled = false; delStudentNo = dataGridView1.RowsdataGridView1.CurrentRow.Index.Cells0.Value.ToString(); Student stu = new Student(); stu.delete(delStudentNo); /删除成绩信息 private void button1_delsco_Click(object sender, EventArgs e) if (MessageBox.Show(this, "要删除所选记录吗?", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign) = DialogResult.No) return; if (delStudentNo != " " && delClassNo != "") Score sco = new Score(); sco.delete(delStudentNo, delClassNo); /删除课程信息 private void button1_delCou_Click(object sender, EventArgs e) if (MessageBox.Show(this, "要删除所选记录吗?", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign) = DialogResult.No) return; foreach (Control ctrl in this.Controls)/通过个一循环得到信息 string ctrlName = ctrl.Name.Trim(); if (ctrlName.StartsWith("pid")/查询信息根据的主键 ctrl.Enabled = false; delCours