基本信息
源码名称:<赞>winform 宾馆酒店管理系统源码(含数据库脚本,vb开发语言)
源码大小:3.44M
文件格式:.zip
开发语言:ASP
更新时间:2018-07-04
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
一个用winform做的宾馆酒店管理系统,附数据库
登陆账号:罗斌
登陆密码:123456
友情提示:实例中的 新增操作只是重置数据,你填写完毕数据后,点击保存按钮才真正保存到数据库
'文件名:BookForm.vb Imports System.Data.SqlClient Public Class BookForm Public MyOperator As String Public MyCompany As String Private Sub BookForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '添加酒店房间类别ComboBox控件的列表项 Dim MyConnection As New SqlConnection() MyConnection.ConnectionString = My.Settings.MyHotelConnectionString MyConnection.Open() Dim MyCommand As New SqlCommand("Select DISTINCT 类别 From 酒店房间", MyConnection) Dim MyReader As SqlDataReader = MyCommand.ExecuteReader() While (MyReader.Read()) Me.酒店房间类别ComboBox.Items.Add(MyReader.GetString(0)) End While Me.酒店房间类别ComboBox.Items.Add("所有房间") Me.酒店房间类别ComboBox.Text = "所有房间" If (MyConnection.State = ConnectionState.Open) Then MyConnection.Close() End If End Sub Private Sub 酒店房间类别ComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 酒店房间类别ComboBox.SelectedIndexChanged '获取未完全入住房间信息 Me.酒店可用房间DataGridView.GridColor = Color.Blue Dim MySQLConnectionString As String = My.Settings.MyHotelConnectionString Dim MySQL As String = "Select 房号,单价,可容纳人数-已入住人数 as 可入住人数,楼层,类别,说明,可容纳人数,已入住人数 From 酒店房间 Where 类别='" Me.酒店房间类别ComboBox.Text "'" If (Me.酒店房间类别ComboBox.Text = "所有房间") Then MySQL = "Select 房号,单价,可容纳人数-已入住人数 as 可入住人数,楼层,类别,说明,可容纳人数,已入住人数 From 酒店房间 " End If Dim MyConnection As New SqlConnection(MySQLConnectionString) MyConnection.Open() Dim MyTable As New DataTable() Dim MyAdapter As New SqlDataAdapter(MySQL, MyConnection) MyAdapter.Fill(MyTable) Me.酒店可用房间DataGridView.DataSource = MyTable If (MyConnection.State = ConnectionState.Open) Then MyConnection.Close() End If End Sub Private Sub 酒店可用房间DataGridView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 酒店可用房间DataGridView.Click '确定是否设置房号和住宿人数信息 Me.房号TextBox.Text = Me.酒店可用房间DataGridView.CurrentRow.Cells(0).Value.ToString() Dim MyCount As Integer = Convert.ToInt16(Me.酒店可用房间DataGridView.CurrentRow.Cells(2).Value.ToString()) Me.住宿人数ComboBox.Items.Clear() For i As Integer = 1 To MyCount Step 1 Me.住宿人数ComboBox.Items.Add(i.ToString()) Next Me.住宿人数ComboBox.Text = MyCount.ToString() End Sub Private Sub 新增Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 新增Button.Click Me.房号TextBox.Text = "" Me.预收押金TextBox.Text = "" Me.入住日期DateTimePicker.Value = DateTime.Now Me.离开日期DateTimePicker.Value = DateTime.Now Me.客人姓名TextBox.Text = "" Me.住宿人数ComboBox.Text = "0" Me.客人性别ComboBox.Text = "男" Me.联系电话TextBox.Text = "" Me.操作人员TextBox.Text = Me.MyOperator '自动计算自编号 Dim MySQLConnectionString As String = My.Settings.MyHotelConnectionString Dim MyConnection As New SqlConnection(MySQLConnectionString) MyConnection.Open() Dim MyCommand As SqlCommand = MyConnection.CreateCommand() MyCommand.CommandText = "Select max(预约编号) 最大编号 From 客房预约单" Dim MyResult As Object = MyCommand.ExecuteScalar() Dim MyID As System.Int64 = 1 If (Not (MyResult Is System.DBNull.Value)) Then Dim MyMaxID As String = MyResult.ToString().Trim() MyMaxID = MyMaxID.Substring(2, MyMaxID.Length - 2) MyID = Convert.ToInt64(MyMaxID) 1 End If Dim MyLength As Integer = MyID.ToString().Length Dim MyNewID As String = "" Select Case (MyLength) Case 1 MyNewID = "YY0000000" MyID.ToString() Case 2 MyNewID = "YY000000" MyID.ToString() Case 3 MyNewID = "YY00000" MyID.ToString() Case 4 MyNewID = "YY0000" MyID.ToString() Case 5 MyNewID = "YY000" MyID.ToString() Case 6 MyNewID = "YY00" MyID.ToString() Case 7 MyNewID = "YY0" MyID.ToString() End Select If (MyConnection.State = ConnectionState.Open) Then MyConnection.Close() End If Me.预约编号TextBox.Text = MyNewID End Sub Private Sub 打印Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 打印Button.Click Me.printPreviewDialog1.Document = Me.printDocument1 Me.printPreviewDialog1.ShowDialog() End Sub Private Sub printDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles printDocument1.PrintPage '打印入住单 e.Graphics.DrawString(Me.MyCompany "客房预约单", New Font("宋体", 20), Brushes.Black, 220, 80) e.Graphics.DrawString("预约编号:" Me.预约编号TextBox.Text, New Font("宋体", 12), Brushes.Black, 100, 150) Dim MyPrintTime As DateTime = DateTime.Now e.Graphics.DrawString("打印日期:" MyPrintTime.ToLongDateString() MyPrintTime.ToLongTimeString(), New Font("宋体", 12), Brushes.Black, 450, 150) e.Graphics.DrawLine(New Pen(Color.Black), 100, 180, 720, 180) e.Graphics.DrawLine(New Pen(Color.Black), 100, 220, 720, 220) e.Graphics.DrawLine(New Pen(Color.Black), 100, 260, 720, 260) e.Graphics.DrawLine(New Pen(Color.Black), 100, 300, 720, 300) 'e.Graphics.DrawLine(new Pen(Color.Black), 100, 340, 720, 340) e.Graphics.DrawLine(New Pen(Color.Black), 100, 180, 100, 300) e.Graphics.DrawLine(New Pen(Color.Black), 220, 180, 220, 260) e.Graphics.DrawLine(New Pen(Color.Black), 400, 180, 400, 300) e.Graphics.DrawLine(New Pen(Color.Black), 720, 180, 720, 300) e.Graphics.DrawString("房号:" Me.房号TextBox.Text, New Font("宋体", 12), Brushes.Black, 105, 190) e.Graphics.DrawString("姓名:" Me.客人姓名TextBox.Text, New Font("宋体", 12), Brushes.Black, 105, 230) e.Graphics.DrawString("联系电话:" Me.联系电话TextBox.Text, New Font("宋体", 12), Brushes.Black, 405, 190) e.Graphics.DrawString("人数:" Me.住宿人数ComboBox.Text, New Font("宋体", 12), Brushes.Black, 405, 230) e.Graphics.DrawString("性别:" Me.客人性别ComboBox.Text, New Font("宋体", 12), Brushes.Black, 225, 190) e.Graphics.DrawString("预收押金:" Me.预收押金TextBox.Text, New Font("宋体", 12), Brushes.Black, 225, 230) If (Me.入住日期DateTimePicker.Value.ToString().Length > 0) Then e.Graphics.DrawString("入住日期:" Me.入住日期DateTimePicker.Value.ToString().Remove(10), New Font("宋体", 12), Brushes.Black, 105, 270) End If If (Me.离开日期DateTimePicker.Value.ToString().Length > 0) Then e.Graphics.DrawString("离开日期:" Me.离开日期DateTimePicker.Value.ToString().Remove(10), New Font("宋体", 12), Brushes.Black, 405, 270) End If e.Graphics.DrawString("操作员:" Me.操作人员TextBox.Text, New Font("宋体", 12), Brushes.Black, 600, 310) e.Graphics.DrawString("温馨提示:为了维护您及他人的合法权益,请不要带未经登记的人员进出您的房间。", New Font("宋体", 12), Brushes.Black, 100, 330) e.Graphics.DrawString("警察提示:请保管好您的物品,重要物品请寄存于酒店寄存处,免费寄存!", New Font("宋体", 12), Brushes.Black, 100, 350) e.Graphics.DrawString("谢谢合作!", New Font("宋体", 20), Brushes.Black, 550, 380) End Sub Private Sub 保存Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 保存Button.Click If (MessageBox.Show("请检查旅客预约信息是否正确,一旦保存就无法修改,是否继续?", "信息提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No) Then Return End If Dim MySQLConnectionString As String = My.Settings.MyHotelConnectionString Dim MySQL As String = "INSERT INTO [客房预约单] ([预约编号], [房号], [预收押金], [入住日期], [离开日期], [客人姓名],[住宿人数], [客人性别], [联系电话], [操作人员]) VALUES (@预约编号, @房号, @预收押金, @入住日期, @离开日期, @客人姓名,@住宿人数, @客人性别, @联系电话, @操作人员)" Dim MyConnection As New SqlConnection(MySQLConnectionString) MyConnection.Open() Dim MyCommand As SqlCommand = MyConnection.CreateCommand() MyCommand.CommandText = MySQL MyCommand.Parameters.Add(New SqlParameter("@预约编号", SqlDbType.VarChar)) MyCommand.Parameters.Add(New SqlParameter("@房号", SqlDbType.VarChar)) MyCommand.Parameters.Add(New SqlParameter("@预收押金", SqlDbType.Float)) MyCommand.Parameters.Add(New SqlParameter("@入住日期", SqlDbType.DateTime)) MyCommand.Parameters.Add(New SqlParameter("@离开日期", SqlDbType.DateTime)) MyCommand.Parameters.Add(New SqlParameter("@客人姓名", SqlDbType.VarChar)) MyCommand.Parameters.Add(New SqlParameter("@住宿人数", SqlDbType.Int)) MyCommand.Parameters.Add(New SqlParameter("@客人性别", SqlDbType.VarChar)) MyCommand.Parameters.Add(New SqlParameter("@联系电话", SqlDbType.VarChar)) MyCommand.Parameters.Add(New SqlParameter("@操作人员", SqlDbType.VarChar)) MyCommand.Parameters("@预约编号").Value = Me.预约编号TextBox.Text MyCommand.Parameters("@房号").Value = Me.房号TextBox.Text MyCommand.Parameters("@预收押金").Value = Me.预收押金TextBox.Text MyCommand.Parameters("@入住日期").Value = Me.入住日期DateTimePicker.Value MyCommand.Parameters("@离开日期").Value = Me.离开日期DateTimePicker.Value MyCommand.Parameters("@客人姓名").Value = Me.客人姓名TextBox.Text MyCommand.Parameters("@住宿人数").Value = Me.住宿人数ComboBox.Text MyCommand.Parameters("@客人性别").Value = Me.客人性别ComboBox.Text MyCommand.Parameters("@联系电话").Value = Me.联系电话TextBox.Text MyCommand.Parameters("@操作人员").Value = Me.操作人员TextBox.Text MyCommand.ExecuteNonQuery() MySQL = "Update 酒店房间 Set 已入住人数=已入住人数 " Me.住宿人数ComboBox.Text " WHERE 房号='" Me.房号TextBox.Text "'" MyCommand.CommandText = MySQL MyCommand.ExecuteNonQuery() If (MyConnection.State = ConnectionState.Open) Then MyConnection.Close() End If 酒店房间类别ComboBox_SelectedIndexChanged(Nothing, Nothing) 新增Button_Click(Nothing, Nothing) End Sub End Class