Hotel Management System VB Final PDF
Hotel Management System VB Final PDF
* Abstract
The system aims at the maintenance and management of the
different Hotels that are available in the different parts of the
world. It mainly takes care of the Hotel management at the core
area of the database. The system provides the information regarding
the different Hotels that are available and their status specific to
availability. The guests can visit the site and register themselves
with the required information that is expected by the system. Each
registered guest can raise a request for the unit bookings. The
Guests are scheduled with the information of the availability of the
units for they have requested the time.
The total front end was dominated using HTML standards applied
with the dynamism of JAVA server pages. The communicating client
was designed using servlet and JSP’s. At all proper levels high care
was taken to check that the system manages the date consistency
with proper business validations. The database connectivity was
planned using the Java Data Base Connectivity , the authorization
and authorization was cross checked at all stages. The user level
accessibility has been restricted into two zones the administrative
and the normal user zone.
Introduction
The entire project has been develped keeping in view of the
Distributed client server computing technology in mind.The
specification have been normalized upto 3NF to eliminate all the
anomalies that may arise due to the database transactions that are
executed by the actual administration and users.The user interfaces
are browser specific to give distributed accessability for the overall
system.The internal database has beeb selected as Oracle 11g.
The basic constructs of the tablespaces,clusters and ridexes have
been exploited to provide higher consistency and reliability for the
data storage. The oracle 11g was a choice as it provides the
constructs of high level reliabiity and security.The total front end
was dominated using HTML standards applied with the dynamism of
JAVA server pages.
Thecommunicatin client was designed using servlets. At all proper
levels high care was taken to check that the system manages the
date consistency with proper business validations.The database
connectivity was planned using the Java DataBase Connectivity,the
authorization and authorization was cross checked at all stages.The
user level accessabiity has been restricted into two zones the
administrative and the normal user zone.
Project Design Description
* Required Hardware
o Pentium IV Processor.
o 512 MB RAM.
o 20 GB Hard Disk space.
o Ethernet card with an Internet and Internet zone.
* Required Software
o Windows 8 operating system.
o Internet explorer11 and Netscape navigator.
o Oracle 11g.
o Servlets
o JSP
o TCP/IP Protocol suite.
Imports System.Data.OleDb
Public Class frmLogin
Private Sub OK_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles OK.Click
If Trim(UsernameTextBox.Text) = "" Or
Trim(PasswordTextBox.Text) = "" Then
MsgBox("Please Enter Both Fields!", vbInformation,
"Note")
Else
con.Open()
Dim sql = "SELECT * FROM tblUser WHERE username
= '" & SafeSqlLiteral(UsernameTextBox.Text, 2) & "' AND password
= '" & SafeSqlLiteral(PasswordTextBox.Text, 2) & "'"
Dim cmd = New OleDbCommand(sql, con)
Dim dr As OleDbDataReader = cmd.ExecuteReader
Try
If dr.Read = False Then
MsgBox("Login Failed!", vbCritical, "Note")
Else
MsgBox("Login Successful!", vbInformation,
"Note")
frmMain.status.Items(0).Text = "Login as : " &
Trim(UsernameTextBox.Text)
Dim datenow As Date = Now
frmMain.status.Items(2).Text = "Date and Time :
" & datenow.ToString("MMMM dd, yyyy") & " " & TimeOfDay
con.Close()
Me.Hide()
frmMain.ShowDialog()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
con.Close()
End If
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Cancel.Click
Me.Close()
End
End Sub
Private Sub frmLogin_Load(sender As System.Object, e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class
Public Class frmMain
Private Sub frmMain_FormClosing(ByVal sender As Object,
ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles
Me.FormClosing
Dim exit_app As String = MsgBox("Exit application?",
vbQuestion + vbYesNo, "Exit")
If exit_app = vbNo Then
e.Cancel = True
Else
End
End If
End Sub
Private Sub frmMain_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub toolbarCheckIn_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles toolbarCheckIn.Click
frmCheckin.ShowDialog()
End Sub
Private Sub ToolStripButton13_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ToolStripButton13.Click
Dim exit_app As String = MsgBox("Exit application?",
vbQuestion + vbYesNo, "Exit")
If exit_app = vbYes Then
End
End If
End Sub
Private Sub ToolStripButton12_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ToolStripButton12.Click
Dim out_app As String = MsgBox("Logout from
application?", vbQuestion + vbYesNo, "Logout")
If out_app = vbYes Then
con.Close()
Me.Hide()
End If
End Sub
End If
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ExitToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub toolbarCheckOut_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
toolbarCheckOut.Click
frmCheckout.ShowDialog()
End Sub
Private Sub SettingsToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
SettingsToolStripMenuItem.Click
End Sub
Private Sub FileToolStripMenuItem1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
FileToolStripMenuItem1.Click
End Sub
Private Sub CheckedInListToolStripMenuItem_Click(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
CheckedInListToolStripMenuItem.Click
frmCheckinListMonitor.ShowDialog()
End Sub
Private Sub RoomStatusToolStripMenuItem_Click(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
RoomStatusToolStripMenuItem.Click
frmRoomListMonitor.ShowDialog()
End Sub
Private Sub ReservedListToolStripMenuItem_Click(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
ReservedListToolStripMenuItem.Click
frmReserveListMonitor.ShowDialog()
End Sub
Private Sub CheckedOutListToolStripMenuItem_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles
CheckedOutListToolStripMenuItem.Click
frmCheckOutList.ShowDialog()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Timer1.Tick
Dim datenow As Date = Now
status.Items(2).Text = "Date and Time : " &
datenow.ToString("MMMM dd, yyyy") & " " & TimeOfDay
End Sub
Private Sub DiscountToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DiscountToolStripMenuItem.Click
frmDiscount.ShowDialog()
End Sub
Private Sub RoomToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RoomToolStripMenuItem.Click
frmRoom.ShowDialog()
frmRoom.TabPage2.Select()
End Sub
lv.SubItems.Add(Dt.Rows(indx).Item("AdvancePayment").ToString("00.0
0"))
lv.SubItems.Add(Dt.Rows(indx).Item("DiscountType"))
discount = Val(Dt.Rows(indx).Item("DiscountRate"))
subtotal = (days * rate) - ((days * rate) * discount)
total = (Val(subtotal) -
Val(Dt.Rows(indx).Item("AdvancePayment"))).ToString("00.00")
If Val(subtotal) >
Val(Dt.Rows(indx).Item("AdvancePayment")) Then
lv.SubItems.Add(Val(total))
Else
lv.SubItems.Add("0")
End If
lvlcheckin.Items.Add(lv)
Next
rs.Dispose()
con.Close()
End Sub
Private Sub cboDiscount_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboDiscount.SelectedIndexChanged
End Sub
Private Sub TabPage1_Click(sender As System.Object, e As
System.EventArgs) Handles TabPage1.Click
End Sub
End Class
Imports System.Data.OleDb
Public Class frmCheckout
Private Sub bttnSearchGuest_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
bttnSearchGuest.Click
frmCheckinList.ShowDialog()
End Sub
Private Sub txtRoomNumber_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtRoomNumber.TextChanged
If txtRoomNumber.Text = Nothing Then
Else
con.Open()
Dim dt As New DataTable("tblRoom")
rs = New OleDbDataAdapter("SELECT * FROM tblRoom
WHERE RoomNumber = " & txtRoomNumber.Text & "", con)
rs.Fill(dt)
txtRoomType.Text = dt.Rows(0).Item("RoomType")
txtRoomRate.Text =
Val(dt.Rows(0).Item("RoomRate")).ToString("N")
rs.Dispose()
con.Close()
End If
End Sub
Private Sub txtCash_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtCash.KeyPress
If (e.KeyChar < "0" OrElse e.KeyChar > "9") _
AndAlso e.KeyChar <> ControlChars.Back AndAlso e.KeyChar
<> "." Then
'cancel keys
e.Handled = True
End If
End Sub
Private Sub txtCash_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtCash.TextChanged
If Val(txtCash.Text) < Val(txtTotal.Text) Then
txtChange.Text = "0.00"
Else
txtChange.Text = (Val(txtCash.Text) -
Val(txtTotal.Text)).ToString("N")
End If
End Sub
Private Sub bttnCheckout_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles bttnCheckout.Click
If txtTransID.Text = Nothing Then
MsgBox("Please select transaction to checkout!",
vbExclamation, "Note")
Else
If Val(txtCash.Text) < Val(txtTotal.Text) Then
MsgBox("Insufficient cash!", vbExclamation, "Note")
Else
Dim out As String = MsgBox("Confirm Checkout",
vbQuestion + vbYesNo, "Checkout")
If out = vbYes Then
con.Open()
Dim update_trans As New
OleDbCommand("UPDATE tblTransaction SET Remarks = 'Checkout'
WHERE TransID = " & lblTransID.Text & "", con)
update_trans.ExecuteNonQuery()
Dim update_guest As New
OleDbCommand("UPDATE tblGuest SET Remarks = 'Available'
WHERE ID = " & lblGuestID.Text & "", con)
update_guest.ExecuteNonQuery()
Dim update_room As New
OleDbCommand("UPDATE tblRoom SET Status = 'Available' WHERE
RoomNumber = " & txtRoomNumber.Text & "", con)
update_room.ExecuteNonQuery()
MsgBox("Guest Checked out!", vbInformation,
"Checkout")
con.Close()
clear_text()
End If
End If
End If
End Sub
Public Sub clear_text()
txtTransID.Clear()
txtGuestName.Clear()
txtRoomNumber.Clear()
txtRoomRate.Clear()
txtRoomType.Clear()
txtCheckin.Clear()
txtCheckout.Clear()
txtChildren.Clear()
txtAdult.Clear()
txtAdvance.Clear()
txtDiscountType.Clear()
txtTotal.Clear()
txtSubTotal.Clear()
txtDays.Clear()
txtCash.Clear()
txtChange.Clear()
End Sub
Private Sub lblTransID_TextChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles lblTransID.TextChanged
End Sub
Private Sub frmCheckout_FormClosing(ByVal sender As Object,
ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles
Me.FormClosing
clear_text()
End Sub
Private Sub frmCheckout_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
txtRoomNumber.Clear()
dtOut.Value = Date.Now
End Sub
Private Sub txtAdvance_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtAdvance.TextChanged
End Sub
Private Sub txtTotal_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtTotal.TextChanged
End Sub
Private Sub txtDiscountType_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtDiscountType.TextChanged
End Sub
End Class
Coding For Module
Imports System.Data.OleDb
Imports System.Text.RegularExpressions
Module Module1
Public con As New
OleDbConnection("Provider=MICROSOFT.ACE.OLEDB.12.0; Data
Source=|DataDirectory|/database.accdb")
Public rs As New OleDbDataAdapter
Function SafeSqlLiteral(ByVal strValue, ByVal intLevel) As String
'*** Written by user CWA, CoolWebAwards.com Forums. 2
February 2010
'*** http://forum.coolwebawards.com/threads/11-
Preventing-SQL-injection-attacks-using-VB-NET
' intLevel represent how thorough the value will be checked
for dangerous code
' intLevel (1) - Do just the basic. This level will already
counter most of the SQL injection attacks
' intLevel (2) - (non breaking space) will be added
to most words used in SQL queries to prevent unauthorized access
to the database. Safe to be printed back into HTML code. Don't use
for usernames or passwords
If Not IsDbNull(strValue) Then
If intLevel > 0 Then
strValue = replace(strValue, "'", "''") ' Most
important one! This line alone can prevent most injection attacks
strValue = replace(strValue, "--", "")
strValue = replace(strValue, "[", "[[]")
strValue = replace(strValue, "%", "[%]")
End If
If intLevel > 1 Then
Dim myArray As Array
myArray = Split("xp_ ;update ;insert ;select ;drop
;alter ;create ;rename ;delete ;replace ", ";")
Dim i, i2, intLenghtLeft As Integer
For i = LBound(myArray) To UBound(myArray)
Dim rx As New Regex(myArray(i), RegexOptions.Compiled Or
RegexOptions.IgnoreCase)
Dim matches As MatchCollection =
rx.Matches(strValue)
i2 = 0
For Each match As Match In matches
Dim groups As GroupCollection =
match.Groups
intLenghtLeft = groups.Item(0).Index +
len(myArray(i)) + i2
strValue = Left(strValue, intLenghtLeft - 1)
& " " & right(strValue, len(strValue) - intLenghtLeft)
i2 += 5
Next
Next
End If
'strValue = replace(strValue, ";", "; ")
'strValue = replace(strValue, "_", "[_]")
Return strValue
Else
Return strValue
End If
End Function
End Module