《c出租汽车管理系统》由会员分享,可在线阅读,更多相关《c出租汽车管理系统(17页珍藏版)》请在金锄头文库上搜索。
1、河南机电高等专科学校学生课程设计报告实验课程名称 C#系统开发 开课实验室 系、部 计科系 年级 11 专业班 软件 学 生 姓 名 胡玉祥 学 号 111012140 开 课 时 间 2012 至 2013 学年第 二 学期总 成 绩教师签名C#程序设计课程设计报告 2013年6月17日系部计科系年级、专业、班软件技术姓名胡玉祥课程名称C#系统开发项目名称安达出租汽车公司管理信息系统指导教师教师评语教师签名:年 月 日一、课程设计目的1.熟练掌握C#中数据库的使用。2.培养解决具体问题的能力。二、实验环境开发环境: Windows xp硬件实现: Intel core i3-370 4G 内
2、存 500G 硬盘开发语言: C#数 据 库: Microsoft SQL Server 2008开发工具: Microsoft Visual Studio 2010三、实验过程及内容(1)需求分析随着人们生活水平的不断提高,人们对于车的需求越来越多,然而租车呢已经成为了没有车,买不起车,但也需要用车的人的一种不错的选择,所以这些出租汽车的公司就慢慢的火了起来。随着计算机技术的不断发展用计算机来管理这些业务既方便,又快捷,所以有必要设计一个出租车管理系统。(2)功能分析车辆租赁系统中涉及的角色包括:系统管理员、普通员工、客户。不同的角色对系统的使用权限不同。其中系统管理员拥有对系统的最高权限,
3、能够在该系统中执行所有管理工作;普通员工拥有对系统在权限内的查询、删除、修改操作;客户对系统进行预约、租车操作。这里按不同的角色来组织用例。汽车管理系统的主要功能模块图如下图:(3)数据库关系图(4)系统E-R图(5)系统流程图(6)系统主要代码 登录窗体的代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Window
4、s.Forms;using System.Security.Cryptography;using System.Data.SqlClient;namespace 安达出租汽车公司管理信息系统 public partial class 登录窗体 : Form public 登录窗体() InitializeComponent(); /记录用户登录次数 private int MyTryCount = 0; private void button1_Click(object sender, EventArgs e) String MySQLConnectionString = global:安达出
5、租汽车公司管理信息系统.Properties.Settings.Default.andasjkConnectionString; string MySQL = Select COUNT(*) From 操作用户 Where 员工编号=用户名称 AND 员工密码=用户密码; SqlConnection MyConnection = new SqlConnection(MySQLConnectionString); MyConnection.Open(); SqlCommand MyCommand = new SqlCommand(MySQL, MyConnection); MyCommand.P
6、arameters.Clear(); SqlParameter MySqlNameParameter = new SqlParameter(); MySqlNameParameter.ParameterName = 用户名称; MySqlNameParameter.Value = this.textBox1.Text; MyCommand.Parameters.Add(MySqlNameParameter); SqlParameter MySqlPWParameter = new SqlParameter(); MySqlPWParameter.ParameterName = 用户密码; My
7、SqlPWParameter.Value = Yh.haxisf(textBox2.Text); MyCommand.Parameters.Add(MySqlPWParameter); int MyCount = (int)MyCommand.ExecuteScalar(); if (MyCount = 1) Yh.yuangbh = textBox1.Text; this.DialogResult = DialogResult.OK; /this.Close(); else this.MyTryCount += 1; if (this.MyTryCount != 3) int MyDoCou
8、nt = 3 - this.MyTryCount; MessageBox.Show(用户密码或用户名称有错,还有 + MyDoCount + 次机会!, 信息提示, MessageBoxButtons.OK, MessageBoxIcon.Information); this.textBox1.Text = ; this.textBox2.Text = ; else button2_Click(null, null); private void button2_Click(object sender, EventArgs e) this.DialogResult = DialogResult.
9、Cancel; 主窗体的代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace 安达出租汽车公司管理信息系统 public partial class Form1 : Form public Form1() Initial
10、izeComponent(); private void Form1_Load(object sender, EventArgs e) 登录窗体 myabout = new 登录窗体(); if (myabout.ShowDialog() = DialogResult.OK) else this.Close(); Sjk.Con.Open(); string sql = select 是否为管理员 from 操作用户 where 员工编号=+Yh.yuangbh+; SqlCommand comm = new SqlCommand(sql, Sjk.Con); /执行 SqlDataReade
11、r dt=comm.ExecuteReader(); while (dt.Read() Yh.yonghqx = dt0.ToString(); MessageBox.Show(dt0.ToString(); /Yh.yonghm = dt1.ToString(); dt.Close(); sql = select 员工姓名 from 员工信息 where 员工编号= + Yh.yuangbh + ; comm = new SqlCommand(sql, Sjk.Con); dt = comm.ExecuteReader(); while (dt.Read() /Yh.yonghqx = dt0.ToSt