版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、分类号编号华北水利水电大学North China University of Water Resources and Electric Power实验报告课 程: 软件工程实验项目2:软件编码与测试题 目:宾馆管理信息系统院系信息工程学院专业计算机科学与技术班级学号201415717姓名李卫朋指导教师 庄晋林2017年5月29日华北水利水电大学软件工程实验报告201620生学年 第 二 学期 2014 级 计算机科学与技术专业一、实验内容:宾馆管理信息系统任务:入住或预订客房时,用户要对客户管理模块或预订管理模块进行核对审查, 并进行登记;客户换房时,要对换房信息进行查询和更新;客户退房时,要
2、进行结算, 并对更新客房信息。主要功能模块:(1)登录模块:对用户身份进行验证,只有合法用户才能进入系统;(2)系统管理模块:对系统用户进行管理,更改用户名、密码、权限等;(3)客房管理模块:对客房信息的添加、修改和删除等;(4)入住管理模块:对客户入住信息的登记、查询等功能(5)订房管理模块:对客户订房信息的登记、查询等。(6)换房管理模块:对客户换房信息的登记、查询等(7)宾馆结算模块:对已入住宾馆的顾客进行结算及对订房客户已交的押金进行 结算、查询。二、程序源:Win7 64 位电脑,vs2012编辑环境,sql2005数据库。程序源码:1、登录设计:namespace宾馆管理信息系统p
3、ublic partial class loginl : Formpublic login1()InitializeComponent();private connection c = new connection。;private void button1_Click(object sender, EventArgs e)if (textBox1.Text.Trim().ToString()!= String.Empty && textBox2.Text.Trim().ToString() != String.Empty)精品资料string id = null, pw =
4、null, gd = null;var result = from info in c.linq.loginwhere info.id = textBox1.Text.ToString().Trim() select new ID = info.id,pw = info.password,Igd = info.grade,;if (result.Count() = 0)|MessageBox.Show("用户名不存在!”);else if (result.Count() = 1)foreach (var p in result)id = p.ID;pw = p.pw;gd = p.g
5、d;if (pw.Trim() = textBox2.Text.ToString().Trim() this.Hide();|manger lf = new manger(gd,textBox1.Text.Trim().ToString(); lf.Show();| elseMessageBox.Show("密码错误!");else I MessageBox.Show("不能为空!");private void button2_Click(object sender, EventArgs e) this.Close();|private void log
6、in1_FormClosed(object sender, FormClosedEventArgs e)System.Environment.Exit(0); 2、添加住户设计 namespace宾馆管理信息系统 public partial class addpeople : Form private connection c = new connection。; private string s;Ipublic addpeople(Form f,string s) this.Owner = f;IInitializeComponent();this.s = s;房问号comboBox1.D
7、ropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;private void button1_Click(object sender, EventArgs e) if (textBox1.Text.Trim().ToString() != String.Empty && comboBox1.Text.Trim().ToString() != String.Empty && textBox3.Text.Trim().ToString() != String.Empty &&
8、textBox4.Text.Trim().ToString() != String.Empty)var result = from info in c.linq.roomwhere info.房间号码 =s.Trim().ToString()select new| 房间号=info. 房间号码, 房间类型=info.房间种类, 房间单价=info.房间单价, 房间是否使用=info.房间是否正在使用, ;foreach (var item in result)|if (item.房间单价 <=int.Parse(textBox4.Text.Trim().ToString()try gue
9、st r = new guest(); r.住店人身份证号码 =textBox1.Text.Trim().ToString();r.姓名=textBox2.Text.Trim().ToString();r.性另 ij = comboBox1.Text.Trim().ToString();精品资料r.所交押金=int.Parse(textBox4.Text.Trim().ToString();r.人数=textBox3.Text.Trim().ToString();r.房间号码=s;r.入住天数=1;r.入住时间=System.DateTime.Now.Day.ToString(); var e
10、dit = c.linq.room.SingleOrDefault<room>(s1 => s1.房间号码 =s.Trim().ToString();if (edit = null)| return; edit.房间是否正在使用="是";c.linq.guest.InsertOnSubmit(r);Ic.linq.SubmitChanges();I/修改student的属性;MessageBox.Show(textBox2.Text.Trim().ToString() + "入住成功");this.Close(); catch Mess
11、ageBox.Show("用户已存在!"); elseI MessageBox.Show("所交押金不足!"); else MessageBox.Show("不能为空!"); private void addpeople_FormClosed(object sender, FormClosedEventArgs e) this.Owner.Owner.Show(); 3、添加房间设计: namespace宾馆管理信息系统 public partial class addroom : Form精品资料public addroom(For
12、m f) InitializeComponent();Ithis.Owner = f; comboBoxl.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; private connection c = new connection。; private void button1_Click(object sender, EventArgs e) if (textBox1.Text.Trim().ToString() != String.Empty && comboBox1.Text.Trim().T
13、oString() != String.Empty && textBox3.Text.Trim().ToString() != String.Empty)tryI room r = new room(); r.房间号码=textBox1.Text.Trim().ToString();r.房间种类=comboBox1.Text.Trim().ToString();r.房间单价=double.Parse( textBox3.Text.Trim().ToString();r.房间是否正在使用="否"; c.linq.room.InsertOnSubmit(r);I
14、c.linq.SubmitChanges(); MessageBox.Show(textBox1.Text.Trim().ToString()+”号房间添加成功");this.textBox1.Text = null; this.textBox3.Text = null; boBox1.Text = null;|this.textBox1.Focus(); catchI MessageBox.Show("房间号已存在!"); else I MessageBox.Show("不能为空!"); private void addroom_FormCl
15、osed(object sender, FormClosedEventArgs e) this.Owner.Show();| private void button2_Click(object sender, EventArgs e)this.Close();4、查看所有房间信息设计:namespace宾馆管理信息系统 public partial class allroom : Formprivate connection c=new connection (); public allroom(Form f)IInitializeComponent();this.Owner = f;Ithi
16、s.listView1.Clear();|this.listView1.View = View.LargeIcon;this.listView1.LargeImageList = this.imageList1;Random rd = new Random();this.listView1.BeginUpdate();var result = from info in c.linq.room select newI 房间号=info.房间号码,房间类型=info.房间种类, 房间单价=info.房间单价, 房间是否使用=info.房间是否正在使用;foreach (var item in re
17、sult)IListViewItem lvi = new ListViewItem(); if(item.房间是否使用.Trim()="否") lvi.ImageIndex =0;| else if (item.房间是否使用.Trim()="是") lvi.ImageIndex = 1; lvi.Text = item.房间号.Trim().ToString();this.listView1.Items.Add(lvi);| this.listView1.EndUpdate();|精品资料private void listView1_ItemActiva
18、te(object sender, EventArgs e) var result = from info in c.linq.room where info.房间号码=listView1.FocusedItem.Text.Trim().ToString()select newI 房间号=info. 房间号码, 房间类型=info.房间种类, 房间单价=info.房间单价, 房间是否使用=info.房间是否正在使用, ; foreach (var item in result)I DialogResult dr = MessageBox.Show("房间号:"+ listV
19、iew1.FocusedItem.Text.ToString() + "rn房间类型:item.房间类型+ "rn房间单价:"+ item.房间单价); private void allroom_FormClosed(object sender, FormClosedEventArgs e) this.Owner.Show();I 5、预订房间设计: namespace宾馆管理信息系统 public partial class bookroom : Form private connection c = new connection(); public bookr
20、oom(Form f) InitializeComponent();this.Owner = f;|this.listView1.Clear();Ithis.listView1.View = View.LargeIcon;this.listView1.LargeImageList = this.imageList1;IRandom rd = new Random();this.listView1.BeginUpdate();|var result = from info in c.linq.room where info.房间是否正在使用="否"select newI 房间
21、号 =info. 房间号码,房间类型=info.房间种类, 房间单价=info.房间单价, 房间是否使用=info.房间是否正在使用, ;foreach (var item in result) ListViewItem Ivi = new ListViewItem();Ivi.Imagelndex =0;Ilvi.Text = item.房间号.Trim().ToString();this.listView1.Items.Add(lvi);| this.listView1.EndUpdate(); private void bookroom_FormClosed(object sender,
22、 FormClosedEventArgs e) this.Owner.Show(); private void listView1_ItemActivate(object sender, EventArgs e) var result = from info in c.linq.roomwhere info.房间号码=listView1.FocusedItem.Text.Trim().ToString()select newI 房间号=info. 房间号码, 房间类型=info.房间种类, 房间单价=info.房间单价, 房间是否使用=info.房间是否正在使用,; foreach (var
23、item in result)|DialogResultdr = MessageBox.Show("房间号:"+ listView1.FocusedItem.Text.ToString() + "rn 房间类型:"+item.房间类型+"rn房间单价:"+item.房间单价+"rn 确认使用么?","提示",MessageBoxButtons.OKCancel);if (dr = DialogResult.OK) /用户选择确认的操作addpeople a = new addpeople(thi
24、s, listView1.FocusedItem.Text.Trim().ToString();this.Hide();Ia.Show(); 6、查看所有用户设计: namespace宾馆管理信息系统public partial class chakanyonghu : FormIprivate connection c = new connection。;public chakanyonghu(Form f) Ithis.Owner = f;IInitializeComponent();Ivar result = from info in c.linq.loginselect newI用户名
25、=info.id, 用户类型=info.grade,;dataGridView1.DataSource = result;7、修改房间的信息设计:namespace宾馆管理信息系统public partial class changeroom : Formprivate connection c = new connection。;public changeroom(Form f) |InitializeComponent();Ithis.Owner = f;Ivar result = from info in c.linq.roomselect newI房间号=info. 房间号码,房间类型
26、=info.房间种类,房间单价=info.房间单价,房间是否使用=info.房间是否正在使用,;dataGridView1.DataSource = result;private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)string s = Convert.ToString(dataGridView10, e.RowIndex.Value).Trim();changeroom2 d = new changeroom2(this, s);d.Show(); Ithis.Hide()
27、;Iprivate void button1_Click(object sender, EventArgs e)var result = from info in c.linq.roomselect newI房间号=info. 房间号码,房间类型=info.房间种类,房间单价=info.房间单价,房间是否使用=info.房间是否正在使用,;dataGridView1.DataSource = result;namespace宾馆管理信息系统public partial class changeroom2 : Formprivate connection c = new connection()
28、;private string s = null;Ipublic changeroom2(Form f,string s)InitializeComponent();comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.Owner = f;this.s = s;Ivar result = from info in c.linq.roomwher
29、e info.房间号码=sselect newI房间号=info. 房间号码,房间类型=info.房间种类,房间单价=info.房间单价,房间是否使用=info.房间是否正在使用,;foreach (var item in result)|this.textBox2.Text = item.房间号;this.textBox1.Text = item.房间单价.ToString();boBox1.Text = item.房间类型;boBox2.Text = item.房间是否使用;private void button1_Click(object sender, EventArgs e)if (
30、textBox1.Text.Trim().ToString() != String.Empty && textBox2.Text.Trim().ToString() != String.Empty &&comboBox1.Text.Trim().ToString() != String.Empty && comboBox2.Text.Trim().ToString() != String.Empty)var edit = c.linq.room.SingleOrDefault<room>(s1=>s1.房间号码=s);if (e
31、dit = null)return;/修改student的属性edit.房间单价=double .Parse( textBox1.Text.Trim().ToString();edit.房间种类=comboBox1.Text.Trim().ToString();edit.房间是否正在使用 =comboBox2.Text.Trim().ToString();/执行更新操作c.linq.SubmitChanges();IMessageBox.Show("房间信息彳改成功");this.Close();| 8、删除用户信息设计: namespace宾馆管理信息系统 public
32、partial class delete : Form private string s;Iprivate connection c = new connection。; public delete(Form f)I InitializeComponent();Ithis.Owner = f;Ivar result = from info in c.linq.loginwhere info.grade="普通用户"select new 用户名=info.id, 用户类型=info.grade,;dataGridViewl.DataSource = result; priva
33、te void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) s = Convert.ToString(dataGridView10, e.RowIndex.Value).Trim();Idelete2 d = new delete2(s,this );d.Show(); I this.Hide(); private void button2_Click(object sender, EventArgs e) var result = from info in c.linq.loginIwhe
34、re info.grade ="普通用户"select newI用户名=info.id, | 用户类型=info.grade,;dataGridView1.DataSource = result; namespace宾馆管理信息系统 public partial class delete2 : Form private string h; private connection c = new connection。; public delete2(string s,Form f) InitializeComponent();Ih = s; this.Owner = f;|v
35、ar result = from info in c.linq.login where info.id = s select newI 用户名=info.id, 用户类型=info.grade,;dataGridViewl.DataSource = result;private void button1_Click(object sender, EventArgs e)var result = from m in c.linq.loginIwhere m.id = hselect m;Ic.linq.login.DeleteAllOnSubmit(result);c.linq.SubmitCh
36、anges();MessageBox.Show("删除成功");this.Close();9、删除房间信息设计:namespace宾馆管理信息系统public partial class deleteroom : Formprivate connection c = new connection。; public deleteroom(Form f)InitializeComponent();this.Owner = f;Ivar result = from info in c.linq.room select new|房间号=info. 房间号码,房间类型=info.房间
37、种类,房间单价=info.房间单价,房间是否使用=info.房间是否正在使用 ;dataGridView1.DataSource = result;private void button2_Click(object sender, EventArgs e)var result = from info in c.linq.room select new 房间号=info. 房间号码,房间类型=info.房间种类,房间单价=info.房间单价,房间是否使用=info.房间是否正在使用,;dataGridViewl.DataSource = result;private void dataGridV
38、iew1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) string s = Convert.ToString(dataGridView10, e.RowIndex.Value).Trim();deleteroom2 d = new deleteroom2(this,s);d.Show(); Ithis.Hide();namespace宾馆管理信息系统public partial class deleteroom2 : Formprivate connection c = new connection。;private
39、string h;Ipublic deleteroom2(Form f,string h)InitializeComponent();Ithis.Owner = f;this.h = h;Ivar result = from info in c.linq.roomwhere info.房间号码=hselect new房间号=info.房间号码,房间类型=info.房间种类,房间单价=info.房间单价,房间是否使用=info.房间是否正在使用,;dataGridView1.DataSource = result;private void button1_Click(object sender,
40、 EventArgs e)var result = from m in c.linq.roomwhere m.房间号码 =hselect m;foreach (var item in result)|if (item.房间是否正在使用.Trim().ToString()=" 否")c.linq.room.DeleteAllOnSubmit(result);c.linq.SubmitChanges();MessageBox.Show("删除成功");this.Close(); else MessageBox.Show("该房间正在使用,请先退房!
41、"); 10、查看住户信息: namespace宾馆管理信息系统 public partial class guestmessage : Form private connection c = new connection。; public guestmessage(Form f) this.Owner = f; InitializeComponent(); comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; private void button1_Click(object sende
42、r, EventArgs e) if (comboBox1.Text.Trim().ToString() != string.Empty && textBox1.Text.Trim().ToString() != string.Empty) switch (comboBox1.Text.Trim().ToString() case "房间号":var edit = c.linq.guest.SingleOrDefault<guest>(s1 => s1.房间号码.Trim()=textBox1.Text.Trim().ToString();
43、 | if (edit != null)|MessageBox.Show("房间号:"+ edit. 房间号码 + "tn" + " 人数:"+ edit. 人数 + "tn" + " 入住天数:"+ edit.入住天数+ "tn" + " 押金:"+ edit.所交押金+ "tn" + " 姓名:"+ edit. 姓名+ "tn" + "身份证号码:"+ edit.住店人身份
44、证号码); else MessageBox.Show("房间为空!");break;Icase "用户姓名":var editl = c.linq.guest.SingleOrDefault<guest>(s1 => s1.姓名.Trim()=textBox1.Text.Trim().ToString(); if (editl != null) MessageBox.Show("房间号:"+ edit1. 房间号码 + "tn" + " 人数:"+ edit1. 人数 + &q
45、uot;tn" + " 入住天数:"+ edit1.入住天数+ "tn" + " 押金:"+ edit1. 所交押金+ "tn" + " 姓名:"+ edit1. 姓名+ "tn" + "身份证号码:"+edit1.住店人身份证号码); elseIMessageBox.Show(textBox1.Text.Trim().ToString() + "不存在"); break; case "身份证号":var
46、edit2 = c.linq.guest.SingleOrDefault<guest>(s1 => s1.住店人身份证号码 .Trim()=textBox1.Text.Trim().ToString(); | if (edit2 != null) MessageBox.Show("房间号:"+ edit2. 房间号码 + "tn" + " 人数:"+ edit2. 人数 + "tn" + " 入住天数:"+ edit2.入住天数+ "tn" + "
47、 押金:"+ edit2. 所交押金+ "tn" + " 姓名:"+ edit2. 姓名+ "tn" + "身份证号码:"+edit2.住店人身份证号码); else不存在");MessageBox.Show(textBox1.Text.Trim().ToString() + break;I else MessageBox.Show("不能为空!"); 11、新用户注册namespace宾馆管理信息系统 public partial class login2 : Form p
48、rivate connection c = new connection。;public login2() I InitializeComponent();IcomboBoxl.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; public login2(Form f)IInitializeComponent();Ithis.Owner = f; comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; private vo
49、id button1_Click(object sender, EventArgs e) 一if (textBox1.Text.Trim().ToString() != String.Empty && textBox2.Text.Trim().ToString() != String.Empty && textBox3.Text.Trim().ToString() != String.Empty && comboBox1.Text.Trim().ToString() != String.Empty) if (comboBox1.Text.Trim
50、().ToString()="管理员"| comboBox1.Text.Trim().ToString()="普通用户")if (this.textBox2.Text.Trim().ToString() = textBox3.Text.Trim().ToString() tryI login l = new login();Il.id = textBox1.Text.Trim().ToString();|l.password = textBox2.Text.Trim().ToString();l.grade = comboBox1.Text.Trim()
51、.ToString(); c.linq.login.InsertOnSubmit(l);c.linq.SubmitChanges();MessageBox.Show("注册成功"); catchI MessageBox.Show("用户名已存在!"); elseI MessageBox.Show("请再次输入确定密码!");elseIMessageBox.Show("请选择正确的用户类型!");boBox1.Focus(); else MessageBox.Show("不能为空!");12、主界
52、面设计:namespace宾馆管理信息系统public partial class manger : Form private string i,j;/ public manger() I InitializeComponent();Ipublic manger(string i,string j)InitializeComponent();this.i = i;|this.j = j;private void button1_Click(object sender, EventArgs e)this.Hide();|login2 l = new login2(this);l.Show();
53、| private void manger_Load(object sender, EventArgs e) if (i.Trim().Equals("管理员")this.panel1.Visible = true;this.panel2.Visible = true ;else if (i.Trim().Equals("普通用户") this.panel2.Visible = true; this.panell.Visible = false;Iprivate void button3_Click(object sender, EventArgs e)
54、 this.Hide();|delete l = new delete(this);Il.Show();private void manger_FormClosed(object sender, FormClosedEventArgs e) System.Environment.Exit(0);I private void button4_Click(object sender, EventArgs e) this.Hide();|chakanyonghu l = new chakanyonghu(this);Il.Show(); |private void button5_Click(obj
55、ect sender, EventArgs e) this.Hide();|xiugaimima l = new xiugaimima(this, j); l.Show(); Iprivate void button6_Click(object sender, EventArgs e) this.Hide();|addroom l = new addroom(this);Il.Show();private void button7_Click(object sender, EventArgs e) this.Hide();Ideleteroom l = new deleteroom(this)
56、; l.Show(); |private void button8_Click(object sender, EventArgs e)this.Hide();|changeroom l = new changeroom(this);l.Show(); private void button2_Click(object sender, EventArgs e) this.Hide();Ibookroom l = new bookroom(this); l.Show(); Iprivate void button9_Click(object sender, EventArgs e) this.Hide();|unsubscribe l = new unsubscribe(this);Il.Show(); private void button10_Click(object sender, EventArgs e) this.Hide();Iallroom l = new allroom(this); l.Show(); |private connection c = new connection。; priva
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 搪瓷制品生产设备生产加工项目可行性研究报告
- 痔疮治疗仪项目可行性研究报告
- 2024年度个人债务清偿欠条作废声明及信用修复服务合同3篇
- 集体农场养殖合同范例
- 关于员工工作实习心得
- 2024年度XX企业数据备份与恢复续费合同3篇
- 2024年二零二四版二手车置换、融资与转让合同3篇
- 2024年农机绿色生产技术合作框架协议范本3篇
- 2024年度西安出租车租赁价格合同3篇
- 2024年新鲜食材配送合作协议标准格式一
- GB/T 617-2006化学试剂熔点范围测定通用方法
- GB/T 16311-1996道路交通标线质量要求和检测方法
- 中国民俗礼仪课程
- 鱼的人工繁殖技术课件
- 高级会计师评审个人业绩报告(精选9篇)
- 基建类试题及答案
- 停窑检修的十大黄金准则
- 恶性胸膜间皮瘤诊治进展 华晶
- 睡眠呼吸暂停综合症与心血管疾病
- 英语口语 购物课件
- 《剧目》课程标准(高职)
评论
0/150
提交评论