旅游风景门票销售系统_第1页
旅游风景门票销售系统_第2页
旅游风景门票销售系统_第3页
旅游风景门票销售系统_第4页
旅游风景门票销售系统_第5页
已阅读5页,还剩19页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、word 门票管理系统1 需求分析需求分析是介于系统分析阶段和软件设计阶段之间的重要桥梁。一方面,需求分析以系统规格说明和工程规划作为分析活动的根本出发点,并从软件角度对它们进行检查与调整;另一方面,需求规格说明又是软件设计、实现测试直至维护的主要根底。良好的分析活动有助于防止或尽早发现早期的错误,从而提高软件生产率,降低开发本钱,改良软件质量。旅游景点门票销售系统共分为5个模块:主界面、营业员管理模块、门票管理模块、售票管理模块和业务统计模块。主界面:该模块是执行后的第一级界面,里面包含了营业员管理模块、门票管理模块和售票管理模块。; 营业员管理模块:该模块包含营业员的全部信息,可以对营业员

2、信息进行查找、删除和修改等相关操作;门票管理模块:包含门票的全部信息,可以对门票进行修改添加删除等操作售票管理模块:该模块负责办理售票和退票。业务统计模块:该模块可以统计指定日期的门票销售情况、统计指定月份的门票销售情况、统计指定日期各种价格的门票销售情况、统计指定营业员指定日期的收费情况2 概念结构设计 2.1E-R图在需求分析的根底上设计出能够满足用户需求的各种实体以及它们之间的关系。下面例举出各实体的实体图及实体关系E-R图性别年龄编号营业员地点姓名编号分类地点销售类型价格编号日期门票价格地点类型分类 图1.各实体关系E-R图2.2系统说明书本系统采用 SQL Server2005数据库

3、为数据库开发工具,建立一个数据库,其中包括多个表,并为之定义了相应的关系以适应本系统所需的功能。利用vs2022连接到数据库,建立假设干窗口,实现相应信息管理功能。系统要求l 实现票价管理应分老年、小孩、成人、团体等;l 实现营业员管理;l 实现门票销售、退票管理;l 创立存储过程统计指定日期的门票销售情况;l 创立存储过程统计指定月份的门票销售情况;l 创立存储过程统计指定日期各种价格的门票销售情况;l 创立存储过程统计指定营业员指定日期的收费情况;l 创立表间关系。 3 逻辑结构设计 3.1数据项营业员管理数据项数据类型长度允许空编号 char9姓名 char10性别 char2年龄 ch

4、ar10地点 char10门票管理数据项数据类型长度允许空编号char9地点char10价格char10类型char10 分类char10 售票管理数据项数据类型长度允许空编号char9地点char10分类char10类型char10价格char10日期Datatime 3.2系统结构图 旅游风景门票销售系统门票管理营业员管理售票管理修改奖惩信息添加奖惩信息查找修改删除查找修改删除查找修改删除4 物理设计4.1存储安排 在该系统中,门票管理中的编号属性为主码,其在营业员管理表和售票管理表中都作为外码被参照。营业员管理表的主码为编号,地点,售票管理表的主码为编号,分类,日期 5 数据库实施5.1

5、数据库建表和插入数据1营业员管理: create table 营业员(编号 char (9) primary key,姓名 char (10),性别 char (2),年龄 char (10),地点 char (10),);2门票管理: create table 门票(编号 char (9),地点 char (10),分类 char (2),类型 char (10),价格 char (10),primary key (编号,分类),foreign key (编号) references 营业员(编号);3售票管理:create table 售票(编号 char (9),地点 char (10)

6、,分类 char (2),类型 char (10),价格 char (10),日期 datetime,primary key (编号,分类,日期),foreign key (编号) references 营业员(编号);6局部插入代码insertinto 营业员values(1001,张三,男,19,中山公园);insertinto 门票values(1001,中山公园,30,成人票);insertinto 售票values(1001,中山公园,01,成人票,30,2022-10-12 00:00:00);5.2 主要功能代码 以营业员管理模块为例:(1) 查询信息using System;u

7、sing System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Reflection;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms; private void button2_Click(object sender, EventArgs e) string consqlserver = Data Sou

8、rce=WS-PC;Initial Catalog=jn;uid=sa; pwd=sa;/定义连接数据源SqlConnection sqlcon = new SqlConnection(consqlserver);sqlcon.Open();try DataSet ds = new DataSet();/ 在此判断保存重复记录问题string strSqls; strSqls = string.Format(SELECT * FROM 根本信息 where 教师编号= + textBox1.Text.Trim() + );/定义SQL Server连接对象SqlConnection con =

9、 new SqlConnection(consqlserver);SqlDataAdapter da = new SqlDataAdapter(strSqls, con);da.Fill(ds);strSqls = select * from 根本信息 where 教师编号= + textBox1.Text.Trim() + ;/定义SQL Server连接对象SqlConnection cons = new SqlConnection(consqlserver);SqlCommand cmd = new SqlCommand(strSqls, cons);trycons.Open();cmd

10、.ExecuteNonQuery();catch finallycons.Close();cons.Dispose();cmd.Dispose();string sqls = select * from 根本信息 ;SqlDataAdapter da1 = new SqlDataAdapter(sqls, con);da1.Fill(ds);if (ds.Tables0.Rows.Count 1)dataGridView1.DataSource = ds.Tables0;catch 2插入 private void button4_Click(object sender, EventArgs

11、e) string consqlserver = Data Source=WS-PC;Initial Catalog=jn;uid=sa; pwd=sa;/定义连接数据源SqlConnection sqlcon = new SqlConnection(consqlserver);sqlcon.Open();try/ 首先判断输入信息是否完全if (textBox1.Text = )MessageBox.Show(请输入完整的数据信息, 信息提示, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBox

12、Icon.Warning);elseDataSet ds = new DataSet();/ 在此判断保存重复记录问题string strSqls;strSqls = string.Format(SELECT * FROM 营业员 where编号= + textBox1.Text.Trim() + ;); /定义SQL Server连接对象 SqlDataAdapter da = new SqlDataAdapter(strSqls, sqlcon);da.Fill(ds);if (ds.Tables0.Rows.Count 1) MessageBox.Show(已经存在, 信息提示, Sys

13、tem.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);elsestrSqls = insert into 根本信息 values ( + textBox1.Text.Trim() + , + textBox2.Text.Trim() + , + textBox3.Text.Trim() + , + textBox4.Text.Trim() + , + textBox5.Text.Trim() + );/定义SQL Server连接对象SqlConnection sqlcon1 = n

14、ew SqlConnection(consqlserver);SqlCommand cmd = new SqlCommand(strSqls, sqlcon1);trysqlcon1.Open();cmd.ExecuteNonQuery();catch finallysqlcon1.Close();sqlcon1.Dispose();cmd.Dispose(); MessageBox.Show(保存成功, 信息提示, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Informatio

15、n); /刷新数据 string sqls = select * from 根本信息 ; SqlDataAdapter da1 = new SqlDataAdapter(sqls, sqlcon);da1.Fill(ds);if (ds.Tables0.Rows.Count 1)dataGridView1.DataSource = ds.Tables0;catch 3修改 private void button3_Click(object sender, EventArgs e)string consqlserver = Data Source=WS-PC;Initial Catalog=jn

16、;uid=sa; pwd=sa;/定义连接数据源 SqlConnection sqlcon = new SqlConnection(consqlserver);sqlcon.Open();tryif (textBox1.Text = )MessageBox.Show(请输入编号, 信息提示, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); elseDataSet ds = new DataSet();string strSqls = string.Format(SE

17、LECT * FROM 营业员 where 编号= + textBox1.Text.Trim() + );/ string strSqls = string.Format(update teacher set tname= + textBox2.Text.Trim() + where tno= + textBox1.Text.Trim() + ); SqlConnection con = new SqlConnection(consqlserver); SqlDataAdapter da = new SqlDataAdapter(strSqls, con);/定义SQL Server连接对象d

18、a.Fill(ds);strSqls = string.Format(update 营业员 set 姓名= + textBox2.Text.Trim() + where 编号= + textBox1.Text.Trim() + );strSqls = string.Format(update 营业员 set 性别= + textBox3.Text.Trim() + where编号= + textBox1.Text.Trim() + );strSqls = string.Format(update营业员set 年龄= + textBox4.Text.Trim() + where编号= + tex

19、tBox1.Text.Trim() + );strSqls = string.Format(update营业员set 地点= + SqlConnection cons = new SqlConnection(consqlserver);SqlCommand cmd = new SqlCommand(strSqls, cons);trycons.Open();cmd.ExecuteNonQuery();catch finallycons.Close();cons.Dispose();cmd.Dispose();MessageBox.Show(修改成功, 信息提示, System.Windows.

20、Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);/刷新数据string sqls = select * from 营业员;SqlDataAdapter da1 = new SqlDataAdapter(sqls, con);DataSet dss = new DataSet();da1.Fill(dss);if (dss.Tables0.Rows.Count 1)dataGridView1.DataSource = dss.Tables0; catch 4删除private void bu

21、tton5_Click(object sender, EventArgs e) string consqlserver = Data Source=WS-PC;Initial Catalog=jn;uid=sa; pwd=sa;/定义连接数据源 SqlConnection sqlcon = new SqlConnection(consqlserver);sqlcon.Open();tryif (textBox1.Text = )MessageBox.Show(请选择或输入要删除的编号信息, 信息提示, System.Windows.Forms.MessageBoxButtons.OK, Sys

22、tem.Windows.Forms.MessageBoxIcon.Warning); elseDataSet ds = new DataSet();/ 判断要删除的数据信息是否存在string strSqls;strSqls = string.Format(SELECT * FROM 营业员 where 编号= + textBox1.Text.Trim() + );/定义SQL Server连接对象SqlConnection con = new SqlConnection(consqlserver);SqlDataAdapter da = new SqlDataAdapter(strSqls,

23、 con);da.Fill(ds);if (ds.Tables0.Rows.Count 0) if (MessageBox.Show(确认要删除该信息吗?, 信息提示, System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) = System.Windows.Forms.DialogResult.Yes)/定义删除数据信息的SQL语句strSqls = string.Format(delete from 营业员 where 编号= + textBox1.Text.Tr

24、im() + );/定义SQL Server连接对象 SqlConnection cons = new SqlConnection(consqlserver); SqlCommand cmd = new SqlCommand(strSqls, cons);trycons.Open();cmd.ExecuteNonQuery();catch finallycons.Close();cons.Dispose();cmd.Dispose();MessageBox.Show(信息删除成功, 信息提示, System.Windows.Forms.MessageBoxButtons.OK, System.

25、Windows.Forms.MessageBoxIcon.Information);/刷新数据string sqls = select * from 营业员 ;SqlDataAdapter da1 = new SqlDataAdapter(sqls, con);DataSet dss = new DataSet();da1.Fill(dss);if (dss.Tables0.Rows.Count 0)dataGridView1.DataSource = dss.Tables0;catch 5.3 测试结果1初始界面2营业员管理3门票系统4售票管理5业务统计6 存储过程功能代码6.1存储过程创立

26、局部create procedure 指定日期售票统计asselect 类型,count(类型)from 售票where 日期=2013-10-12group by 类型gocreate procedure 指定日期和价格asselect 类型,count(类型),价格from 售票where 日期=2013-11-12 and 价格=20group by 类型,价格gocreate procedure 指定日期和营业员asselect 类型,count(类型),编号from 售票where 日期=2013-10-12 and 编号=1001group by 类型,编号go6.2存储过程调用局

27、部string consqlserver = Data Source=WS-PC;Initial Catalog=jn;uid=sa; pwd=sa;string sql = select * from 售票 ;SqlConnection conn = new SqlConnection(consqlserver);/建立数据库连接conn.Open();SqlCommand comm = new SqlCommand(指定日期,conn);/把Command执行类型改为存储过程方式,默认为Text。 comm.CommandType = CommandType.StoredProcedure;comm.ExecuteNonQuery();conn.Close();/使用SqlDataAdapter将自动完成数据库的翻开和关闭过程,

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论