1、软件工程课程设计宾馆信息管理系统分类号 编 号 华北水利水电大学 North China University of Water Resources and Electric Power实 验 报 告课 程: 软 件 工 程 实验项目2: 软件编码与测试 题 目: 宾馆管理信息系统 院 系 信息工程学院 专 业 计算机科学与技术 班级学号 201415717 姓 名 李卫朋 指 导 教 师 庄 晋 林 2017年 5 月 29 日华北水利水电大学 软件工程 实验报告20162017学年 第 二 学期 2014 级 计算机科学与技术 专业一、实验内容:宾馆管理信息系统 任务:入住或预订客房时,用
2、户要对客户管理模块或预订管理模块进行核对审查,并进行登记;客户换房时,要对换房信息进行查询和更新;客户退房时,要进行结算,并对更新客房信息。 主要功能模块:(1)登录模块:对用户身份进行验证,只有合法用户才能进入系统;(2)系统管理模块:对系统用户进行管理,更改用户名、密码、权限等;(3)客房管理模块:对客房信息的添加、修改和删除等;(4)入住管理模块:对客户入住信息的登记、查询等功能(5)订房管理模块:对客户订房信息的登记、查询等。(6)换房管理模块:对客户换房信息的登记、查询等(7)宾馆结算模块:对已入住宾馆的顾客进行结算及对订房客户已交的押金进行结算、查询。二、程序源: Win7 64位
3、电脑,vs2012编辑环境,sql2005数据库。 程序源码: 1、登录设计:namespace 宾馆管理信息系统 public partial class login1 : Form public 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(
4、).ToString() != String.Empty) string id = null, pw = null, gd = null; var result = from info in c.linq.login where info.id = textBox1.Text.ToString().Trim() select new ID = info.id, pw = info.password, gd = info.grade, ; if (result.Count() = 0) MessageBox.Show(用户名不存在!); else if (result.Count() = 1)
5、foreach (var p in result) id = p.ID; pw = p.pw; gd = p.gd; if (pw.Trim() = textBox2.Text.ToString().Trim() this.Hide(); manger lf = new manger(gd,textBox1.Text.Trim().ToString(); lf.Show(); else MessageBox.Show(密码错误!); else MessageBox.Show(不能为空!); private void button2_Click(object sender, EventArgs
6、e) this.Close(); private void login1_FormClosed(object sender, FormClosedEventArgs e) System.Environment.Exit(0); 2、添加住户设计namespace 宾馆管理信息系统 public partial class addpeople : Form private connection c = new connection(); private string s; public addpeople(Form f,string s) this.Owner = f; InitializeCo
7、mponent(); this.s = s;/房间号 comboBox1.DropDownStyle = 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() != Str
8、ing.Empty & textBox4.Text.Trim().ToString() != String.Empty) var result = from info in c.linq.room where info.房间号码 = s.Trim().ToString() select new 房间号 = info.房间号码, 房间类型 = info.房间种类, 房间单价 = info.房间单价, 房间是否使用 = info.房间是否正在使用, ; foreach (var item in result) if (item.房间单价 = int.Parse(textBox4.Text.Trim
9、().ToString() try guest r = new guest(); r.住店人身份证号码 = textBox1.Text.Trim().ToString(); r.姓名 = textBox2.Text.Trim().ToString(); r.性别 = comboBox1.Text.Trim().ToString(); r.所交押金 = int.Parse(textBox4.Text.Trim().ToString(); r.人数 = textBox3.Text.Trim().ToString(); r.房间号码 = s; r.入住天数 = 1; r.入住时间 = System.
10、DateTime.Now.Day.ToString(); var edit = c.linq.room.SingleOrDefault(s1 = s1.房间号码 = s.Trim().ToString(); if (edit = null) return; edit.房间是否正在使用 = 是; c.linq.guest.InsertOnSubmit(r); c.linq.SubmitChanges(); /修改student的属性; MessageBox.Show(textBox2.Text.Trim().ToString() + 入住成功); this.Close(); catch Mess
11、ageBox.Show(用户已存在!); else 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(Form f) InitializeComponent(); this.Owner =
12、 f; comboBox1.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().ToString() != String.Empty & textBox3.Text.Trim()
13、.ToString() != String.Empty) try 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); c.linq.SubmitChanges(); MessageBox.Show(textBox1.Text.Trim
14、().ToString()+ 号房间添加成功); this.textBox1.Text = null; this.textBox3.Text = null; boBox1.Text = null; this.textBox1.Focus(); catch MessageBox.Show(房间号已存在!); else MessageBox.Show(不能为空!); private void addroom_FormClosed(object sender, FormClosedEventArgs e) this.Owner.Show(); private void button2_Click(o
15、bject sender, EventArgs e) this.Close(); 4、查看所有房间信息设计:namespace 宾馆管理信息系统 public partial class allroom : Form private connection c=new connection (); public allroom(Form f) InitializeComponent(); this.Owner = f; this.listView1.Clear(); this.listView1.View = View.LargeIcon; this.listView1.LargeImageLi
16、st = this.imageList1; Random rd = new Random(); this.listView1.BeginUpdate(); var result = from info in c.linq.room select new 房间号 = info.房间号码, 房间类型 = info.房间种类, 房间单价 = info.房间单价, 房间是否使用 = info.房间是否正在使用, ; foreach (var item in result) ListViewItem lvi = new ListViewItem(); if(item.房间是否使用.Trim()=否) l
17、vi.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_ItemActivate(object sender, EventArgs e) var result = from info in c.linq.room where info.房间号码 = listView1.F
18、ocusedItem.Text.Trim().ToString() select new 房间号 = info.房间号码, 房间类型 = info.房间种类, 房间单价 = info.房间单价, 房间是否使用 = info.房间是否正在使用, ; foreach (var item in result) DialogResult dr = MessageBox.Show(房间号: + listView1.FocusedItem.Text.ToString() + rn房间类型: + item.房间类型 + rn房间单价: + item.房间单价); private void allroom_F
19、ormClosed(object sender, FormClosedEventArgs e) this.Owner.Show(); 5、预订房间设计:namespace 宾馆管理信息系统 public partial class bookroom : Form private connection c = new connection(); public bookroom(Form f) InitializeComponent(); this.Owner = f; this.listView1.Clear(); this.listView1.View = View.LargeIcon; th
20、is.listView1.LargeImageList = this.imageList1; Random rd = new Random(); this.listView1.BeginUpdate(); var result = from info in c.linq.room where info.房间是否正在使用=否 select new 房间号 = info.房间号码, 房间类型 = info.房间种类, 房间单价 = info.房间单价, 房间是否使用 = info.房间是否正在使用, ; foreach (var item in result) ListViewItem lvi =
21、 new ListViewItem(); lvi.ImageIndex =0; lvi.Text = item.房间号.Trim().ToString(); this.listView1.Items.Add(lvi); this.listView1.EndUpdate(); private void bookroom_FormClosed(object sender, FormClosedEventArgs e) this.Owner.Show(); private void listView1_ItemActivate(object sender, EventArgs e) var resu
22、lt = from info in c.linq.room where info.房间号码 = listView1.FocusedItem.Text.Trim().ToString() select new 房间号 = info.房间号码, 房间类型 = info.房间种类, 房间单价 = info.房间单价, 房间是否使用 = info.房间是否正在使用, ; foreach (var item in result) DialogResult dr = MessageBox.Show(房间号: + listView1.FocusedItem.Text.ToString() + rn房间类型:
23、+item.房间类型+rn房间单价:+item.房间单价+rn确认使用么?, 提示, MessageBoxButtons.OKCancel); if (dr = DialogResult.OK) /用户选择确认的操作 addpeople a = new addpeople(this, listView1.FocusedItem.Text.Trim().ToString(); this.Hide(); a.Show(); 6、查看所有用户设计:namespace 宾馆管理信息系统 public partial class chakanyonghu : Form private connectio
24、n c = new connection(); public chakanyonghu(Form f) this.Owner = f; InitializeComponent(); var result = from info in c.linq.login select new 用户名 = info.id, 用户类型 = info.grade, ; dataGridView1.DataSource = result; 7、修改房间的信息设计:namespace 宾馆管理信息系统 public partial class changeroom : Form private connection
25、 c = new connection(); public changeroom(Form f) InitializeComponent(); this.Owner = f; var result = from info in c.linq.room select new 房间号 = info.房间号码, 房间类型 = info.房间种类, 房间单价 = info.房间单价, 房间是否使用 = info.房间是否正在使用, ; dataGridView1.DataSource = result; private void dataGridView1_CellDoubleClick(object
26、 sender, DataGridViewCellEventArgs e) string s = Convert.ToString(dataGridView10, e.RowIndex.Value).Trim(); changeroom2 d = new changeroom2(this, s); d.Show(); this.Hide(); private void button1_Click(object sender, EventArgs e) var result = from info in c.linq.room select new 房间号 = info.房间号码, 房间类型 =
27、 info.房间种类, 房间单价 = info.房间单价, 房间是否使用 = info.房间是否正在使用, ; dataGridView1.DataSource = result; namespace 宾馆管理信息系统 public partial class changeroom2 : Form private connection c = new connection(); private string s = null; public changeroom2(Form f,string s) InitializeComponent(); comboBox1.DropDownStyle =
28、 System.Windows.Forms.ComboBoxStyle.DropDownList; comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.Owner = f; this.s = s; var result = from info in c.linq.room where info.房间号码=s select new 房间号 = 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 (textBox1.Text.Trim().ToString() != String.Empty & textBox2.Text.Trim().ToStr
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1