Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 28

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

SIDDHANT COLLAGE OF EMGINEERING


(2th Shift Diploma)
P/L Sudumbare Tal-Mavel Dest-pune

Micro Project
Academic Year (2021-22)
Maharashtra State Board of Technical Education
Program code and name: CO
Subject: Gui Application Development Using Vb.Net
Semester: Fourth

A Micro Project on
Hotel management System
Sr. Roll No. Student Name Enrollment Seat No.
No.
1 Om Gole 2016240027
2 Shubham Deshmukh 2016240020

Under Guidance of
Mrs. Yogita Rode mam…
Maharashtra State Board of Technical Education

Certificate
This is to certify that Mr. Om Gole ……. Roll No….. Of fourth
Semester of Diploma in Computer Engineering of Institute, Siddhant
college of Engineering (Code: 1624) has completed the Practical
Activities (PA) satisfactorily in Course Gui Application Development
Using Vb.Net (code: 20034) for the academic year 2021 – 2022 as
prescribed in the curriculum.

Place: Sudumbare …… Enrollment No: 2016240027


Exam. Seat No: …………………………

Subject Teacher Head of Department Principle


Maharashtra State Board of Technical Education

Certificate
This is to certify that Mr. Shubham Deshmukh ……. Roll No….. Of
fourth Semester of Diploma in Computer Engineering of Institute,
Siddhant college of Engineering (Code: 1624) has completed the
Practical Activities (PA) satisfactorily in Course Gui Application
Development Using Vb.Net (code: 20034) for the academic year 2021
– 2022 as prescribed in the curriculum.

Place: Sudumbare …… Enrollment No: 2016240020


Exam. Seat No: …………………………

Subject Teacher Head of Department Principle


ACKNOWLEDGEMENT
It is a matter of great pleasure by getting the opportunity of
highlighting. A fraction of knowledge I acquired during our
technical education through this project.

This would not have been possible without the guidance and
help of many people. This is the only page where we have the
opportunity of expressing our emotions and gratitude from the
core of our heart to them. This project would not have been
successful without enlightened ideas, timely suggestions and
interest of our most respected guide Of Mrs. Yogita Rode
mam without her best guidance; this would have been an
impossible task to complete.

I would like to thank Mrs. Sarita Kale mamHead of our


department for providing the necessary facility using the period
of working on this project work. I would also like to thank our
Principal Mrs. Nanda Kulkarni who encouraged us and
created a healthy environment for all of us to learn in the best
possible way.

Finally, I would pay my respect and love to my parents and all


Family members as well as friends for their love and
encouragement throughout this Micro Project.
Index
Sr. No. Content Page No.
1 Abstract
2 Introduction
3 Source Code
4 Out Put
5 Reference
Abstract
The main objective of the VB.Net Project on Hotel Management
System is to manage the details of Hotel, Customers, Rooms,
Booking, and Services. It manages all the information about
Hotel, Payments, Services, Hotel.

The project is totally built at


administrative end and thus only the administrator is
guaranteed the access. The purpose of the project is to build
an application program to reduce the manual work for
managing the Hotel, Customers, Payments, and Rooms. It
tracks all the details about the Rooms, Booking, and Services.

Hotel management system project offers


various services. It maintains records of all the customers. We
can also book rooms in advance and Discounts can be done
through this VB.net project. We can monitor available rooms in
the hotel.
Introduction
Features of Hotel Management System in VB.net Project
• The basic feature of this system is easy to access by an employee.
• The main feature of this program is it can choose a room that suits
the taste of a customer.
• The rooms have three types of Single, Twice, Family and have an
affordable cost of the rooms
• the system can add guest information.
• This system also can see all those who are in the check-in and
checkout the list.
• The admin can determine all of the guest lists.
 This VB project with tutorial and guide for developing a code. Hotel
Management System (Room) is an open source you can Download
zip and edit as per you need. If you want more latest VB projects
here. This is simple and basic level small project for learning purpose.
Also you can modified this system as per your requriments and
develop a perfect advance level project.

Zip file containing the source code that can be extracted and


then imported into Visual Studio 2010. This Source code for BE,
BTech, MCA, BCA, Engineering, B.Scs. IT, Software engineering final
year students can submit in college. This script developed by Neeta
Kadam. This desktop application 100% working smooth without any
bug. It is developed using vb and Database SQL server 2008. This
software code helpful in academic projects for final year students.
We have a great collection of VB projects.
Main Content / Body
Before getting access to the main form the user need to login
first by entering his username and password.
And we will check if the username/password textbox are empty.
And if the user enter the wrong username or password or this
user doesn't exists at all.
The Login Button: 
Private Sub ButtonLogin_Click(sender As Object, e As EventArgs)
Handles ButtonLogin.Click

        Dim connection As New CONNECTION()


        Dim adapter As New MySqlDataAdapter()
        Dim command As New MySqlCommand()
        Dim table As New DataTable()
        Dim username As String = TextBoxUsername.Text
        Dim password As String = TextBoxPassword.Text
        Dim selectQuery As String = "SELECT * FROM `users`
WHERE `username`=@un AND `password`=@pass"

        command.CommandText = selectQuery
        command.Connection = connection.getConnection()

        command.Parameters.Add("@un",
MySqlDbType.VarChar).Value = username
        command.Parameters.Add("@pass",
MySqlDbType.VarChar).Value = password

        adapter.SelectCommand = command
        adapter.Fill(table)

        If table.Rows.Count > 0 Then


            Dim mainForm As New MainForm()
            mainForm.Show()
            Me.Hide()

        Else

            MessageBox.Show("Invalid Username Or Password", "Login


Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

        End If

    End Sub

if the user enter the correct username and password we will show
him the main form.
2 - The Main Form
This is a quick and easy from with a menu created with a panel and
labels to take the user to the selected form on label click. 

    Private Sub LabelMClients_Click(sender As Object, e As


EventArgs) Handles LabelMClients.Click

        Dim manage_Cl_Form As New ManageClientsForm()


        manage_Cl_Form.ShowDialog()

    End Sub

    Private Sub LabelMRooms_Click(sender As Object, e As


EventArgs) Handles LabelMRooms.Click

        Dim manage_Rm_Form As New ManageRoomsForm()


        manage_Rm_Form.ShowDialog()

    End Sub

    Private Sub LabelMReservastions_Click(sender As Object, e As


EventArgs) Handles LabelMReservastions.Click

        Dim manage_Rv_Form As New ManageReservationsForm()


        manage_Rv_Form.ShowDialog()

    End Sub
3 - The Manage Hotel Clients Form

this form allow the user to manage the hotel clients.


this form contains a datagridview filled with all clients data.
this form call functions from the class "CLIENT". 

- Add New Client Button

 Private Sub ButtonAdd_Click(sender As Object, e As EventArgs)


Handles ButtonAdd.Click

        Dim fname As String = TextBoxFname.Text


        Dim lname As String = TextBoxLname.Text
        Dim phone As String = TextBoxPhone.Text
        Dim email As String = TextBoxEmail.Text

        If fname.Trim().Equals("") Or lname.Trim().Equals("") Or
phone.Trim().Equals("") Then
            MessageBox.Show("Required First & Last Name, Phone",
"Missing Information", MessageBoxButtons.OK,
MessageBoxIcon.Error)

        Else

            If client.addClient(fname, lname, phone, email) Then

                MessageBox.Show("New Client Added Successfully",


"Add Client", MessageBoxButtons.OK,
MessageBoxIcon.Information)
                DataGridView1.DataSource = client.getAllClients()

            Else

                MessageBox.Show("Client Not Added", "Add Client",


MessageBoxButtons.OK, MessageBoxIcon.Warning)

            End If

        End If

    End Sub

- Edit The Selected Client Button

  Private Sub ButtonEdit_Click(sender As Object, e As EventArgs)


Handles ButtonEdit.Click

        Dim fname As String = TextBoxFname.Text


        Dim lname As String = TextBoxLname.Text
        Dim phone As String = TextBoxPhone.Text
        Dim email As String = TextBoxEmail.Text
        If TextBoxId.Text.Trim().Equals("") Then

            MessageBox.Show("Select The User You Want to Edit",


"Missing ID", MessageBoxButtons.OK, MessageBoxIcon.Error)

        Else

            If fname.Trim().Equals("") Or lname.Trim().Equals("") Or
phone.Trim().Equals("") Then

                MessageBox.Show("Required First & Last Name, Phone",


"Missing Information", MessageBoxButtons.OK,
MessageBoxIcon.Error)

            Else

                Dim id As Integer = Convert.ToInt32(TextBoxId.Text)

                If client.editClient(id, fname, lname, phone, email) Then

                    MessageBox.Show("Client Updated Successfully", "Edit


Client", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    DataGridView1.DataSource = client.getAllClients()

                Else

                    MessageBox.Show("Client Not Updated", "Edit Client",


MessageBoxButtons.OK, MessageBoxIcon.Warning)

                End If

            End If

        End If
    End Sub

- Delete The Selected Client Button

  Private Sub ButtonRemove_Click(sender As Object, e As


EventArgs) Handles ButtonRemove.Click

        If TextBoxId.Text.Trim().Equals("") Then

            MessageBox.Show("Enter The Client Id", "Missing ID",


MessageBoxButtons.OK, MessageBoxIcon.Error)

        Else
            Dim id As Integer = Convert.ToInt32(TextBoxId.Text)

            If client.removeClient(id) Then

                MessageBox.Show("Client Deleted Successfully", "Delte


Client", MessageBoxButtons.OK, MessageBoxIcon.Information)
                DataGridView1.DataSource = client.getAllClients()

                ' clear boxes


                TextBoxId.Text = ""
                TextBoxFname.Text = ""
                TextBoxLname.Text = ""
                TextBoxPhone.Text = ""
                TextBoxEmail.Text = ""

            Else
                MessageBox.Show("Client Not Deleted", "Delete Client",
MessageBoxButtons.OK, MessageBoxIcon.Warning)

            End If

        End If

    End Sub

4 - The Manage Hotel Rooms Form


here the user can add a new room to the hotel system.
when you add a new room you need to select the type of room
(single, double, family, suite). 

and like the client form you can view all rooms in a datagridview +
how many rooms this hotel have, and add, edit, remove the selecte
one + a combobx populated with all room's categories.

- Add New Room Button


when you add a new room the "reserved" column will be set to no by
default.

           Private Sub ButtonAdd_Click(sender As Object, e As


EventArgs) Handles ButtonAdd.Click

        Try

            Dim type As Integer =


Convert.ToInt32(ComboBoxType.SelectedValue)
            Dim phone As String = TextBoxPhone.Text
            Dim reserved As String = ""
            If RadioButtonYes.Checked Then

                reserved = "Yes"

            ElseIf RadioButtonNo.Checked Then

                reserved = "No"

            End If

            If TextBoxNumber.Text.Trim().Equals("") Or
TextBoxPhone.Text.Trim().Equals("") Then

                MessageBox.Show("Make Sure to Enter The Room


Number and The Phone Number", "Empty Fields",
MessageBoxButtons.OK, MessageBoxIcon.Error)

            Else

                Dim number As Integer =


Convert.ToInt32(TextBoxNumber.Text)

                If room.addRoom(number, type, phone, reserved) Then

                    MessageBox.Show("Room Added Successfully", "Add


Room", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    DataGridView1.DataSource = room.getAllRooms()
                    ' display the number of rooms on the LabelRoomsCount
                    LabelRoomsCount.Text =
room.getAllRooms().Rows.Count.ToString() + " Room"

                Else

                    MessageBox.Show("Room Not Added", "Add Room",


MessageBoxButtons.OK, MessageBoxIcon.Error)
                End If

            End If

        Catch ex As Exception

            MessageBox.Show(ex.Message, "Duplicate Room Number",


MessageBoxButtons.OK, MessageBoxIcon.Warning)

        End Try
        
    End Sub

- Edit The Selected Room Button

            Private Sub ButtonEdit_Click(sender As Object, e As


EventArgs) Handles ButtonEdit.Click

        Try

            Dim type As Integer =


Convert.ToInt32(ComboBoxType.SelectedValue)
            Dim phone As String = TextBoxPhone.Text
            Dim reserved As String = ""

            If RadioButtonYes.Checked Then

                reserved = "Yes"

            ElseIf RadioButtonNo.Checked Then


                reserved = "No"

            End If

            If TextBoxNumber.Text.Trim().Equals("") Or
TextBoxPhone.Text.Trim().Equals("") Then

                MessageBox.Show("Make Sure to Enter The Room


Number and The Phone Number", "Empty Fields",
MessageBoxButtons.OK, MessageBoxIcon.Error)

            Else

                Dim number As Integer =


Convert.ToInt32(TextBoxNumber.Text)

                If room.editRoom(number, type, phone, reserved) Then

                    MessageBox.Show("Room Updated Successfully", "Edit


Room", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    DataGridView1.DataSource = room.getAllRooms()

                Else

                    MessageBox.Show("Room Not Updated", "Edit Room",


MessageBoxButtons.OK, MessageBoxIcon.Error)

                End If

            End If

        Catch ex As Exception

            MessageBox.Show(ex.Message)
        End Try

    End Sub

- Delete The Selected Room Button

            Private Sub ButtonRemove_Click(sender As Object, e As


EventArgs) Handles ButtonRemove.Click

        Try

            Dim number As Integer =


Convert.ToInt32(TextBoxNumber.Text)

            If room.removeRoom(number) Then

                MessageBox.Show("Room Deleted Successfully", "Delete


Room", MessageBoxButtons.OK, MessageBoxIcon.Information)
                DataGridView1.DataSource = room.getAllRooms()

                ' reset and clear fields


                TextBoxNumber.Text = ""
                ComboBoxType.SelectedIndex = 0
                TextBoxPhone.Text = ""
                RadioButtonYes.Checked = True

                ' display the number of rooms on the LabelRoomsCount


                LabelRoomsCount.Text =
room.getAllRooms().Rows.Count.ToString() + " Room"

            Else
                MessageBox.Show("Room Not Deleted", "Delete Room",
MessageBoxButtons.OK, MessageBoxIcon.Warning)

            End If

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

5 - The Manage Hotel Reservations Form

This form allow the user to manage the clients room reservations.
to create a reservation you need: 1) enter the reservation id, 2)
select the client who will reserve, 3) you need to select the room
where the client will stay.

when you add a new reservation the system will check:


- if the user enter all required informations.
- if the user enter a date in that is equal or come after the current
day date.
- if the user enter a date out that is equal or come after the date in.

- Add a New Reservation Button

Private Sub ButtonAdd_Click(sender As Object, e As EventArgs)


Handles ButtonAdd.Click

        Try

            Dim clientId As Integer =


Convert.ToInt32(TextBoxClientID.Text)
            Dim roomNumber As Integer =
Convert.ToInt32(ComboBoxRoomNumber.SelectedValue.ToString())
            Dim dateIn As Date = DateTimePickerIN.Value
            Dim dateOut As Date = DateTimePickerOUT.Value

            If DateTime.Compare(dateIn.Date, DateTime.Now.Date) < 0


Then

                MessageBox.Show("The Date In Must be = Or > to Today


Date", "Invalid Date IN", MessageBoxButtons.OK,
MessageBoxIcon.Error)

            ElseIf DateTime.Compare(dateOut.Date, dateIn.Date) < 0


Then

                MessageBox.Show("The Date Out Must be = Or > to The


Date In", "Invalid Date OUT", MessageBoxButtons.OK,
MessageBoxIcon.Error)

            Else

                If reservation.addReservation(roomNumber, clientId,
dateIn, dateOut) Then

                    MessageBox.Show("Reservation Added Successfully",


"Add Reservation", MessageBoxButtons.OK,
MessageBoxIcon.Information)
                    DataGridView1.DataSource =
reservation.getAllReservations()
                    ' we need to refresh the combobox to show only the not
reserved rooms
                    ComboBoxType.DataSource = room.getAllRoomsType()

                Else

                    MessageBox.Show("Reservation NOT Added", "Add


Reservation", MessageBoxButtons.OK, MessageBoxIcon.Error)

                End If

            End If

            
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Add Reservation Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)

        End Try
        
    End Sub

- Edit The Selected Reservation Button

     Private Sub ButtonEdit_Click(sender As Object, e As EventArgs)


Handles ButtonEdit.Click

        Try

            Dim reservationId As Integer =


Convert.ToInt32(TextBoxReservationID.Text)
            Dim clientId As Integer =
Convert.ToInt32(TextBoxClientID.Text)
            Dim roomNumber As Integer =
Convert.ToInt32(DataGridView1.CurrentRow.Cells(2).Value.ToStrin
g())
            Dim dateIn As Date = DateTimePickerIN.Value
            Dim dateOut As Date = DateTimePickerOUT.Value

            If DateTime.Compare(dateIn.Date, DateTime.Now.Date) < 0


Then

                MessageBox.Show("The Date In Must be = Or > to Today


Date", "Invalid Date IN", MessageBoxButtons.OK,
MessageBoxIcon.Error)
            ElseIf DateTime.Compare(dateOut.Date, dateIn.Date) < 0
Then

                MessageBox.Show("The Date Out Must be = Or > to The


Date In", "Invalid Date OUT", MessageBoxButtons.OK,
MessageBoxIcon.Error)

            Else

                If reservation.editReservation(reservationId, roomNumber,
clientId, dateIn, dateOut) Then

                    MessageBox.Show("Reservation Updated Successfully",


"Edit Reservation", MessageBoxButtons.OK,
MessageBoxIcon.Information)
                    DataGridView1.DataSource =
reservation.getAllReservations()

                Else

                    MessageBox.Show("Reservation NOT Updated", "Edit


Reservation", MessageBoxButtons.OK, MessageBoxIcon.Error)

                End If

            End If

        Catch ex As Exception

            MessageBox.Show(ex.Message, "Edit Reservation Error",


MessageBoxButtons.OK, MessageBoxIcon.Error)

        End Try
        
    End Sub
- Remove The Selected Reservation Button

  Private Sub ButtonRemove_Click(sender As Object, e As


EventArgs) Handles ButtonRemove.Click

        Try

            Dim reservationId As Integer =


Convert.ToInt32(TextBoxReservationID.Text)
            Dim roomNumber As Integer =
Convert.ToInt32(DataGridView1.CurrentRow.Cells(2).Value.ToStrin
g())

            If reservation.removeReservation(reservationId,
roomNumber) Then

                MessageBox.Show("Reservation Deleted Successfully",


"Remove Reservation", MessageBoxButtons.OK,
MessageBoxIcon.Information)
                DataGridView1.DataSource =
reservation.getAllReservations()

            Else

                MessageBox.Show("Reservation NOT Deleted", "Remove


Reservation", MessageBoxButtons.OK, MessageBoxIcon.Error)

            End If

        Catch ex As Exception

            MessageBox.Show(ex.Message, "Remove Reservation Error",


MessageBoxButtons.OK, MessageBoxIcon.Error)

        End Try

    End Sub

Reference
http://www.w3schools.com/

http://www.roseindia.com/css/css3_button.asp
http://www.stackoverflow.com/tags/javascript/info
http://wikipedia.com/wiki/JSP
vb.net Models, Languages, Design and Application Programming,
Ramez Elmasri and Shamkant B.
Navathe, 7th Edition, 2017, Pearson.

You might also like