长途客运站管理系统数据库课设.docx

上传人:b****3 文档编号:4229601 上传时间:2022-11-28 格式:DOCX 页数:25 大小:146.23KB
下载 相关 举报
长途客运站管理系统数据库课设.docx_第1页
第1页 / 共25页
长途客运站管理系统数据库课设.docx_第2页
第2页 / 共25页
长途客运站管理系统数据库课设.docx_第3页
第3页 / 共25页
长途客运站管理系统数据库课设.docx_第4页
第4页 / 共25页
长途客运站管理系统数据库课设.docx_第5页
第5页 / 共25页
点击查看更多>>
下载资源
资源描述

长途客运站管理系统数据库课设.docx

《长途客运站管理系统数据库课设.docx》由会员分享,可在线阅读,更多相关《长途客运站管理系统数据库课设.docx(25页珍藏版)》请在冰豆网上搜索。

长途客运站管理系统数据库课设.docx

长途客运站管理系统数据库课设

长途汽车信息管理系统

1.需求分析阶段

行之有效的信息系统也成为一个企业或组织生存和发展的重要条件。

因此,作为信息系统核心和基础数据库技术得到越来越广泛的应用,越来越多新的应用领域采用数据库技术来存储和处理信息资源。

本次的课程设计我选择的课题是长途汽车信息管理系统,立足于社会随着社会的不断发展,技术的不断进步,信息技术和数据处理速度越来越引起人们的重视,因为信息的大量而快速的传递,大批量数据的处理单靠人工是不可靠的,也是不实现的。

汽车信息管理数据库系统是面向所有汽车的数据管理系统,它以处理为中心,重点是进行查询,打印客户所需信息。

开发主要包括数据库的建立和维护。

长途汽车信息管理系统是长途汽车车站信息汇总和管理的重要组成部分,是一种典型的信息管理系统,囊括了对长途汽车车站相关信息的管理,可以建华繁琐的工作过程,使车站的管理更加的合理化和科学化,大大提高工作效率和节省运营成本。

信息资源已成为各个部门的重要财富和资源,建立一个满足各级部门信息处理要求的实际,着眼于未来发展,建成符合标准化协议、通用性较强、实用的系统,以提高汽车调度的现代化管理水平,实现信息资源的共享。

22

2.长途汽车信息管理系统的目的

在信息技术高度发达的今天,传统手工记录客运站信息,已满足不了管理人员方便的处理这些信息,降低他们的工作量是一个需要解决额问题。

借助计算机来完成这些大量冗杂的工作。

能大大降低管理员的强度。

这里开发一长途客运站的班车信息管理系统,旨在为客运信息管理员提供一个可行方案。

通过利用计算机上的程序,按规范管理长途客运信息。

方便查询班车线路情况、各个班次的售票情况,以及每个班次的班车信息。

方便管理员的查询,及修改长途汽车线路信息、汽车信息和车票信息。

将录入操作交给电脑来完成。

这样既能减少管理员的工作量还能满足日益增长的需求。

也借以说明计算机技术和科技创新的重要意义

早期的长途汽车站信息主要是人工信息、人工管理的,不仅不容易记录,而且还不容易保存。

随着计算机的不断普及和软件系统开发的迫切需要,计算机长途汽车站信息管理系统应运而生了。

随着市场经济的不断飞速发展,交通道路环境的不断改善,人们的出行次数也不断增多,人口流动频繁,数量不断增大,车站信息量迅猛增长,长途汽车站信息管理系统在人们的日常生活中发挥着越来越重要的作用。

本系统实现了汽车线路信息、汽车信息、票价信息的查询和管理,满足人们的需求

 

模块功能分析如下:

线路分析:

包括出发地、目的地、出发时间、所需时间、到达时间等。

汽车模块:

包括汽车的种类及相应的票价、最大载客量等。

车票模块:

包括售票情况、查询、打印相应的信息等。

乘客模式:

包括出发地、目的地、乘车时间等。

3、概念结构设计

汽车信息管理系统就是根据车站发展的需要而建立的典型的信息管理系统。

经分析,长途汽车信息的管理系统的E-R图如下:

各实体及属性如下:

 

图3.1图3.2

 

图3.3图3.4

 

各实体间的E-R图如下:

 

 

 

图3.5

 

关系图:

M_Route

Rno:

varchar(5)PRIMARYKEY

Departure:

varchar(20)

Destination:

varchar(20)

AddT:

varchar(10)

Stime:

time

Spend:

time

汽车信息管理系统

M_Vehicle

Vnochar(8)PRIMARYKEY

VTypechar(20)

TPriceint

VLoadint

Rnovarchar(5)

 

M_TInfo

Vnochar(8)

TDatedate

TRestint

PRIMARYKEY(Vno,TDate)

 

图3.6

4、逻辑结构设计

(1)票务信息表

图4.1

(2)线路信息表

图4.2

(3)汽车信息表:

图4.3

(4)乘客信息表:

图4.4

对应SQL语句如下:

建库

CREATEDATABASEM_BUS;

建表

CREATETABLEM_Route

Rnovarchar(5)PRIMARYKEY,

Departurevarchar(20),

Destinationvarchar(20),

AddTvarchar(10),

Stimetime,

Spendtime

);

CREATETABLEM_Vehicle

Vnochar(8)PRIMARYKEY,

VTypechar(20),

TPriceint,

VLoadint,

Rnovarchar(5),

FOREIGNKEY(Rno)REFERENCESM_Route(Rno)

);

CREATETABLEM_TInfo

Vnochar(8),

TDatedate,

TRestint,

PRIMARYKEY(Vno,TDate),

FOREIGNKEY(Vno)REFERENCESM_Vehicle(Vno)

);

5、功能处理

1、数据更新

①插入

INSERT

INTOM_Route(Departure,Destination,AddT,Stime,Spend)

VALUES('沈阳','长春','南线','00:

00:

00','00:

00:

00');

INSERT

INTOM_Vehicle(Vno,TPrice,VLoad,VType,Rno)

VALUES('吉ABE506',200,42,'copper',’T60','d线');

INSERT

INTOM_TInfo(Vno,TDate,TRest)

VALUES('吉ABE106','2015-01-10',4);(前面已插入)

②修改

ALTERTABLEM_Vehicle

ADDDeparturevarchar(20);

ALTERTABLEM_Vehicle

ADDFOREIGNKEY(Departure)REFERENCESM_Route(Departure);

ALTERTABLEM_Vehicle

DROPCOLUMNDepature;

UPDATEM_TInfo

SETVno='吉ABE506'

WHEREVno='吉BE506'

UPDATEM_Route

SETAddT='d线'

WHEREDestination='芜湖';

③删除

ALTERTABLEM_Vehicle

DROPCOLUMNDepature;

 

2.数据查询

SELECT*

FROMM_TInfo;

SELECT*

FROMM_Route;

 

SELECT*

FROMM_VEHICLE;

(见上图)

SELECT*

FROMM_User

图5.1

select*

from(selectM_Route.Rno,SUM(TRest)sum

fromM_Route,M_Vehicle,M_TInfo

where

M_Route.Rno=M_Vehicle.Rnoand

M_Vehicle.Vno=M_TInfo.Vnoand

Departure='北京'and

Destination='长春'and

TDate='2015/01/11'

groupbyM_Route.Rno)x,M_Route

wherex.Rno=M_Route.Rno;

6.应用程序开发过程

(1)登录窗体

图6.1

源代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Threading.Tasks;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

 

namespaceMSY_SQL_Work

{

publicpartialclassForm1:

Form

{

publicForm1()

{

InitializeComponent();

}

privatevoidLogIn_Click(objectsender,EventArgse)

{

stringuserName=txtname.Text.Trim();//去空格

stringpassword=txtpwd.Text.Trim();

stringconnString="DataSource=.\\SQLEXPRESS;InitialCatalog=MSY_12_24;IntegratedSecurity=True";

SqlConnectionconnection=newSqlConnection(connString);

stringsql=string.Format("selectcount(*)fromM_UserwhereUSERNAME='{0}'andPWD='{1}'",userName,password);

try

{

connection.Open();

SqlCommandcommand=newSqlCommand(sql,connection);

intnum=(int)command.ExecuteScalar();

if(num>0)

{

MainMenufm=newMainMenu(userName);

fm.Show();

this.Visible=false;

}

else

{

txtpwd.Text="";

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

","登录失败",MessageBoxButtons.OK,MessageBoxIcon.Information);

}

}

catch(Exceptionex)

{

MessageBox.Show(ex.Message,"操作数据库失败",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);

}

finally

{

connection.Close();

}

}

}

}

(2)主菜单窗体

源代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Threading.Tasks;

usingSystem.Windows.Forms;

namespaceMSY_SQL_Work

{

publicpartialclassMainMenu:

Form

{

privatestringUserName;

publicMainMenu(stringrcv)

{

UserName=rcv;

InitializeComponent();

}

privatevoidMSelect_Click(objectsender,EventArgse)

{

Checkfm=newCheck(UserName);

fm.Show();

this.Visible=false;

}

privatevoidMInsert_Click(objectsender,EventArgse)

{//管理员身份验证未实现

if(UserName=="MSY")

{

MInsertMI=newMInsert(UserName);

MI.Show();

this.Visible=false;

}

else

MessageBox.Show("非管理员身份请勿修改信息!

","NO!

",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);

}

privatevoidMDelete_Click(objectsender,EventArgse)

{

MDeleteMD=newMDelete(UserName);

MD.Show();

this.Visible=false;

}

privatevoidMUpdate_Click(objectsender,EventArgse)

{

MUpdateMU1=newMUpdate(UserName);

MU1.Show();

this.Visible=false;

}

privatevoidMainQuit_Click(objectsender,EventArgse)

{

Application.Exit();

}

}

}

(3)删除窗口

源代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Threading.Tasks;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

namespaceMSY_SQL_Work

{

publicpartialclassMDelete:

Form

{

privatestringUserName;

publicMDelete(stringrcv)

{

UserName=rcv;

InitializeComponent();

DelDate.Visible=false;

}

privatevoidDeleteTable_SelectionChangeCommitted(objectsender,EventArgse)

{

ComboBoxsenderCombox=(ComboBox)sender;

if(senderCombox.SelectedItem.ToString()=="删除路线信息")

{

txtPmk.Text="请输入待删除车次";

DelDate.Visible=false;

}

elseif(senderCombox.SelectedItem.ToString()=="删除车辆信息")

{

txtPmk.Text="请输入待删除车辆车牌号";

DelDate.Visible=false;

}

else

{

txtPmk.Text="请输入待删除票务车牌号";

DelDate.Visible=true;

DelDate.Text="请输入日期";

}

}

privatevoidDeBack_Click(objectsender,EventArgse)

{

MainMenuMM2=newMainMenu(UserName);

MM2.Show();

this.Visible=false;

}

privatevoidDelOK_Click(objectsender,EventArgse)

{

stringPmkTxt,STable,Date;

stringconnString="DataSource=.\\SQLEXPRESS;InitialCatalog=MSY_BUS;IntegratedSecurity=True";

SqlConnectionconnection=newSqlConnection(connString);

stringsql;

intresult=0;

STable=DeleteTable.SelectedItem.ToString();

PmkTxt=txtPmk.Text.Trim();

Date=DelDate.Text.Trim();

if(STable=="删除路线信息")

sql=string.Format("DELETEFROMM_RouteWHERERno='{0}'",PmkTxt);

elseif(STable=="删除车辆信息")

sql=string.Format("DELETEFROMM_VehicleWHEREVno='{0}'",PmkTxt);

else

sql=string.Format("DELETEFROMM_TInfoWHEREVno='{0}'andTDate='{1}'",PmkTxt,Date);

try

{

connection.Open();

SqlCommandcommand=newSqlCommand(sql,connection);

result=command.ExecuteNonQuery();

}

catch(Exceptionex)

{

MessageBox.Show(ex.Message,"mmm操作数据库删除失败",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);

}

finally

{

connection.Close();

if(result==1)

{

MessageBox.Show("删除数据成功!

","OK",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);

txtPmk.Clear();

DelDate.Clear();

}

elseif(result==0)

MessageBox.Show("删除数据失败!

请检查是否是输入有误","OK",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);

}

}

}

}

(4)插入窗口

源代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Threading.Tasks;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

namespaceMSY_SQL_Work

{

publicpartialclassMInsert:

Form

{

privatestringUserName;

publicMInsert(stringrcv)

{

UserName=rcv;

InitializeComponent();

}

privatevoidInsBack_Click(objectsender,EventArgse)

{

MainMenuMM2=newMainMenu(UserName);

MM2.Show();

this.Visible=false;

}

privatevoidOK_Click(objectsender,EventArgse)

{

stringRno,Departure,Destination,AddT,Stime,Spend,Vno,VType,VLoad,TPrice,TRest,TDate;

stringconnString="DataSource=.\\SQLEXPRESS;InitialCatalog=MSY_BUS;IntegratedSecurity=True";

SqlConnectionconnection=newSqlConnection(connString);

stringsql;

if(InsertMode.SelectedTab==Route)

{

Rno=txtRno.Text.Trim();//去空格

Departure=txtdepa.Text.Trim();

Destination=txtdest.Text.Trim();

AddT=txtad.Text.Trim();

Stime=txtst.Text.Trim();

Spend=txtsp.Text.Trim();

sql=string.Format("INSERTINTOM_Route(Rno,Departure,Destination,AddT,Stime,Spend)VALUES('{0}','{1}','{2}','{3}','{4}','{5}');",Rno,Departure,Destination,AddT,Stime,Spend);}

elseif(InsertMode.SelectedTab==Vehicle)

{

Vno=txtVno.Text.Trim();

Rno=txtRno2.Text.Trim();

VType=txtVType.Text.Trim();

TPrice=txtTPrice.Text.Trim();

VLoad=txtVLoad.Text.Trim();

sql=string.Format("INSERTINTOM_Vehicle(Vno,VType,TPrice,VLoad,Rno)VALUES('{0}','{1}','{2}','{3}','{4}');",Vno,VType,TPrice,VLoad

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

当前位置:首页 > 农林牧渔 > 畜牧兽医

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1