聪明文档网

聪明文档网

最新最全的文档下载
当前位置: 首页> 驾校管理系统

驾校管理系统

时间:2015-01-10 00:02:20    下载该word文档

封面有问题

《数据库原理》

课程设计报告

计算机与信息工程系

2014121


第一章 设计内容及要求 2

1.1背景 2

1.2目的 2

1.3内容及要求 2

第二章 需求设计 2

2.1问题描述 2

2.2系统功能描述 3

第三章 概念设计 4

3.1学员基本信息 4

3.2教练员基本信息 4

3.3学员考试信息 4

3.4学员教练 5

第四章 逻辑设计 5

4.1模式设计 5

4.2子模式设计 6

第五章 物理实施 7

第六章 管理模块 9

6.1数据库的创建T-SQL语句 9

6.2数据表的创建 11

6.3触发器的定义实现 12

第七章 管理模块部分代码 14

7.1插入数据操作 14

7.2删除数据操作 15

7.3修改数据操作 17

19

8.1数据库维护 19

8.2心得体会 19

认真些,按老师要求和格式撰写

第一章 设计内容及要求

1.1背景

随着中国人民生活水平的日益提高,商业用车及私家车的数量大幅度增长,掌握驾驶技术的目的成为立足于社会的必备技术。靠汽车驾照已将成为不少人工作之余的必修课。因此,为了提高驾驶培训中心的业务管理水平和效率,降低运营成本,并适应不同的学车人员的个性化要求,以及新交规在驾驶培训方面的严格要求,急需开发一套驾校管理系统。

1.2 目的

课程设计为学生提供了一个既动手又动脑,独立实践的机会,将课本上的理论知识和实际有机的结合起来,锻炼学生的分析解决实际问题的能力。提高学生适应实际,实践编程的能力

1.3 内容及要求

利用学到的数据库概念、原理、技术以及系统知识和技能,通过布置具有一定难度的程序设计题目,帮助学生熟悉数据库应用系统的分析、设计、以及实现的过程,及时查纠错误,独立完成。要求一人一题

第二章 需求设计

2.1 问题描述

设计系统的简单描述以驾校管理员身份登录该系统界面,实现对驾校的学员信息、教练信息、学员考试信息等进行多条件组合查询,索引查看,自动安排考试日期,自动生成学费以及信息修改、录入、删除等功能。

2.2 系统功能描述

对自己所负责的功能模块,可画出所设计模块的操作流程;并分析所需要存储的数据信息。信息录入:使用C#语言设计排版编写winform窗口,给出录入信息的接口,通过C#语句实现与数据库的连接,从而向数据库中插入相应数据。 信息修改:使用C#语言设计排版编写winform窗口,给出修改信息的接口,通过C#语句实现与数据库的连接,从修改数据库中相应数据。 信息查询:winform窗口中有多条查询规则供选择(可多选),根据选择的查询条件写出相应程序语言实现与数据库的连接查询。 系统需要自动安排学员考试日期:在数据库中编写相应的trigger,当学员考试信息表中某条记录的“是否通过考试”或“是否参与考试”的值改变时,该触发器被触发,生成新一行数据。规定:①报名完成后1个月考理论,理论考试通过1个月后考倒桩,倒桩考试通过半个月后考小路,小路考试通过半个月后考大路,如果其中某次考试未通过,补考均安排在1个月后;注意周末不考试。②当大路考试通过后,不再生成新的考试信息,同时级联更新“学员基本信息”表中的“顺利结业”情况。显示照片:winform中实现学员的照片显示。数据统计:在数据库中编写相应的存储过程,输入教练编号即可select其所带学员人数。安全性:有何安全性与完整性方面的要求(参照所给出的语义规则)。如是否需要显示定义原子事务、需定义具有什么功能的存储过程、需定义具有什么功能的触发器、对不同的用户有何不同的系统使用权限等。安全性约束:“性别”(int)取值范围为[0,1];“是否色盲”(tinyint)取值范围为[0,1];“是否通过全部考试”(success)取值范围为[0,1];“计划学习/教学日”(tinyint)取值范围为[0,1];“考试内容”(smallint)取值范围为[0,3];“是否参加考试”(attend)取值范围为[0,1];“是否通过考试”(access)取值范围为[0,1];“出生年月”(datetime);“身高”(smallint)取值范围为[0,300];“体重”(smallint)取值范围为[0,300];“左眼视力”(real)取值范围为[0,6.0];“右眼视力”(real)取值范围为[0,6.0] 存储过程:①以学员编号为输入参数查询学员基本信息。②以教练员编号为输入参数统计正在跟随该教练员学习的学员人数并输出。 触发器:①当“学生考试信息表”中的补考次数大于2时,触发事件,级联更新“学员基本信息”中的学费,使学费增加10%。②当“学生考试信息”表中的“是否参与/通过考试”信息被修改时,触发事件自动生成一行新的考试信息,其中规定:1、报名完成后1个月考理论,理论考试通过1个月后考倒桩,倒桩考试通过半个月后考小路,小路考试通过半个月后考大路,如果其中某次考试未通过,补考均安排在1个月后;注意周末不考试。2、当大路考试通过后,不再生成新的考试信息,同时级联更新“学员基本信息”表中的“顺利结业”情况。

第三章 概念设计

3.1 学员基本信息

学员编号sno、姓名sname、身份证号sidno、性别ssex、出生年月sbirth、身高stature、体重sweight、左眼视力lefteye、右眼视力righteye、是否色盲colorbind、家庭住址saddr、工作单位scomp、教练员tno、学习费用sfee、照片sphoto,是否已通过全部考试success(加:联系方式scall,计划学习日期(工作日/周末)sday),报名时间(enterday),其中学员编号为主键。

3.2 教练员基本信息

教练编号tno、姓名tname、身份证号tidno、性别tsex、出生年月tbirth(加:联系方式tcall,计划教学日期(工作日/周末)tday),其中教练员编号为主键。

3.3 学员考试信息

学员编号sno、考试日期examday、考试内容(理论、倒桩、小路、大路)examinfo、补考次数bkcs、是否参加考试attend、是否通过access。其中学员编号、考试内容、补考次数共同作为主键。

3.4 学员教练

学员编号sno、教练编号tno截图如下:

第四章 逻辑设计

4.1 模式设计

按系统整体E-R模型,写出关系模式;并利用数据字典加以描述。(如每个关系模式有何属性、属性的类型、属性值的长度、是否可取空值、是否为主码、有何约束条件等信息)

4.2 子模式设计

即针对自己的设计模块的应用需定义什么样的视图表结构;并利用数据字典加以描述。(如每个关系子模式有何属性、属性的类型、属性值的长度、是否可取空值、是否为主码、有何约束条件等信息)

学员基本信息student

教练基本信息teacher

学员教练关系stte

学员考试信息exam

第五章 物理实施

为了提高在表中搜索元组的速度,在实际实现的时候应该基于某些属性建立索引。给出所建立的索引。(包括按哪些表中哪些属性按升序还是降序来创建索引及相应的T-SQL的创建语句)。

exam表建立了三个索:

CREATE INDEX syexam_examday ON exam

( examday ASC)

CREATE INDEX syexam_examinfo ON exam

( examinfo ASC)

CREATE INDEX syexam_sno ON exam

( sno ASC)

stte表建立了两个索引:

CREATE INDEX systte_sno ON stte

( sno ASC)

CREATE INDEX systte_tno ON stte

( tno ASC)

Student表建立了三个索引:

CREATE INDEX systudent_enterday ON student

( enterday ASC)

CREATE INDEX systudent_sname ON student

( sname ASC)

CREATE INDEX systudent_sno ON student

( sno ASC

第六章 管理模块

6.1 数据库的创建T-SQL语句


/*========================================*/

/* DBMS name: Microsoft SQL Server 2005 */

/* Created on: 2012/1/4 8:57:37 */

/*========================================*/

if exists (select 1

from sysobjects

where id = object_id('"CLR Trigger_student"')

and type = 'TR')

drop trigger "CLR Trigger_student"

go

if exists (select 1

from sysobjects

where id = object_id('td_student')

and type = 'TR')

drop trigger td_student

go

if exists (select 1

from sysobjects

where id = object_id('ti_student')

and type = 'TR')

drop trigger ti_student

go

if exists (select 1

from sysobjects

where id = object_id('tu_student')

and type = 'TR')

drop trigger tu_student

go

if exists (select 1

from sysobjects

where id = object_id('"CLR Trigger_stte"')

and type = 'TR')

drop trigger "CLR Trigger_stte"

go

if exists (select 1

from sysobjects

where id = object_id('td_stte')

and type = 'TR')

drop trigger td_stte

go

if exists (select 1

from sysobjects

where id = object_id('ti_stte')

and type = 'TR')

drop trigger ti_stte

go

if exists (select 1

from sysobjects

where id = object_id('tu_stte')

and type = 'TR')

drop trigger tu_stte

go

if exists (select 1

from sysobjects

where id = object_id('exam')

and type = 'U')

drop table exam

go

if exists (select 1

from sysobjects

where id = object_id('student')

and type = 'U')

drop table student

go

if exists (select 1

from sysobjects

where id = object_id('teacher')

and type = 'U')

drop table teacher

go

if exists (select 1

from sysobjects

where id = object_id('stte')

and type = 'U')

drop table stte

go


6.2 数据表的创建

T-SQL语句:


create table exam (

examday datetime null,

examinfo smallint not null,

bkcs smallint not null,

sno char(8) not null,

attend tinyint null,

access tinyint null,

constraint PK_EXAM primary key nonclustered (examinfo, bkcs, sno)

)

go

create table student (

sno char(8) not null,

tno char(8) not null,

sname varchar(10) null,

sidno char(18) null,

ssex tinyint null,

sbirth datetime null,

stature smallint null,

sweight smallint null,

lefteye real null,

righteye real null,

colorbind tinyint null,

saddr varchar(40) null,

scomp varchar(40) null,

sfee int null,

sphoto nvarchar(100) null,

success tinyint null,

scall char(11) null,

sday tinyint null,

constraint PK_STUDENT primary key nonclustered (sno)

)

go

create table teacher (

tno char(8) not null,

tname varchar(10) null,

tidno char(18) null,

tsex tinyint null,

tbirth datetime null,

tcall char(11) null,

tday tinyint null,


6.3触发器的定义实现

T-SQL语句:

1exam表中的exam_plan触发器

Create trigger exam_plan

on exam

after update

as

begin

declare @examday datetime

declare @examinfo smallint

declare @bkcs smallint

declare @sno char(8)

declare @attend tinyint

declare @access tinyint

declare @nexamday datetime--新插入数据行的数据

declare @nexaminfo smallint

declare @nbkcs smallint

declare @nsno char(8)

declare @nattend tinyint

declare @naccess tinyint

declare @week varchar(10)--标记日期为星期*”的

select @access=access from inserted

select @attend=attend from inserted

select @examinfo=examinfo from inserted

select @sno=sno from inserted

select @bkcs=bkcs from inserted

select @examday=examday from inserted

if (@access=1 and @examinfo=3)

update student set success=1 where sno=@sno

else

begin

if @access=1

begin

select @nexaminfo=@examinfo+1

select @nsno=@sno

select @nbkcs=@bkcs

select @nattend=0

select @naccess=0

if ((@nbkcs=0 and(@nexaminfo=0 or @nexaminfo=1))or @nbkcs<>0)

begin

select @nexamday=@examday+30

select @week=datename(weekday,@nexamday)

while(@week='星期六' or @week='星期日')

begin

select @nexamday=@nexamday+1

select @week=datename(weekday,@nexamday)

end

end

else

begin

select @nexamday=@examday+15

select @week=datename(weekday,@nexamday)

while(@week='星期六' or @week='星期日')

begin

select @nexamday=@nexamday+1

select @week=datename(weekday,@nexamday)

end

end

end

else

begin

select @nsno=@sno

select @nexaminfo=@examinfo

select @nbkcs=@bkcs+1

select @nattend=0

select @naccess=0

if ((@nbkcs=0 and(@nexaminfo=0 or @nexaminfo=1))or @nbkcs<>0)

begin

select @nexamday=@examday+30

select @week=datename(weekday,@nexamday)

while(@week='星期六' or @week='星期日')

begin

select @nexamday=@nexamday+1

select @week=datename(weekday,@nexamday)

end

end

else

begin

select @nexamday=@examday+15

select @week=datename(weekday,@nexamday)

while(@week='星期六' or @week='星期日')

begin

select @nexamday=@nexamday+1

select @week=datename(weekday,@nexamday)

end

end

end

insert into exam

values(@nexamday,@nexaminfo,@nbkcs,@nsno,@attend,@access)

end

end

第七章

7.1 插入数据操作

每个功能模块描述方法如下:

private void buttonbc_Click(object sender, EventArgs e)

{ ds = new DataSet();

string scomm = string.Format("select * from student where sno={0}", textBoxxybh.Text);

da = new SqlDataAdapter(scomm, conn);

da.Fill(ds, "student");

if (ds.Tables[0].Rows.Count != 0)

{ string sql = string.Format("update student set sno='{0}',sname='{1}',ssex={2},sbirth='{3}',stature={4},sweight={5},lefteye={6},righteye={7},colorblind={8},sidno='{9}',scall='{10}',saddr='{11}',scomp='{12}',success='{13}',sday={14},tno={15},sphoto='{16}',enterday='{17}'",textBoxxybh.Text, textBoxxm.Text, comboBoxxb.SelectedIndex, dateTimePicker1.Value, textBoxsg.Text, textBoxtz.Text, textBoxzysl.Text, textBoxyysl.Text, comboBoxsfsm.SelectedIndex, textBoxsfzh.Text, textBoxlxfs.Text, textBoxjtdz.Text, textBoxgzdw.Text,comboBoxsljy.SelectedIndex, comboBoxxxrq.SelectedIndex, comboBoxsljy.SelectedText, textBoxzpxz.Text, dateTimePickerrxrq.Value);

}

else

{ string sql = string.Format("insert into student values('{0}','{1}',{2},'{3}',{4},{5},{6},{7},{8},'{9}','{10}','{11}','{12}','{13}',{14},{15},'{16}','{17}')",textBoxxybh.Text, textBoxxm.Text, comboBoxxb.SelectedIndex, dateTimePicker1.Value, textBoxsg.Text, textBoxtz.Text, textBoxzysl.Text, textBoxyysl.Text, comboBoxsfsm.SelectedIndex, textBoxsfzh.Text, textBoxlxfs.Text, textBoxjtdz.Text, textBoxgzdw.Text,comboBoxsljy.SelectedIndex, comboBoxxxrq.SelectedIndex, comboBoxsljy.SelectedText, textBoxzpxz.Text, dateTimePickerrxrq.Value);

}

comm = conn.CreateCommand();

comm.CommandText = sql;

sql = string.Format("insert into stte values({0},{1})", textBoxxybh.Text, comboBoxsljy.ValueMember);

comm = conn.CreateCommand();

comm.CommandText = sql;

MessageBox.Show("保存成功!");

}

功能界面简单描述;

在相应栏目中输入要录入的信息,单击“保存”进行数据保存,单击“取消”关闭窗口。其中“性别”、“是否色盲”、“顺利结业”、“学习日期”、“教练员”为combobox类型输入可选数据中的其中一项,“照片选择”为单击上传button触发openfiledialog,选中照片路径,该路径信息将在textbox中显示,“出生日期”和“入学日期”为datetimepicker传入datetime类型的数据信息。

T-SQL语句与宿主语言嵌套使用代码段(粘贴);

public const string txt1 = @"Data Source=GUJIBALA-PC\SQLEXPRESS;Initial Catalog=kcsj_driver;Integrated Security=True;";

SqlConnection conn = new SqlConnection(txt1);

string sql = string.Format("insert into student values('{0}','{1}',{2},'{3}',{4},{5},{6},{7},{8},'{9}','{10}','{11}','{12}','{13}',{14},{15},'{16}','{17}')",textBoxxybh.Text, textBoxxm.Text, comboBoxxb.SelectedIndex, dateTimePicker1.Value, textBoxsg.Text, textBoxtz.Text, textBoxzysl.Text, textBoxyysl.Text, comboBoxsfsm.SelectedIndex, textBoxsfzh.Text, textBoxlxfs.Text, textBoxjtdz.Text, textBoxgzdw.Text,comboBoxsljy.SelectedIndex, comboBoxxxrq.SelectedIndex, comboBoxsljy.SelectedText, textBoxzpxz.Text, dateTimePickerrxrq.Value);

SqlCommand comm = conn.CreateCommand();

comm.CommandText = sql;

sql = string.Format("insert into stte values({0},{1})", textBoxxybh.Text, comboBoxsljy.ValueMember);

comm = conn.CreateCommand();

comm.CommandText = sql;

7.2删除数据操作

每个功能模块描述方法如下:

private void buttonsc_Click(object sender, EventArgs e)

{ conn.Open();

DialogResult r=MessageBox.Show("确认删除该行?","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Information);

if (r.ToString() == "Cancel")

{ return; }

else

{ ds.Tables[0].Rows[dataGridView.CurrentRow.Index].Delete();

string currentsno;

currentsno = dataGridView.Rows[dataGridView.CurrentCell.RowIndex].Cells[0].Value.ToString();//提取当前单元格所在行的sno

string sql = string.Format("delete from student where sno={0}", currentsno);

comm = conn.CreateCommand();

comm.CommandText = sql;

comm.ExecuteNonQuery();

conn.Close();

}

}

测试截图如下:

功能界面简单描述;

单击datagridview中任一数据后,若选择“删除当前行!”,则系统提示用户确认对其删除后,将该数据行从datagridview中删除,同时在数据库中进行删除操作,实现数据的删除。

T-SQL语句与宿主语言嵌套使用代码段(粘贴);

public const string txt1 = @"Data Source=GUJIBALA-PC\SQLEXPRESS;Initial Catalog=kcsj_driver;Integrated Security=True;";

SqlConnection conn = new SqlConnection(txt1);

string currentsno;

currentsno = dataGridView.Rows[dataGridView.CurrentCell.RowIndex].Cells[0].Value.ToString();//提取当前单元格所在行的sno

string sql = string.Format("delete from student where sno={0}", currentsno);

SqlCommand comm = conn.CreateCommand();

comm.CommandText = sql;

7.3 修改数据操作

每个功能模块描述方法如下:

public Form4(string x)

{ conn.Open();

InitializeComponent();

xybh = x;

DataSet ds =new DataSet();

string item=string.Format("select * from student where sno={0}",xybh);

ds = new DataSet();

da = new SqlDataAdapter(item, conn);

da.Fill(ds, "student");

textBoxxybh.Text = xybh;

if (ds.Tables[0].Rows.Count != 0)//即说明xybh这个学号是存在的,则各个textboxcombobox中显示已有信息

{ //学员姓名

SqlCommand myc = new SqlCommand("rsname", conn);

myc.CommandType = CommandType.StoredProcedure; //调用数据库中的存储过程“rsname”,输入学号返回姓名

myc.Parameters.Add(new SqlParameter("@@sno",SqlDbType.Char,8));

myc.Parameters["@@sno"].Value=xybh;

myc.Parameters.Add(new SqlParameter("@@sname", SqlDbType.VarChar, 40));

myc.Parameters["@@sname"].Direction = ParameterDirection.ReturnValue;

if (myc.Parameters["@@sname"].Value != null)

{ textBoxxm.Text = myc.Parameters["@@sname"].Value.ToString(); }

//其他textbox同样方法调用 数据库中的存储过程 返回希望得到的相应值

conn.Close();

}

}

测试截图如下:

功能界面简单描述;

输入学员编号后,经判断知该学号为已存在学号,则此时希望进行修改操作,与添加界面相同,但是相应的textboxcomboboxdatetimepiker中显示数据库中已有信息,减少输入的重复操作,最后与添加操作类似,单击“保存”button即可。


8.1数据库维护

数据库维护具体是指备份系统数据、数据库、事务日志、数据库及其日志间的相互作用,万一系统失败时恢复数据库系统,在数据库系统运行过程中必须不断地对其进行评价、调整与修改

8.2心得体会

通过本次课程设计,我对本学期所学的“数据库”及“C#”两门课程都有了更深一层的理解和学习。对数据库的认识不再停留在基础知识的认识上,能够更加清楚其后台工作状况,熟悉其语言特点及规则,通过创建具有复杂功能的触发器、存储结构,拓展数据库的功能。尤其是在需求分析的过程和复杂触发器的创建过程。需求分析中我学到了一些帮助考虑需求的思想,能够更大程度的避免创建数据库后,出现频繁更改值类型或列名等行为;创建复杂触发器的过程让我更加透彻理解数据库的语言精髓,对于日后sql语句的编写应用有很大帮助。对于C#的应用不再停留于简单的winform窗口,而是做到与数据库进行连接,通过winform的前台接口,对数据库传入相应的sql语句,从而实现数据库的插入、更新、删除等操作,实现sql语句的前台明了化。

在实践中与搭档秦嘉颖的协调工作很成功,根据我们相互的特长,秦嘉颖主要负责编写数据库中的sql语句,如触发器、存储过程的生成等;而我主要负责winform界面设计及winform与数据库的连接编程。我们的工作并不是单一进行的,而是相互交流,相互检查发现问题并共同讨论解决的,所以不仅做到了扬长避短,还通过对方的教导弥补了自己的弱项。

相信这次设计对于日后的软件程序设计都有很大帮助!

免费下载 Word文档免费下载: 驾校管理系统

  • 29.8

    ¥45 每天只需1.0元
    1个月 推荐
  • 9.9

    ¥15
    1天
  • 59.8

    ¥90
    3个月

选择支付方式

  • 微信付款
郑重提醒:支付后,系统自动为您完成注册

请使用微信扫码支付(元)

订单号:
支付后,系统自动为您完成注册
遇到问题请联系 在线客服

常用手机号:
用于找回密码
图片验证码:
看不清?点击更换
短信验证码:
新密码:
 
绑定后可用手机号登录
请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系 在线客服