

免费预览已结束,剩余33页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
枣 庄 学 院信息科学与工程学院课程设计任务书 题 目: 火车票系统 姓 名: 000 学 号: 000000000 专业班级: 000000000000000000000000000000 课 程: delphi应用程序设计 指导教师: 0000000 职称: 讲 师 完成时间: 2012年 12 月-2013年 1 月枣庄学院信息科学与工程学院制2012年12 月30日课程设计任务书及成绩评定课程设计的任务和具体要求 任务:1.认真学习课堂内容,根据所学内容主动完成课程设计要求的任务; 2.要充分发挥个人的自主学习的能力,利用课余时间独立完成课程设计,做到不抄袭,诚实守信。 3.课程设计代码能正常运行,代码运行情况将记入课程设计成绩,代码运行和文本书写情况各占50%;课程设计在总成绩中占15分; 4.课程设计应在本门课程结束前完成。功能要求:1.具有火车票查询预订功能 2.具有用户登录注册功能; 3具有打印各种数据表的功能指导教师签字: _ 日期: 指导教师评语成绩:_ 指导教师签字: 日期: 课程设计所需软件、硬件等所需软件:windows 7 系统sql server 2005delphi 7所需硬件:个人电脑(iterl(r) core(tm)2 duo cpu,主频2.31ghz;内存3g;硬盘320g以上;1024768显示分辨率)打印机课程设计进度计划起至日期工作内容备注12月21日12月26日12月31日1月5日搜集资料程序分析编写代码写报告书编写代码阶段要细心参考文献、资料索引序号文献、资料名称编著者出版单位1刘宇君.sql server数据库应用设计案例汇编.北京:中国铁道出版社, 2007.86-1322童爱红等.delphi数据库编程.北京:清华大学出版社, 2005.106-1583刘波.基于delphi的学生成绩管理系统j.四川大学学报,2009,(10):283摘要1、项目背景随着计算机技术的发展,特别是计算机网络技术与数据库技术的发展,使用人们的生活与工作方式发生了很大的改观。网络技术的应用使得计算机之间通信、信息共享成为可能,而数据库技术的应用则为人们提供了数据存储、信息检索、信息分析等功能,从而使得工作更高效地进行。数据库始于20世纪60年代,经过40多年的发展,现在已经形成了理论体系,成为计算机软件的一个重要分支。数据库技术体现了当代先进的数据管理方法,使计算机的应用真正渗透到国民经济各个部门,在数据处理领域发挥着越来越大的作用。而互联网技术的出现,更是进一步丰富的人类生活,数字化生存已经一步步走进我们的生活与工作。互联网技术与数据库技术的结合为计算的在人类生活中的应用带来了巨大的影响。产业信息化,管理现代化,科学化已经成为行业发展的重要课题,这不仅是企业提高自身竞争力,甚至是国家提高综合国力,走向国民富强的重要手段。在我国,许多人都要用火车出行,没到春节火车票都是十分的紧缺,给人们买票带来了不便,由此设计火车票查询管理系统。 2、编写目的根据需求分析报告,在仔细考虑之后,我又对学生成绩管理系统软件的功能划分、数据结构、软件总体结构有了进一步的想法。我将这些想法记录下来,来更为详尽的介绍这一管理系统。3、软件定义火车票该管理系统:是一个集查询和管理的一个软件,可以供管理员添加线路,删除线路,改变线路的信息,供一般用户查询讯息。 4、开发环境本系统以delphi7为开发环境,sql server 2005为数据库平台,实现火车票管理系统的制作和开发过程。目 录一 需求分析 1.1问题的提出.1 1.2系统的业务功能分析 .11.3系统业务流程分析.11.4需要完成的功能.11.5数据字典.2二 系统设计 2.1 数据表.32.2 软件功能设计.4三 系统设施 3.1 系统界面的设计.53.2 事件的过程设计.73.3 主要代码描述.7四 系统测试.274.1 注册 .274.2登录.274.3 进入管理员模块.284.4 删除路线.284.5 管理员修改密码.294.6管理员修改线路模块.29 4.7 管理员加入线路.29五 收获和体会.30 六 参考文献.30一、需求分析1、问题的提出春节期间是买票的高峰时期,很多人都因为买不到票而耽误了回家的时间,如果对火车票的情况有所先知,则可以节约买票的时间,及时选择其他出行工具,以及转乘一些其他的火车线路,由此设计火车票管理系统。供出行者买票时用。2、系统的业务功能分析(1)此系统设一个系统管理员,他需要密码才可以登录,登录后可以对火车票的信息进行管理,可以添加新的线路,删除已有的线路,进行密码修改,但是火车线路常常是固定的,因此操作也不是很平凡。(2)系统还有一般的用户登录登陆,需要注册。用户等路后可以查询车次的信息,信息包括火车票量,火车票价,各到站时间,各站出发时间,里程,运行时间,站站查询,中转查询,密码修改等。3、系统的业务流程分析用户注册系统登录管理员登录查询用户等录加入线路查询线路修改线路密码修改车次线路站站查询4、需完成的功能(1)管理员的登录(2)线路的添加,删除,修改,查看某一线路,密码修改(3)一般查询用户的登录(4)登录后可以进行车次的查询,查询结果包括,这个车次的所经沿途站点各站点到达时间,出发时间,各类票的票量,票价,站站查询,中转查询,密码修改,用户注册等。5、数据字典zhandian:车次,站次,站名,到站时间,出发时间,里程,备注checi:车次,硬座票量,卧铺票量,硬座票价,卧铺票价,备注zhandian:车次站次站名到站时间出发时间里程备注checi:车次硬座票量卧铺票量硬座票价卧铺票价备注二、系统设计卧铺票量1、数据表: e-r图卧铺票价硬座票价备注checi车次卧铺票量zhandian车次站次站名到站时间出发时间里程备注2.表的物理设计:zhandian列名数据类型长度允许空车次(key)char10no站次(key)intno站名char10到站时间char10出发时间char10里程char10备注char50checi列名数据类型长度允许空车次(key)char10no里程char10硬座票量int硬卧票量int硬座票价float硬卧票价flort备注char502、软件功能设计(1)系统的结构图密码修改用户注册删除线路系统登录管理员登录查询用户等录加入线路查询线路修改线路车次线路站站查询密码修改(2)功能表名称功能说明系统登录管理员,或者查询用户登录,用户注册管理员模块显示删除,加入,查询,修改线路,修改密码查询用户模块显示,站站查询,车次查询按钮,密码修改三、系统实施1、系统的界面设计(1)登录页面所用控件:combobox1: tcombobox;/下拉表选择用户和管理员popupmenu1: tpopupmenu;/弹出菜单n5: tmenuitem;/ 置空edit1: tedit;/用户名edit2: tedit;/密码button1: tbutton;/登陆button2: tbutton;/注册label1: tlabel;/显示用户名label2: tlabel;/显示输入密码label3: tlabel;/提示信息adoconnection1: tadoconnection;/总数据连接adoquery1: tadoquery;/用户密码查询(2)用户模块主页面所用控件:edit1: tedit;站站查询输入站点名edit2: tedit; 站站查询输入站点名 edit3: tedit;输入车次 button1: tbutton;站站查询 button2: tbutton;车次查询 label1: tlabel;提示 label2: tlabel;提示 label3: tlabel;提示 popupmenu1: tpopupmenu;弹出菜单 n1: tmenuitem;重置 datasource1: tdatasource;站站查询数据集 adoquery1: tadoquery;数据访问组件 datasource2: tdatasource; adoquery2: tadoquery; image1: timage;背景图片 dbgrid1: tdbgrid; checkbox1: tcheckbox; adoquery3: tadoquery; button3: tbutton; adoquery4: tadoquery; adoquery5: tadoquery; datasource4: tdatasource;datasource5: tdatasource; (3)管理员页面所用的控件: button1: tbutton;删除车次 button2: tbutton;修改车次 edit1: tedit;输入车次 button3: tbutton;加入车次 button4: tbutton;修改密码 adoquery1: tadoquery;数据访问 datasource1: tdatasource;数据集 adoquery2: tadoquery; datasource2: tdatasource; image1: timage;背景图片(4)用户查询结果页面所用控件 label1: tlabel;硬座票量 label2: tlabel;硬座票价 label3: tlabel;卧铺票量 label4: tlabel;卧铺票价 button1: tbutton;返回按钮 dbgrid1: tdbgrid;显示车次信息label5: tlabel;总里程(5)管理员修改页面所用控件dbgrid1: tdbgrid;zhandian修改dbgrid2:tdbgrid;checi修改(6)管理员加入路线页面dbgrid1: tdbgrid;加入zhandian dbgrid2: tdbgrid;加入checibutton1: tbutton;确定返回(7)管理员密码修改页面edit1: tedit;输入当前密码 edit2: tedit;输入新密码 edit3: tedit;重复新密码 button1: tbutton;确定 label1: tlabel;提示 label2: tlabel;提示label3: tlabel;提示(8)一般用户修改密码界面edit1: tedit;输入当前密码 edit2: tedit;输入新密码 edit3: tedit;重复新密码 button1: tbutton;确定 label1: tlabel;提示 label2: tlabel;提示label3: tlabel;提示2、事件的设计过程:当按下某一个按钮后触发按下按钮事件,进行相应的处理3、主要代码描述(1)登录模块代码unit unit1;interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, menus, stdctrls, extctrls, db, adodb, jpeg;type tform1 = class(tform) combobox1: tcombobox; popupmenu1: tpopupmenu; n5: tmenuitem; edit1: tedit; edit2: tedit; button1: tbutton; button2: tbutton; label1: tlabel; label2: tlabel; label3: tlabel; adoconnection1: tadoconnection; adoquery1: tadoquery; procedure n5click(sender: tobject); procedure combobox1change(sender: tobject); procedure button1click(sender: tobject); procedure formcreate(sender: tobject); procedure button2click(sender: tobject); private private declarations public public declarations end;var form1: tform1; passtr,helpstr:string; usstr,uspas:string;implementation uses unit2,unit5;$r *.dfmprocedure tform1.n5click(sender: tobject);begin self.edit1.text:=; self.edit2.text:=;end;procedure tform1.combobox1change(sender: tobject);begin if self.combobox1.itemindex=1 then begin self.button2.enabled:=false; self.edit1.visible:=false; self.label1.visible:=false; end else begin self.button2.enabled:=true; self.edit1.visible:=true; self.label1.visible:=true; end;end;procedure tform1.button1click(sender: tobject);var pas,pas2:string;begin if self.combobox1.itemindex=0 then begin self.adoquery1.close; self.adoquery1.sql.clear; self.adoquery1.sql.add(select * from us where 用户名=+self.edit1.text+); self.adoquery1.open; pas:=self.adoquery1.fieldbyname(密码).asstring; pas2:=edit2.text; if pas=pas2 then begin usstr:=self.edit1.text; uspas:=self.edit2.text; self.hide; form2.show; end else showmessage(用户名不存在或密码错); end else if edit2.text=passtr then begin self.hide; form5.show; end else showmessage(密码错);end;procedure tform1.formcreate(sender: tobject);var passfile,helpfile:textfile;begintry assignfile(passfile,pass.txt); reset(passfile); readln(passfile,passtr); closefile(passfile); except on tobject do showmessage(密码文件丢失); end;end;procedure tform1.button2click(sender: tobject);begin if (self.edit2.text=) or (self.edit1.text=) then begin showmessage(用户名或密码不能为空); exit; end; self.adoquery1.close; self.adoquery1.sql.clear; self.adoquery1.sql.add(select * from us where 用户名=+self.edit1.text+); self.adoquery1.open; if self.adoquery1.fieldbyname(用户名).asstring= then begin self.adoquery1.insertrecord(self.edit1.text,self.edit2.text); showmessage(注册成功); end else showmessage(用户名已经存在);end;end.(2)管理员模块主页面代码unit unit5;interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, db, adodb, stdctrls, jpeg, extctrls;type tform5 = class(tform) button1: tbutton; button2: tbutton; edit1: tedit; button3: tbutton; button4: tbutton; adoquery1: tadoquery; datasource1: tdatasource; adoquery2: tadoquery; datasource2: tdatasource; image1: timage; procedure button1click(sender: tobject); procedure button2click(sender: tobject); procedure button4click(sender: tobject); procedure button3click(sender: tobject); procedure formclose(sender: tobject; var action: tcloseaction); procedure image1click(sender: tobject); private private declarations public public declarations end;var form5: tform5;implementation uses unit1,unit6,unit7,unit8;$r *.dfmprocedure tform5.button1click(sender: tobject);begin self.adoquery1.close; self.adoquery1.sql.clear; self.adoquery1.sql.add(delete from zhandian where 车次=+self.edit1.text+); self.adoquery1.execsql; self.adoquery1.close; self.adoquery1.sql.clear; self.adoquery1.sql.add(delete from checi where 车次=+self.edit1.text+); self.adoquery1.execsql; showmessage(执行完毕);end;procedure tform5.button2click(sender: tobject);begin self.adoquery1.close; self.adoquery1.sql.clear; self.adoquery1.sql.add(select * from zhandian where 车次=+self.edit1.text+); self.adoquery1.open; self.adoquery2.close; self.adoquery2.sql.clear; self.adoquery2.sql.add(select * from checi where 车次=+self.edit1.text+); self.adoquery2.open; self.hide; form6.show;end;procedure tform5.button4click(sender: tobject);begin self.hide; form7.show;end;procedure tform5.button3click(sender: tobject);begin self.adoquery1.close; self.adoquery1.sql.clear; self.adoquery1.sql.add(select * from zhandian where 车次=+); self.adoquery1.open; self.adoquery2.close; self.adoquery2.sql.clear; self.adoquery2.sql.add(select * from checi where 车次=+); self.adoquery2.open; self.hide; form8.show;end;procedure tform5.formclose(sender: tobject; var action: tcloseaction);begin form1.show;end;procedure tform5.image1click(sender: tobject);beginend;end.(3)一般查询模块代码unit unit2;interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, menus, stdctrls, db, adodb, grids, dbgrids, jpeg, extctrls;type tform2 = class(tform) edit1: tedit; edit2: tedit; edit3: tedit; button1: tbutton; button2: tbutton; label1: tlabel; label2: tlabel; label3: tlabel; popupmenu1: tpopupmenu; n1: tmenuitem; datasource1: tdatasource; adoquery1: tadoquery; datasource2: tdatasource; adoquery2: tadoquery; image1: timage; dbgrid1: tdbgrid; checkbox1: tcheckbox; adoquery3: tadoquery; button3: tbutton; adoquery4: tadoquery; adoquery5: tadoquery; datasource4: tdatasource; datasource5: tdatasource; procedure n1click(sender: tobject); procedure button1click(sender: tobject); procedure myclose(sender: tobject; var action: tcloseaction); procedure button2click(sender: tobject); procedure dbgrid1dblclick(sender: tobject); procedure formcreate(sender: tobject); procedure button3click(sender: tobject); procedure image1click(sender: tobject); private private declarations public public declarations end;var b:integer; form2: tform2; checistr:string; bstr,estr,mstr:string; checistrar:array 0.10 of string;implementation uses unit1,unit3,unit4,unit9;$r *.dfmprocedure tform2.n1click(sender: tobject);begin self.edit1.clear; self.edit2.clear; self.edit3.clear;end;procedure tform2.button1click(sender: tobject);varszm1,szm2:string;cmd:string;begin bstr:=self.edit1.text; estr:=self.edit2.text; if (bstr=) or (estr=) then begin showmessage(查询站点不能为空); b:=0; exit; end; adoquery1.close; adoquery1.sql.clear; /查询 adoquery1.sql.add(select zd1.车次,zd1.站次,zd1.站名 as 出发站,zd2.站次, zd2.站名 as 到达站 from zhandian as zd1,zhandian as zd2 where zd1.车次=zd2.车次 and zd1.站次zd2.站次 and ); adoquery1.sql.add(+self.edit1.text+=zd1.站名 and +self.edit2.text+=zd2.站名); adoquery1.open; if adoquery1.fieldbyname(车次).asstring then begin b:=1; exit; end; showmessage(无直达车次); adoquery1.close; adoquery1.sql.clear; szm1:=(select zd2.站名 from zhandian as zd1,zhandian as zd2 where zd1.车次=zd2.车次 and zd1.站次zd2.站次 and zd1.站名=+bstr+) as zm1; szm2:=(select zd1.站名 from zhandian as zd1,zhandian as zd2 where zd1.车次=zd2.车次 and zd1.站次zd2.站次 and zd2.站名=+estr+) as zm2; cmd:=select zm1.站名 from +szm1+,+szm2+ where zm1.站名=zm2.站名; adoquery1.sql.add(cmd); adoquery1.open; if adoquery1.fieldbyname(站名).asstring= then begin showmessage(无中转方案); b:=0; exit; end; b:=2; showmessage(恭喜,可中转到达);end;procedure tform2.myclose(sender: tobject; var action: tcloseaction);begin form1.show;end;procedure tform2.button2click(sender: tobject);var checistr:string;begin checistr:=self.edit3.text; if checistr= then begin showmessage(车次不能为空); b:=0; exit; end; adoquery1.close; adoquery1.sql.clear; if self.checkbox1.checked=false then adoquery1.sql.add(select zd.*,cc.硬座票量,cc.硬座票价,cc.卧铺票量,cc.卧铺票价 from zhandian as zd,checi as cc where zd.车次=cc.车次 and zd.车次 = +checistr+) else adoquery1.sql.add(select zd.*,cc.硬座票量,cc.硬座票价,cc.卧铺票量,cc.卧铺票价 from zhandian as zd,checi as cc where zd.车次=cc.车次 and zd.车次 like %+checistr+%); adoquery1.open; b:=3;end;procedure tform2.dbgrid1dblclick(sender: tobject);var i,bs,es:single;begin case b of 0:exit; 3:exit; 2:begin / mstr:=self.dbgrid1.fields0.asstring; self.adoquery4.close; self.adoquery4.sql.clear; self.adoquery4.sql.add(select zd1.车次 as 第一车次 ,zd1.站名 as 始发站,zd2.站名 as 中转站 from zhandian as zd1,zhandian as zd2 where zd1.车次=zd2.车次 and zd1.站次zd2.站次 and zd1.站名=+bstr+and zd2.站名=+mstr+); self.adoquery4.open; self.adoquery5.close; self.adoquery5.sql.clear; self.adoquery5.sql.add(select zd1.车次 as 第二车次 ,zd1.站名 as 中转站,zd2.站名 as 终点站 from zhandian as zd1,zhandian as zd2 where zd1.车次=zd2.车次 and zd1.站次=+self.dbgrid1.fields1.asstring+ and 站次=+self.dbgrid1.fields3.asstring); self.adoquery2.open; self.adoquery2.findlast; es:=self.adoquery2.fieldbyname(里程).asfloat; self.adoquery2.findfirst; bs:=self.adoquery2.fieldbyname(里程).asfloat; self.adoquery3.close; self.adoquery3.sql.clear; self.adoquery3.sql.add(select * from checi where 车次=+self.dbgrid1.fields0.asstring+); self.adoquery3.open; i:=(es-bs)/self.adoquery3.fieldbyname(总里程).asfloat; form3.label1.caption:=硬座票价 :+floattostr(i*self.adoquery3.fieldbyname(硬座票价).asfloat); form3.label2.caption:=硬座票量 :+self.adoquery3.fieldbyname(硬座票量).asstring; form3.label3.caption:=卧铺票价 :+floattostr(i*self.adoquery3.fieldbyname(卧铺票价).asfloat); form3.label4.caption:=卧铺票量 :+self.adoquery3.fieldbyname(卧铺票量).asstring; form3.label5.caption:=总里程 :+floattostr(es-bs)+公里; form3.show; self.hide; end; end;end;procedure tform2.formcreate(sender: tobject);begin b:=0;end;procedure tform2.button3click(sender: tobject);begin self.hide; form4.show;end;procedure tform2.image1click(sender: tobject);beginend;end.(4)一般用户查询结果代码unit unit3;interfaceuses windows, message
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 气候变化环境影响评估表
- 汽车电子控制技术原理与运用试题及答案
- 合同私车租赁合同
- 地理地质地貌学题库概览
- 高新技术产业专利申请数量统计表
- 旅游业市场份额分布统计表
- Python大数据分析与挖掘实战:微课版(第2版)课件 第3章 数据处理包Pandas
- 农业生物科技实践练习题
- 那次难忘的校园活动记事类作文13篇范文
- 县域教育资源分布与基础设施现状分析
- 《现代齿轨交通设计标准》
- 南京信息工程大学《数据库原理与应用Ⅱ》2022-2023学年期末试卷
- 雨水回收系统技术规格书
- 船舶敬港与港口作业考核试卷
- 禁毒情报学习通超星期末考试答案章节答案2024年
- DB11T 1946-2021 智慧工地评价标准
- 门窗更换承包合同
- 污水管道工程施工组织设计
- 职业教育专业教学资源库建设工作方案和技术要求
- DB14T-苜蓿草颗粒生产技术规程
- 2024至2030年中国番茄行业研究及市场投资决策报告
评论
0/150
提交评论