C课程设计报告--酒店管理系统

上传人:dus****log 文档编号:126789952 上传时间:2022-07-29 格式:DOC 页数:24 大小:765.50KB
收藏 版权申诉 举报 下载
C课程设计报告--酒店管理系统_第1页
第1页 / 共24页
C课程设计报告--酒店管理系统_第2页
第2页 / 共24页
C课程设计报告--酒店管理系统_第3页
第3页 / 共24页
资源描述:

《C课程设计报告--酒店管理系统》由会员分享,可在线阅读,更多相关《C课程设计报告--酒店管理系统(24页珍藏版)》请在装配图网上搜索。

1、大理学院数学与计算机学院课程设计报告 课程名称: C#程序设计课程设计 设计题目: 酒店管理系统 姓 名: 学 号: 专 业: 班 级: 起止日期: 指导教师: 24目录第一章 酒店管理系统综述. 2第二章 需求获取 22.1标识参与者. 22.2标识用例. 32.2编写用例文档. 4第三章 对象建模 43.1标识术语. 43.2标识对象的属性及方法. 4第四章 将模型映射到代码 54.1 将对象模型映射到编程环境. 54.2 将持久性对象映射到存储模式. 5第五章 编码 6第六章 测试 19结束语. 23参考文献. 23第一章 酒店管理系统综述酒店管理系统一般包含用户登录查询信息、修改信息、

2、新增信息、删除信息以及打印用户基本信息等功能模块。优秀的酒店管理软件能显著地提高酒店的服务水平和工作效率,规范酒店的业务流程,帮助酒店管理者及时、全面地了解经营信息,做出更加准确的决策,从而有效地提高酒店的经营效益。特点:1.用户登录查询信息 用户可以通过登录界面登录到用户系统中,查询信息。2.修改信息 用户可以再显示界面中点击修改,来修改用户信息,并且提交保存,将信息保存到数据库中。3.新增信息 用户可以再显示界面中点击新增,来添加新的用户信息,并且保存提交,将信息保存到数据库中。4.删除信息 用户可以再显示界面中点击删除,来删除不需要的用户信息,保存后,数据库中将会把该条消息删除。5.打印

3、用户基本信息 用户可以再显示界面中点击打印,将用户信息打印出来。系统优势:提高服务质量1.先进的多条件资料查询:操作员只需输入符合某个条件关键字,系统即可自动匹配,快速2.调出相关资料,让操作人员为顾客提供更好的服务;提高工作效率快速、简捷的操作:界面直观,操作使用简捷、明快;第二章 需求获取 2.1标识参与者 该系统主要支持系统管理用户,针对这类用户实现系统登录,查询,修改,新增,删除以及打印功能。2.2标识用例 否开始填写用户信息密码是否正确重新输入密码进入主页面用户信息修改,新增,删除,打印表的内容结束2.3编写用例文档1.启动登录界面2.输入用户名和密码3.(用户)确定4.(登户对象)

4、请求用户对象查询用户信息。5.返回登录成功信息第三章 对象建模3.1标识术语CrystalReport1DataBaselinkDataSet1DaYinForm1JiuDianDengLuJiuDianDengLuFormProgramXZYongHuYongHuFrom3.2标识对象的属性及方法用户表身份证号姓名密码第四章 将模型映射到代码4.1 将对象模型映射到编程环境JiuDianDengLuFormYongHuFormForm1XZDaYin4.2 将持久性对象映射到存储模式数据表用户表:第五章 编码主程序:using System;using System.Collections.

5、Generic;using System.Linq;using System.Windows.Forms;namespace WindowsFormsApplication2 static class Program / /应用程序的主入口点。 / STAThread static void Main() Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new JiuDianDengLuForm(); if (Form1.bl = tr

6、ue) Application.Run(new Form1(); else Application.Run(new JiuDianDengLuForm(); if (YongHuFrom.bl1 = true) Application.Run(new YongHuFrom(); 用户类:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using System.Data.SqlClient;using System.Windows.Forms;n

7、amespace WindowsFormsApplication2 class YongHu DataBaseLink db = new DataBaseLink(); public void Add(String st) using (SqlConnection con = db.DataLink() if (con.State = ConnectionState.Closed) con.Open(); try string sql = Insert into YongHu(sfzh,xm,mm) Values(sfzh,xm,mm);/查询语句同学也可以参考教材上的例子编写 SqlComm

8、and cmd = new SqlCommand(sql, con); SqlParameter p1 = new SqlParameter(sfzh, st0); SqlParameter p2 = new SqlParameter(xm, st1); SqlParameter p3 = new SqlParameter(mm, st2); cmd.Parameters.Add(p1); cmd.Parameters.Add(p2); cmd.Parameters.Add(p3); cmd.ExecuteNonQuery(); MessageBox.Show(信息添加成功); catch (

9、Exception ex) MessageBox.Show(错误: + ex.Message, 错误提示, MessageBoxButtons.OKCancel, MessageBoxIcon.Error); finally if (con.State = ConnectionState.Open) con.Close(); con.Dispose(); public DataSet GetData(string st) DataSet ds = new DataSet(); if (st = null) using (SqlConnection con = db.DataLink() if

10、(con.State = ConnectionState.Closed) con.Open(); try string sql = Select * From YongHu; SqlDataAdapter sqlda = new SqlDataAdapter(sql, con); sqlda.Fill(ds); catch (Exception ex) MessageBox.Show(错误: + ex.Message, 错误提示, MessageBoxButtons.OKCancel, MessageBoxIcon.Error); finally if (con.State = Connect

11、ionState.Open) con.Close(); con.Dispose(); return ds; public void Delete(string id) using (SqlConnection con = db.DataLink() if (con.State = ConnectionState.Closed) con.Open(); try string sql = Delete From YongHu Where sfzh= + + id + ; SqlCommand comd = new SqlCommand(sql, con); comd.ExecuteNonQuery

12、(); catch (Exception ex) MessageBox.Show(错误: + ex.Message, 错误提示, MessageBoxButtons.OKCancel, MessageBoxIcon.Error); finally if (con.State = ConnectionState.Open) con.Close(); con.Dispose(); public void Updata(String st, string id) using (SqlConnection con = db.DataLink() if (con.State = ConnectionSt

13、ate.Closed) con.Open(); try string sql = Update YongHu set mm=mm where sfzh = + + id + ; SqlCommand cmd = new SqlCommand(sql, con); / SqlParameter p1 = new SqlParameter(sfzh, st0); SqlParameter p2 = new SqlParameter(mm, st1); /cmd.Parameters.Add(p1); cmd.Parameters.Add(p2); cmd.ExecuteNonQuery(); ca

14、tch (Exception ex) MessageBox.Show(错误: + ex.Message, 错误提示, MessageBoxButtons.OKCancel, MessageBoxIcon.Error); finally if (con.State = ConnectionState.Open) con.Close(); con.Dispose(); 酒店登录类:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using Syst

15、em.Data.SqlClient;using System.Windows.Forms;namespace WindowsFormsApplication2 class JiuDianDengLu DataSet ds = new DataSet(); DataTable dt; DataRow dr; public bool DRRZ(string sfzh,string mm) YongHu a = new YongHu(); ds = a.GetData(null); dt = ds.Tables0; for (int i = 0; i dt.Rows.Count; i+) dr =

16、dt.Rowsi; if (dr0.ToString().Trim() = sfzh & dr1.ToString().Trim()= mm) Form1.bl = true; break; return true; 登陆页面: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;namespace

17、WindowsFormsApplication2 public partial class JiuDianDengLuForm : Form public JiuDianDengLuForm() InitializeComponent(); bool bl = false; private void button1_Click(object sender, EventArgs e) JiuDianDengLu jddl = new JiuDianDengLu(); bl = jddl.DRRZ(textBox1.Text.Trim(), textBox2.Text.Trim(); if (bl

18、 = true) this.Close(); private void textBox2_TextChanged(object sender, EventArgs e) private void JiuDianDengLuForm_Load(object sender, EventArgs e) 主页面:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Tex

19、t;using System.Windows.Forms;using System.Data.SqlClient;namespace WindowsFormsApplication2 public partial class Form1 : Form public static bool bl = false; public Form1() InitializeComponent(); private void Form1_Load(object sender, EventArgs e) private void tabControl1_Selected(object sender, TabC

20、ontrolEventArgs e) private void pictureBox1_Click(object sender, EventArgs e) YongHuFrom.bl1 = true; this.Close(); 显示页面: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;name

21、space WindowsFormsApplication2 public partial class YongHuFrom : Form public static bool bl1 = false; BindingSource bd = new BindingSource(); YongHu yh = new YongHu(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); private void Datagridviewgs() dataGridView1.AutoGenerateColumns = false;

22、 DataGridViewTextBoxColumn sfzh = new DataGridViewTextBoxColumn(); sfzh.Width = 150; sfzh.DataPropertyName = sfzh; sfzh.HeaderText = 身份证号; sfzh.Name = sfzh; sfzh.ReadOnly = true; dataGridView1.Columns.Add(sfzh); DataGridViewTextBoxColumn xm = new DataGridViewTextBoxColumn(); xm.Width = 150; xm.DataP

23、ropertyName = xm; xm.HeaderText = 姓名; xm.Name = xm; xm.ReadOnly = true; dataGridView1.Columns.Add(xm); public void DataBinding() ds = yh.GetData(null); bd.DataSource = ds.Tables0; bindingNavigator1.BindingSource = bd; dataGridView1.DataSource = bd; public YongHuFrom() InitializeComponent(); Datagrid

24、viewgs(); DataBinding(); private void toolStripButton1_Click(object sender, EventArgs e) XZ xz1 = new XZ(xz, null,dt); xz1.ShowDialog(); DataBinding(); private void toolStripButton3_Click(object sender, EventArgs e) DataGridViewRow dataRow = dataGridView1.SelectedRows0; XZ xg1 = new XZ(xg, dataRow,d

25、t); xg1.ShowDialog(); DataBinding(); private void toolStripButton2_Click(object sender, EventArgs e) DialogResult dia = MessageBox.Show(你确实要删除此记录吗, 确认删除, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dia = DialogResult.OK) DataGridViewRow dataRow = dataGridView1.SelectedRows0; yh.Delete(d

26、ataRow.Cells0.Value.ToString(); DataBinding(); private void YHXX_Load(object sender, EventArgs e) private void toolStripButton4_Click(object sender, EventArgs e) DaYin dy = new DaYin(); dy.ShowDialog(); 新增,修改:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data

27、;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace WindowsFormsApplication2 public partial class XZ : Form string str; string id; public XZ(string str, DataGridViewRow YongHu,DataTable dt) InitializeComponent(); this.str = str;

28、if (str = xg) button1.Text = 修改; textBox1.Text = YongHu.Cells0.Value.ToString(); textBox2.Text = YongHu.Cells1.Value.ToString(); / textBox3.Text = YongHu.Cells2.Value.ToString(); id = YongHu.Cells0.Value.ToString(); textBox1.Enabled = false; textBox2.Enabled = false; if (str = xz) button1.Text = 新增;

29、 private void label1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) string st = new string3; if (str = xz) st0 = textBox1.Text.Trim(); st1 = textBox2.Text.Trim(); st2 = textBox3.Text.Trim(); YongHu yhxz = new YongHu(); yhxz.Add(st); this.Close(); if (str = x

30、g) st0 = textBox1.Text.Trim(); st1 = textBox2.Text.Trim(); st2 = textBox3.Text.Trim(); YongHu yhxg = new YongHu(); yhxg.Updata(st, id); this.Close(); private void button2_Click(object sender, EventArgs e) this.Close(); private void XZANDXG_Load(object sender, EventArgs e) 打印:using System;using Syste

31、m.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication2 public partial class DaYin : Form YongHu yh = new YongHu(); DataSet ds = new DataSet(); public DaYin() Initialize

32、Component(); private void crystalReportViewer1_Load(object sender, EventArgs e) YongHu yh = new YongHu(); DataSet ds = yh.GetData(null); CrystalReport1 crt1 = new CrystalReport1(); crt1.SetDataSource(ds.Tables0); crystalReportViewer1.ReportSource = crt1; private void DaYin_Load(object sender, EventA

33、rgs e) 第六章 测试启动程序到登录界面:输入登录信息登录到主界面:在登录界面中点击按钮到显示界面:点击新增弹出新增界面:点击修改弹出修改界面:点击删除将删除信息:点击打印后将信息显示在打印窗口: 结束语通过本次的C#课程设计完成了酒店管理最基本的功能,基本上满足了一个酒店管理系统的基本需求。但是由于本人技术掌握不牢固,所以很多内容并未实现,只是将最基本的老师上课所讲内容在本次实验中体现出来,但是还是需要加强改进。在本次实验中,我从遇到很多困难,像是对用户表内容的修改,做了多次总是不能实现,自己也是将代码改了又该,将能发现的错误统统改正,但是在运行时还是总是出错,开始时,点击修改本应弹出新

34、增的窗体,但是总是弹出到主页面,通过一系列的改正后,终于能弹出新增页面了,可是当我输入内容后点击确认是系统总是报错,如此几次后,我不得不询问同学,后经过同学改正,系统终于能够实现修改项了。在实验后期,做水晶报表时,我就彻底的懵了,完全不知道该如何下手,所以水晶报表实现的整个过程都是通过询问同学完成的,在我完成后也帮助其余同学实现了水晶报表,通过这样帮助同学,我掌握了水晶报表的应用,如此一来也完成了本次实验。 总之,在老师和同学的帮助指导下,我对C#面向程序设计课程进一步巩固,对面向对象设计语言程度有所提高,且对我以后的学习和毕业设计指明了方向。参考文献:1 吴建,郑潮,汪杰UML基础与R建模案例M北京:人民邮电出版社,20042 Crmg L&rlllsn,等UML和模式应用-面向对象分析和设计导论M姚淑珍,李虎译北京:机械工业出版社,2O023 张广泉,张玲红UML与ADL在软件体系结构建模中的应用研究J重庆师范大学学报(自然科学版),2004(12)4 吴际,金茂忠UML面向对象分析M北京:北京航空航天大学出版社,20025 Joseph SchmullerUML基础、案例与应用M李虎,等译北京:人民邮电出版社,2002

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

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!