当前位置:文档之家› 教务管理系统介绍

教务管理系统介绍

云南农业大学数据库课程设计姓名:xiaoxiao学号:201x31xxxxxx学院:基础与信息工程专业:电子信息工程课程:网络数据库技术与应用设计题目:教务管理系统指导教师:吴文斗(教授)设计日期:2013年1月4日一.系统开发工具系统开发环境:Microsoft Visual Studio 2010系统开发语言:C#运行平台:Windows 7数据库:SQL Server 2005Microsoft Visual Studio 2010特点:1、面向对象设计不再是单纯的从代码的第一行一直编到最后一行,而是考虑如何创建类和对象,利用类和对象来简化程序设计,并提供代码的封装和可重用性,便于程序的维护与扩展。

2、所谓的对象是一种抽象的名称,用来对应实现世界存在的“东西”。

一个窗口、一个按钮、一个菜单都可视为一个对象,而按钮对象、菜单对象、又会出现在窗口对象中,因此按钮对象、菜单对象便是窗口的组件之一。

对象内部的数据是不能随意更改的,必须由外部向其传递信息,再由对象按其方法加以处理。

用户无需知道其任何细节,操作是封闭的,对象之间能通过函数调用相互通信。

3、类可视为一个产品模具、一个模块。

在面向对象设计中,类是对象的原型,是对象的制作器。

类的概念是面向对象程序设计最重要的特征。

所谓类,是指由数据结构及其相关操作所形成的集合,描述该类任一对象的共同的行为特征,是对一组性质相同的对象的程序描述,概括了对象的共同性质和数据。

4、面向对象设计的核心是类的设计。

例如:可以定义一个“成绩查询”类,该类中可以定义查询的姓名、学号、班级等信息,则以此类为原型可以设计出众多的“成绩查询”类的对象实例,这些实体都具有类中所定义的特征。

二. 系统功能要求该系统主要分为三部分:管理员部分和教师部分和学生部分。

系统针对教师和管理员号学生分别有不同的需求划分。

1.管理员的主要功能:(1)教师管理:管理员可以对已注册的教师信息进行管理,包括查询,修改,删除和添加新教师。

(2)学生管理:管理员可以对已注册的学生信息进行管理,包括查询,修改,删除和添加新学生。

(3)本系统设定:管理员不可以对已注册的管理员信息进行管理,包括查询,修改,删除和添加新管理员。

2.教师的主要功能:(1)查询功能:教师登录系统后可以查询学生信息。

(2添加功能:教师可以添加学生的成绩!3.学生的主要功能:(1)查询功能:学生主要是查询自己的成绩而不能对信息进行修改等!三.系统流程图四.E-R 模型图开始登陆判断身份管理员教师学生教师信息管查询 学生信息管添加 修改 提交成绩返回 返回 删除 查询 添加 修改 删除 学生信息查询 查询 查询查询管理员学生教师成绩性别课程修改添加删除管理员工号专业性别姓名 学号工号姓名职称管理管理提交查询提交课程号查询学分课程名删除查询修改添加查询授课选修五.逻辑结构设计1.首先使用SQL Server 2005 创建数据库文件create database jwglon primary(name=jwgl,filename='D:\教务管理系统\jwgl.mdf',size=3,maxsize=100,filegrowth=10%)log on(name=jwgl_log,filename='D:\\jwgl_log.ldf',size=1,maxsize=2,filegrowth=10%)2,表的创建数据库的逻辑设计即把得到的满足第三范式的关系转化为特定的数据库管理系统下的数据表。

针对本系统,为满足系统需要,我设计了gly(管理员)表,student(学生信息)表,teacher(教师)表,qx(登陆权限)表,course(课程)表,sc2(学生课程成绩)表。

1)gly管理员信息表:管理员工号,姓名2)student 学生信息表:学号,姓名,性别,专业3)teacher 教师信息表:教师工号,姓名,性别,职称。

4)qx 登陆权限不:权限编号(学号,管理员工号,教师工号),权限级别,权限对应的类型5)course 课程表:课程号,课程名,学分6)sc2 成绩表:学号,课程号,成绩。

主要的数据库表:1).创建学生信息表:use jwglgocreate table student(sid char(10)not null primary key,sname char(10)not null,sex char(2)not null check( sex ='男'or sex='女')default'男',zy char(15)not null)2).创建课程信息表use jwglgocreate table course( cid char(10)not null primary key,cname char(20)not null,cxf char(2))3).创建成绩表:use jwglgocreate table sc2(sid char(10)not null,cid char(10)not null,grade numeric(5,1)null,primary key(sid,cid),foreign key(cid)references course(cid) )4).创建管理员信息表use jwglgocreate table gly(gid char(10)not null primary key, gname char(10)not null)5). 创建登陆权限表use jwglgocreate table qx(qxid char(10)not null primary key, qxname char(10)not null,qxpwd char(10)not null)6).创建教师信息表use jwglgocreate table teacher(tid char(10)not null primary key,tname char(10)not null,sex char(2)not null check( sex ='男'or sex='女')default'男',zc char(15)not null)六.主窗体的设计上面的SQL语句在SQL Server 2000中查询分析器执行后,将自动产生需要的所有表。

有关数据库结构的所有后台工作已经完成。

现在将通过学生管理系统中各个功能模块的实现,来编写数据库系统的客户端程序。

1. 教务管理系统登陆界面为了在Visual Studio.2010中创建应用程序,应当先创建一个空白解决方案启动这个空白解决方案后,单击文件|新建|项目菜单,在新建项目中选择Visual C#项目,在模块中选择Windows 应用程序,并命名为教务管理系统,,并添加相应控件如图:对应程序: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 System.Data.SqlClient;namespace WindowsFormsApplication1{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void button1_Click(object sender, EventArgs e){SqlConnection conn = new SqlConnection();conn.ConnectionString = "Server = (local);database = jwgl;integrated Security = true ";conn.Open();SqlCommand cmd = new SqlCommand();mandType = CommandType.Text;SqlDataAdapter da = new SqlDataAdapter("select * from qx where qxid='" + textBox1.Text + "'and qxpwd='" + textBox2.Text + "'", conn);DataSet ds = new DataSet("sss");da.Fill(ds,"sss");conn.Close();if (ds.Tables[0].Rows.Count == 0){MessageBox.Show("密¨¹码?或¨°用®?户¡ì名?错䨪误¨®!ê?");}else{DataRow row = ds.Tables["sss"].Rows[0];if (row[2].ToString().Trim() == "1"){Form2 f = new Form2();f.Show();this.Visible = false;}else if (row[2].ToString().Trim() == "2"){Form5 f = new Form5();f.Show();this.Visible = false;}else if (row[2].ToString().Trim() == "3"){Form9 f = new Form9();f.Show();this.Visible = false;}}}private void button2_Click(object sender, EventArgs e){textBox1.Text = "";textBox2.Text = "";}}}2.系统管理员主管理窗口对应代码:public partial class Form2 : Form{public Form2(){InitializeComponent();}private void添¬¨ª加¨®教¨¬师º|信?息¡éToolStripMenuItem_Click(object sender, EventArgs e) {Form3 f = new Form3();f.Show();this.Visible = false;}private void修T改?学¡ì生¦¨²信?息¡éToolStripMenuItem_Click(object sender, EventArgs e){Form4 f = new Form4();f.Show();this.Visible = false;}private void教¨¬师º|管¨¹理¤¨ªToolStripMenuItem_Click(object sender, EventArgs e){}private void取¨?消?ToolStripMenuItem1_Click(object sender, EventArgs e){Form1 f = new Form1();f.Show();this.Visible = false;}private void取¨?消?ToolStripMenuItem2_Click(object sender, EventArgs e){Form1 f = new Form1();f.Show();this.Visible = false;}private void button1_Click(object sender, EventArgs e){SqlConnection conn = new SqlConnection();conn.ConnectionString = "server=(local);database=jwgl;;integrated security=true";conn.Open();SqlCommand cmd = new SqlCommand();SqlDataAdapter da = new SqlDataAdapter("select * from gly where gid='"+textBox1.Text+"'", conn);DataTable ds = new DataTable();da.Fill(ds);dataGridView1.DataSource = ds;conn.Close();}private void button2_Click(object sender, EventArgs e){textBox1.Text = "";}private void button3_Click(object sender, EventArgs e){Form1 f = new Form1();f.Show();this.Visible = false;}}}3.管理员教师管理窗口public partial class Form3 : Form{public Form3(){InitializeComponent();}private void label4_Click(object sender, EventArgs e){}private void button5_Click(object sender, EventArgs e){SqlConnection conn = new SqlConnection();conn.ConnectionString = "server=(local);database=jwgl;;integrated security=true";conn.Open();SqlCommand cmd = new SqlCommand();SqlDataAdapter da = new SqlDataAdapter("select * from teacher ", conn);DataTable ds = new DataTable();da.Fill(ds);dataGridView1.DataSource = ds;}private void button2_Click(object sender, EventArgs e){if (textBox2.Text == ""){MessageBox.Show("学¡ì号?不?能¨¹为a空?!ê?");}else{SqlConnection conn = new SqlConnection();conn.ConnectionString = "server=(local);database=jwgl;integrated security=true";conn.Open();SqlCommand cmd = new SqlCommand();SqlDataAdapter da = new SqlDataAdapter("select * from teacher where tid='" + textBox2.Text + "'", conn);DataSet ds = new DataSet("sss1");da.Fill(ds, "sss1");conn.Close();if (ds.Tables[0].Rows.Count != 0){MessageBox.Show("该?教¨¬师º|已°?存ä?在¨²!ê?");}else{SqlConnection conn1 = new SqlConnection();conn1.ConnectionString = "server=(local);database=jwgl;integrated security=true";conn1.Open();SqlCommand cmd1 = new SqlCommand();mandType = CommandType.Text;cmd1.Connection = conn1;mandText = "insert into teacher values('" + textBox1.Text + "','" + textBox2.Text +"','" + textBox3.Text + "','" + textBox4.Text + "')";cmd1.Connection = conn1;cmd1.ExecuteNonQuery();conn1.Close();MessageBox.Show("添¬¨ª加¨®成¨¦功|!ê?");}}}private void button4_Click(object sender, EventArgs e){SqlConnection conn1 = new SqlConnection();conn1.ConnectionString = "server=(local);database=jwgl;integrated security=true";SqlCommand cmd1 = new SqlCommand();mandType = CommandType.Text;mandText = "delete teacher where tname='" + textBox1.Text + "'";cmd1.Connection = conn1;cmd1.ExecuteNonQuery();conn1.Close();MessageBox.Show("删¦?除y成¨¦功|!ê?");}private void button3_Click(object sender, EventArgs e){textBox1.Text = "";textBox2.Text = "";textBox3.Text = "";textBox4.Text = "";}private void button1_Click(object sender, EventArgs e){if (this.textBox1.Text == "" || this.textBox2.Text == "" || this.textBox3.Text == "" || this.textBox4.Text== ""){MessageBox.Show("输º?入¨?的Ì?学¡ì生¦¨²信?息¡é不?完ª¨º整?");}else{SqlConnection conn = new SqlConnection();conn.ConnectionString = "server=(local);database=jwgl;Integrated Security=True";conn.Open();SqlDataAdapter da = new SqlDataAdapter("select * from teacher where tid='" + textBox2.Text + "'", conn);DataSet ds = new DataSet("ssss");da.Fill(ds);if (ds.Tables[0].Rows.Count > 0){SqlCommand cmd = new SqlCommand();mandType = CommandType.Text;mandText = "update teacher set tname='" + textBox1.Text + "',sex='" +textBox3.Text + "',tzc='" + textBox4.Text + "'where tid='" + textBox2.Text + "' ";cmd.Connection = conn;cmd.ExecuteNonQuery();MessageBox.Show("修T改?成¨¦功|");conn.Close();}else{MessageBox.Show("此ä?记?录?不?存ä?在¨²");}}}private void button6_Click(object sender, EventArgs e){Form2 f = new Form2();f.Show();this.Visible = false;}}4.管理员学生信息管理窗口public partial class Form4 : Form{public Form4(){InitializeComponent();}private void button5_Click(object sender, EventArgs e){SqlConnection conn = new SqlConnection();conn.ConnectionString = "server=(local);database=jwgl;;integrated security=true";conn.Open();SqlCommand cmd = new SqlCommand();SqlDataAdapter da = new SqlDataAdapter("select * from student ", conn);DataTable ds = new DataTable();da.Fill(ds);dataGridView1.DataSource = ds;conn.Close();}private void button1_Click(object sender, EventArgs e){if (this.textBox1.Text == "" || this.textBox2.Text == "" || this.textBox3.Text == "" || this.textBox4.Text== ""){MessageBox.Show("输º?入¨?的Ì?学¡ì生¦¨²信?息¡é不?完ª¨º整?");}else{SqlConnection conn = new SqlConnection();conn.ConnectionString = "server=(local);database=jwgl;Integrated Security=True";conn.Open();SqlDataAdapter da = new SqlDataAdapter("select * from student where sid='" + textBox1.Text + "'", conn);DataSet ds = new DataSet("ssss");da.Fill(ds);if (ds.Tables[0].Rows.Count > 0){SqlCommand cmd = new SqlCommand();mandType = CommandType.Text;mandText = "update student set sname='" + textBox2.Text + "',sex='" +textBox3.Text + "',zy='" + textBox4.Text + "'where sid='" + textBox1.Text + "' ";cmd.Connection = conn;cmd.ExecuteNonQuery();MessageBox.Show("修T改?成¨¦功|");conn.Close();}else{MessageBox.Show("此ä?记?录?不?存ä?在¨²");}}}private void button2_Click(object sender, EventArgs e){if (textBox1.Text == ""){MessageBox.Show("学¡ì号?不?能¨¹为a空?!ê?");}else{SqlConnection conn = new SqlConnection();conn.ConnectionString = "server=(local);database=jwgl;integrated security=true";conn.Open();SqlCommand cmd = new SqlCommand();SqlDataAdapter da = new SqlDataAdapter("select * from student where sid='" + textBox1.Text + "'", conn);DataSet ds = new DataSet("sss1");da.Fill(ds, "sss1");conn.Close();if (ds.Tables[0].Rows.Count != 0){MessageBox.Show("该?学¡ì生¦¨²已°?存ä?在¨²!ê?");}else{SqlConnection conn1 = new SqlConnection();conn1.ConnectionString = "server=(local);database=jwgl;integrated security=true";conn1.Open();SqlCommand cmd1 = new SqlCommand();mandType = CommandType.Text;cmd1.Connection = conn1;mandText = "insert into student values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')";cmd1.Connection = conn1;cmd1.ExecuteNonQuery();conn1.Close();MessageBox.Show("添¬¨ª加¨®成¨¦功|!ê?");}}}private void button4_Click(object sender, EventArgs e){SqlConnection conn1 = new SqlConnection();conn1.ConnectionString = "server=(local);database=jwgl;integrated security=true";conn1.Open();SqlCommand cmd1 = new SqlCommand();mandType = CommandType.Text;mandText = "delete student where tname='" + textBox2.Text + "'";cmd1.Connection = conn1;cmd1.ExecuteNonQuery();conn1.Close();MessageBox.Show("删¦?除y成¨¦功|!ê?");}private void button3_Click(object sender, EventArgs e){textBox1.Text = "";textBox2.Text = "";textBox3.Text = "";textBox4.Text = "";}private void button6_Click(object sender, EventArgs e){Form2 f = new Form2();f.Show();this.Visible = false;}private void Form4_Load(object sender, EventArgs e){}private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) {}}5.教师教务应用主窗口public partial class Form5 : Form{public Form5(){InitializeComponent();}private void进?入¨?ToolStripMenuItem_Click(object sender, EventArgs e){Form6 f = new Form6();f.Show();this.Visible = false;}private void提¬¨¢交?ToolStripMenuItem_Click(object sender, EventArgs e){Form7 f = new Form7();f.Show();this.Visible = false;}private void取¨?消?ToolStripMenuItem_Click(object sender, EventArgs e){Form1 f = new Form1();f.Show();this.Visible = false;}private void取¨?消?ToolStripMenuItem1_Click(object sender, EventArgs e){Form1 f = new Form1();f.Show();this.Visible = false;}private void查¨¦询¡¥_Click(object sender, EventArgs e){SqlConnection conn = new SqlConnection();conn.ConnectionString = "server=(local);database=jwgl;;integrated security=true";conn.Open();SqlCommand cmd = new SqlCommand();SqlDataAdapter da = new SqlDataAdapter("select * from teacher where tid='" + textBox1.Text + "' ", conn);DataTable ds = new DataTable();da.Fill(ds);dataGridView1.DataSource = ds;conn.Close();}private void button2_Click(object sender, EventArgs e){textBox1.Text = "";}private void button3_Click(object sender, EventArgs e){Form1 f = new Form1();f.Show();this.Visible = false;}}}6.教师教务应用管理学生信息管理窗口public partial class Form6 : Form{public Form6(){InitializeComponent();}private void button1_Click(object sender, EventArgs e){SqlConnection conn = new SqlConnection();conn.ConnectionString = "server=(local);database=jwgl;integrated security=true";conn.Open();SqlCommand cmd = new SqlCommand();SqlDataAdapter da = new SqlDataAdapter("select * from student where sid='"+textBox1.Text+" ' ", conn);DataTable ds = new DataTable();da.Fill(ds);dataGridView1.DataSource = ds;conn.Close();}private void button2_Click(object sender, EventArgs e){textBox1.Text = "";textBox2.Text = "";}private void button3_Click(object sender, EventArgs e){Form5 f = new Form5();f.Show();this.Visible = false;}}}7.教师教务管理成绩应用窗口public partial class Form7 : Form{public Form7(){InitializeComponent();}private void button1_Click(object sender, EventArgs e){if (textBox1.Text == ""){MessageBox.Show("学¡ì号?不?能¨¹为a空?!ê?");}else if(textBox2.Text==""){MessageBox.Show("课?程¨¬号?不?能¨¹为a空?!ê?");}else{SqlConnection conn = new SqlConnection();conn.ConnectionString = "server=(local);database=jwgl;integrated security=true";conn.Open();SqlCommand cmd = new SqlCommand();SqlDataAdapter da = new SqlDataAdapter("select * from sc2 where sid='" + textBox1.Text + "' and cid= '"+textBox2.Text +"'", conn);DataSet ds = new DataSet("ss");da.Fill(ds, "ss");conn.Close();if (ds.Tables[0].Rows.Count != 0){MessageBox.Show("该?学¡ì生¦¨²已°?存ä?在¨²!ê?");}else{SqlConnection conn1 = new SqlConnection();conn1.ConnectionString = "server=(local);database=jwgl;integrated security=true";conn1.Open();SqlCommand cmd1 = new SqlCommand();mandType = CommandType.Text;cmd1.Connection = conn1;mandText = "insert into sc2 values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "')";cmd1.Connection = conn1;cmd1.ExecuteNonQuery();conn1.Close();MessageBox.Show("成¨¦绩¡§提¬¨¢交?成¨¦功|!ê?");}}}private void Form7_Load(object sender, EventArgs e){}private void button2_Click(object sender, EventArgs e){textBox1.Text = "";textBox2.Text = "";}private void button3_Click(object sender, EventArgs e){Form5 f = new Form5();f.Show();this.Visible = false;}}}8.学生教务管理应用程序代码:public partial class Form9 : Form{public Form9(){InitializeComponent();}private void button1_Click(object sender, EventArgs e){SqlConnection conn = new SqlConnection();conn.ConnectionString = "server=(local);database=jwgl;;integrated security=true";conn.Open();SqlCommand cmd = new SqlCommand();SqlDataAdapter da = new SqlDataAdapter("select * from sc2 where sid='"+textBox1.Text+"' and cid='"+textBox2.Text+"' ", conn);DataTable ds = new DataTable();da.Fill(ds);dataGridView1.DataSource = ds;conn.Close();}private void button2_Click(object sender, EventArgs e){textBox1.Text = "";textBox2.Text = "";}private void button3_Click(object sender, EventArgs e){Form1 f = new Form1();f.Show();this.Visible = false;}private void Form9_Load(object sender, EventArgs e){}}}七.遇到的问题及改进思想在整个开发的过程中,由于对C#语言的运用还不是很顺手,时间也比较仓促,因此,该系统必然会存在一些缺陷和不足。

相关主题