C#期末测试大作业.docx

上传人:b****2 文档编号:556785 上传时间:2023-04-29 格式:DOCX 页数:31 大小:310.86KB
下载 相关 举报
C#期末测试大作业.docx_第1页
第1页 / 共31页
C#期末测试大作业.docx_第2页
第2页 / 共31页
C#期末测试大作业.docx_第3页
第3页 / 共31页
C#期末测试大作业.docx_第4页
第4页 / 共31页
C#期末测试大作业.docx_第5页
第5页 / 共31页
C#期末测试大作业.docx_第6页
第6页 / 共31页
C#期末测试大作业.docx_第7页
第7页 / 共31页
C#期末测试大作业.docx_第8页
第8页 / 共31页
C#期末测试大作业.docx_第9页
第9页 / 共31页
C#期末测试大作业.docx_第10页
第10页 / 共31页
C#期末测试大作业.docx_第11页
第11页 / 共31页
C#期末测试大作业.docx_第12页
第12页 / 共31页
C#期末测试大作业.docx_第13页
第13页 / 共31页
C#期末测试大作业.docx_第14页
第14页 / 共31页
C#期末测试大作业.docx_第15页
第15页 / 共31页
C#期末测试大作业.docx_第16页
第16页 / 共31页
C#期末测试大作业.docx_第17页
第17页 / 共31页
C#期末测试大作业.docx_第18页
第18页 / 共31页
C#期末测试大作业.docx_第19页
第19页 / 共31页
C#期末测试大作业.docx_第20页
第20页 / 共31页
亲,该文档总共31页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

C#期末测试大作业.docx

《C#期末测试大作业.docx》由会员分享,可在线阅读,更多相关《C#期末测试大作业.docx(31页珍藏版)》请在冰点文库上搜索。

C#期末测试大作业.docx

C#期末测试大作业

期末测试大作业:

设计学生信息管理系统。

一、功能要求:

1.实现学生管理系统的登陆功能,按学生和管理员两种用户登录,要求有必要的输入验证和用户合法性验证;

2.设计管理员主窗体,要求

✓实现新增学生功能,

✓实现查询学生信息功能,

✓实现修改学生用户功能

✓实现按年级筛选学生列表功能

✓实现批量修改学生信息功能

✓实现学生信息的筛选和排序

✓实现删除学生信息

✓实现学生成绩的添加与查看

以上功能大体分为学生信息管理功能和学生成绩管理功能,要求至少实现学生信息管理功能。

大作业测试的主要技能点:

会使用基本控件设计窗体,并合理布局,会实现MDI风格的窗体;使用ADO.NET操作数据,能将数据库中的数据读取出来显示在窗体上,能将窗体中的数据保存到数据库。

二、书写设计报告

报告封面见附录

报告内容要求,写出系统的概要设计和详细设计,详细设计中,给出每一实现模块的功能描述、界面截图、主要代码和技术要点说明。

最后给出心得体会。

 

苏州科技学院

课程结业期末测试大作业

课程名称:

C#程序设计

专业班级:

计算机科学与技术

所在院(系):

电子信息与工程学

******

指导教师:

 

填写日期:

2014年6月

 

一.系统概要设计

1.系统总体模块结构设计

学生管理系统总体结构的设计分为两个部分的设计,分别是前台界面的设计,后台代码模块的设计。

其中前台界面的设计,即对用户所属功能模块设计;而后台代码模块的设计,即对功能代码的具体实现。

系统总体模块结构图如下图4-3所示。

图1-1系统总体模块结构图

其中,后台管理模块由用户管理和学生管理等模块组成。

在后台管理模块中,各级管理员可以通过此模块对学生,用户,以及权限进行管理。

1.1系统总体处理流程

学生管理系统总体流程图的设计,后台管理模块的设计。

系统总体的流程图如图所示。

系统总体的流程图

1.2.数据库设计

1.2.1概念结构设计

通过了解学生管理系统要实现的功能,可以得学生管理数据库包含的实体有“管理员”、和“学生”。

管理员的属性有:

用户名、密码,权限

读者的属性有:

学生姓名、学号、性别、专业、、入学时间、家庭住址、所在校区、班级

在本系统中,涉及到用户、学生等实体。

它们之间的关系如图:

E-R图所示。

实体间的E-R图

1.2.2逻辑结构设计

数据库逻辑设计决定了数据库及其应用的整体性能,调优位置。

在本系统中,主要设计了管理员表和学生信息表。

表的具体设计如下:

学生信息表用于存储读者的相关信息,如:

姓名,学号,入学时间,性别,班级,专业,家庭住址,所在校区等。

表的结构如下表4-1所示

学生信息表

字段名

类型与宽度

是否主键

是否允许空值

说明

学号

varchar(50)

×

 

姓名

varchar(50)

×

×

 

性别

char(8)

×

×

入学时间

varchar(50)

×

×

专业

varchar(50)

×

×

 

班级

varchar(50)

×

×

 

家庭住址

varchar(50)

×

×

所在校区

varchar(50)

×

 

管理员表用于存储借出图书的相关信息,如:

用户名,权限。

表的结构如下表2-2所示

管理员表

字段名

类型与宽度

是否主键

是否允许空值

说明

用户名

varchar(50)

×

 

密码

varchar(50)

×

×

 

权限

char(10)

×

×

 

二系统详细设计与实现

2.1登录界面的详细设计与实现

在进入系统进行各项具有相关操作功能的操作之前,首先会先进入登录界面,在此需要输入相关的登录名和密码,并选择是登录,登录运行界面如图所示:

图5-1登录运行界面

当管理员登录进入系统后,将会进行相关的操作。

下面具体的介绍管理员各个功能模块的界面设计与实现。

实现此功能的代码如下:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

namespace学生管理系统

{

publicpartialclass登录:

Form

{

publicstaticstringname;

publicstaticstringpassword;

publicstaticstringentry;

public登录()

{

InitializeComponent();

}

privatevoidlabel2_Click(objectsender,EventArgse)

{

}

privatevoid登录_Load(objectsender,EventArgse)

{

}

privatevoidbutton1_Click(objectsender,EventArgse)

{

if(this.textBox1.Text==""||this.textBox2.Text=="")

MessageBox.Show("请输入用户名和密码");

else

{

SqlConnectioncon=newSqlConnection();//创建连接

con.ConnectionString="server=(local);database=StudentDBMS;uid=sa;pwd=123456";

con.Open();

SqlCommandcmd=con.CreateCommand();

cmd.CommandText="select*from登录";

SqlDataReaderdr=cmd.ExecuteReader();

if(dr.Read())

{

stringpower=dr[0].ToString();

主界面main=new主界面();

main.Tag=this.FindForm();

this.Visible=false;

main.ShowDialog();

this.Close();

}

else

{

MessageBox.Show("用户名或密码错误!

");

}

con.Close();

}

}

privatevoidbutton2_Click(objectsender,EventArgse)

{

this.Close();

}

publicvoidtextBox1_TextChanged(objectsender,EventArgse)

{

name=this.textBox1.Text;

SqlConnectioncon=newSqlConnection();//创建连接

con.ConnectionString="server=(local);database=StudentDBMS;uid=sa;pwd=123456";

con.Open();

SqlCommandcmd=con.CreateCommand();

cmd.CommandText="select权限from登录where姓名='"+this.textBox1.Text+"'";

SqlDataReadersqlread=cmd.ExecuteReader(CommandBehavior.CloseConnection);

if(sqlread.Read())

{

label4.Text=sqlread["权限"].ToString();

entry=this.label4.Text.Trim();

con.Close();

}

}

publicvoidtextBox2_TextChanged(objectsender,EventArgse)

{

password=this.textBox2.Text;

}

}

}

2.2后台管理模块的详细设计与实现

2.2.1学生查询模块设计与实现

学生查询模块的功能主要是根据“学号“,“姓名”,“入学时间”,“所在班级”,“家庭住址”“专业”等查询学生信息。

此页面主要是操作数据库StudenDBMS的“学生”表,使用模糊查询。

学生查询运行界面如图所示:

图:

学生查询运行界面

从界面中,实现此功能的代码如下:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

namespace学生管理系统

{

publicpartialclass查询学生:

Form

{

public查询学生()

{

InitializeComponent();

}

privatevoidlabel1_Click(objectsender,EventArgse)

{

}

privatevoidcomboBox1_SelectedIndexChanged(objectsender,EventArgse)

{

}

privatevoidbutton1_Click(objectsender,EventArgse)

{

stringtempValue=comboBox1.Items[comboBox1.SelectedIndex].ToString();

SqlConnectioncon=newSqlConnection();

con.ConnectionString="server=(local);uid=sa;password=123456;database=StudentDBMS";

if(tempValue=="姓名")

{

stringco="select*from学生where姓名='"+this.textBox1.Text+"'";

DataSetds=newDataSet();

SqlDataAdapterda=newSqlDataAdapter(co,con);

da.Fill(ds);

dataGridView1.DataSource=ds.Tables[0];

}

if(tempValue=="入学时间")

{

stringco="select*from学生where入学时间='"+this.textBox1.Text+"'";

DataSetds=newDataSet();

SqlDataAdapterda=newSqlDataAdapter(co,con);

da.Fill(ds);

dataGridView1.DataSource=ds.Tables[0];

}

if(tempValue=="学号")

{

stringco="select*from学生where学号='"+this.textBox1.Text+"'";

DataSetds=newDataSet();

SqlDataAdapterda=newSqlDataAdapter(co,con);

da.Fill(ds);

dataGridView1.DataSource=ds.Tables[0];

}

if(tempValue=="班级")

{

stringco="select*from学生where班级='"+this.textBox1.Text+"'";

DataSetds=newDataSet();

SqlDataAdapterda=newSqlDataAdapter(co,con);

da.Fill(ds);

dataGridView1.DataSource=ds.Tables[0];

}

if(tempValue=="专业")

{

stringco="select*from学生where专业='"+this.textBox1.Text+"'";

DataSetds=newDataSet();

SqlDataAdapterda=newSqlDataAdapter(co,con);

da.Fill(ds);

dataGridView1.DataSource=ds.Tables[0];

}

if(tempValue=="家庭住址")

{

stringco="select*from学生where家庭住址='"+this.textBox1.Text+"'";

DataSetds=newDataSet();

SqlDataAdapterda=newSqlDataAdapter(co,con);

da.Fill(ds);

dataGridView1.DataSource=ds.Tables[0];

}

if(tempValue=="所在校区")

{

stringco="select*from学生where所在校区='"+this.textBox1.Text+"'";

DataSetds=newDataSet();

SqlDataAdapterda=newSqlDataAdapter(co,con);

da.Fill(ds);

dataGridView1.DataSource=ds.Tables[0];

}

}

privatevoidbutton2_Click(objectsender,EventArgse)

{

this.Close();

}

}

}

 

2.2.2学生添加模块的设计与实现

学生添加运行界面如图5-3所示:

图:

学生添加运行界面

实现此功能的代码如下:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

namespace学生管理系统

{

publicpartialclass添加学生:

Form

{

public添加学生()

{

InitializeComponent();

}

privatevoid添加学生_Load(objectsender,EventArgse)

{

}

privatevoidgroupBox1_Enter(objectsender,EventArgse)

{

}

privatevoidbutton1_Click(objectsender,EventArgse)

{

if(this.textBox1.Text!

="")

{

stringa=this.textBox1.Text;

stringc=this.textBox2.Text;

stringb=this.dateTimePicker1.Value.ToShortDateString();

stringd=this.textBox4.Text;

stringer=this.textBox5.Text;

stringf=this.textBox6.Text;

stringg=this.textBox7.Text;

stringh=this.textBox8.Text;

SqlConnectioncon=newSqlConnection();

con.ConnectionString="server=(local);database=StudentDBMS;uid=sa;pwd=123456";

SqlCommandcmd=con.CreateCommand();

cmd.CommandText="insertinto学生(姓名,入学时间,学号,班级,性别,专业,家庭住址,所在校区)"+"values('"+a+"','"+b+"','"+c+"','"+d+"','"+er+"','"+f+"','"+g+"','"+h+"')";

con.Open();

intdd=cmd.ExecuteNonQuery();

if(dd==1)

{

MessageBox.Show("添加成功!

");

}

}

else

MessageBox.Show("请输入用户名!

");

}

privatevoidbutton2_Click(objectsender,EventArgse)

{

this.Close();

}

privatevoidtextBox6_TextChanged(objectsender,EventArgse)

{

}

privatevoidlabel7_Click(objectsender,EventArgse)

{

}

privatevoidtextBox1_TextChanged(objectsender,EventArgse)

{

}

}

}

2.2.3删除学生模块的设计与实现

删除学生模块的功能主要是根据学生姓名。

删除学生运行界面如图5-4所示:

图:

删除运行界面

实现此功能的代码如下:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

namespace学生管理系统

{

publicpartialclass删除学生:

Form

{

public删除学生()

{

InitializeComponent();

}

privatevoidbutton1_Click(objectsender,EventArgse)

{

DialogResultresult=newDialogResult();

result=MessageBox.Show("确定要删除该学生?

","警告!

",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);

switch(result)

{

caseDialogResult.OK:

{

SqlConnectioncon=newSqlConnection();

con.ConnectionString="server=(local);database=StudentDBMS;uid=sa;pwd=123456";

SqlCommandcmd=con.CreateCommand();

cmd.CommandText="deletefrom学生where姓名='"+this.textBox1.Text+"'";

cmd.Connection=con;

con.Open();

intd=cmd.ExecuteNonQuery();

if(d==1)

MessageBox.Show("删除成功");

}break;

caseDialogResult.Cancel:

break;

}

}

privatevoidbutton3_Click(objectsender,EventArgse)

{

this.Close();

}

privatevoidbutton2_Click(objectsender,EventArgse)

{

textBox1.Clear();

}

privatevoidbutton3_Click_1(objectsender,EventArgse)

{

this.Close();

}

privatevoidtextBox1_TextChanged(objectsender,EventArgse)

{

}

}

}

2.2.4浏览学生模块的设计与实现

浏览学生运行界面如图5-5所示:

图:

浏览学生运行界面

浏览按钮的主要代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

namespace学生管理系统

{

publicpartialclass浏览学生:

Form

{

publi

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > IT计算机 > 电脑基础知识

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2