Affichage des articles dont le libellé est Hotel Management System. Afficher tous les articles
Affichage des articles dont le libellé est Hotel Management System. Afficher tous les articles

Python Hotel System Source Code

Hotel Management System Source Code Using Python Tkinter And MySQL Database

Hotel Management System Source Code Using Python Tkinter And MySQL Database

This project uses Python, CustomTkinter/Tkinter, and a MySQL database to create a desktop-based hotel system that handles authentication, customer records, room management, and reservations in a clean, modern interface. 

The application starts from a simple main.py entry point, launches a login form, and then opens the full hotel dashboard after successful authentication.

Watch This Full Demo


1. Application startup and architecture

The application begins in main.py, where a LoginForm object is created and run. The login form is the gateway into the rest of the system. Once the user is authenticated, the login window hides itself and launches a combined application class that merges the dashboard shell with the customer, room, and reservation management modules. That means the final running app is one integrated interface built from multiple mixins instead of several unrelated programs.

Behind the scenes, the architecture is split into clear layers. The DatabaseManager handles connections and queries, the Customer, Room, and Reservation classes represent business entities, and the GUI modules focus on user interaction. This separation is important because it keeps UI logic, database logic, and business logic easier to maintain.

2. Login form

login form

The first form users see is the Login Form. It is built with CustomTkinter and designed as a modern card-style window centered on the screen. The form includes a branded header with the title HOTEL MANAGEMENT, a subtitle System Login, a username field, a password field, a SHOW/HIDE password toggle button, a LOGIN button, and a status label for feedback messages.

System Login

From a functionality point of view, the login form validates that both username and password are entered before attempting authentication. If one is missing, it shows an error message. If both are present, it displays a temporary “Logging in.” message, disables the login button, and verifies the credentials through the database manager. On success, it shows “Login successful!” and opens the main hotel system. On failure, it shows “Invalid username or password” and re-enables the button. The form also supports keyboard shortcuts: pressing Enter triggers login, while Ctrl+H toggles password visibility.

An interesting detail is that the file contains a commented-out info panel for default credentials. That means the developer considered exposing starter login information in the UI, but left it disabled in the current version.

3. Database connection and authentication

Database connection and authentication

As soon as the login form is initialized, it creates a DatabaseManager. This class connects to MySQL using the values from the configuration file. If the connection succeeds, it prints a success message and ensures the users table exists. If the table is empty, it automatically inserts a default admin user from configuration.

For security, passwords are not compared as plain text. The system hashes passwords using SHA-256, then checks the username and hashed password against the database. Query execution uses parameterized SQL, which is important for preventing SQL injection. The same manager class also provides helper methods to execute write queries and fetch records as dictionaries, making database interaction much easier throughout the project.

4. Main application shell

Main application shell

After login, the user enters the main application window. This is the core frame that holds the entire hotel system. It includes a top header area, a horizontal navigation bar, and a content area that switches between different pages. The header shows the app name, a subtitle listing the main modules, a signed-in user chip, and a Logout button. The navigation uses pill-style buttons for Dashboard, Customers, Rooms, and Reservations, with active-page highlighting for a more polished experience.

When switching sections, the application clears the old content frame and rebuilds the page for the selected module. This keeps navigation simple and makes the app feel like a single coherent desktop system rather than separate windows glued together.

5. Dashboard

Dashboard

The Dashboard is the first page shown after login. Its role is to provide a quick summary of hotel activity. It displays a title, a subtitle explaining that it offers an overview of rooms, customers, and reservations, and then shows statistics cards. These cards calculate and display values such as Total Rooms, Available Rooms, Occupied Rooms, Customers, and Active Reservations. The values are computed directly from the in-memory room, customer, and reservation objects loaded from the database.

The Dashboard Page

This is a useful design choice because it gives hotel staff an immediate snapshot of system status without requiring them to open each management module individually. Even though the dashboard is visually simple, it acts as the operational summary of the whole application.

6. Customer Management page

Customer Management page

The Customer Management module is responsible for maintaining guest records. According to the code, this page supports viewing customers in a table, searching through customer data, adding new customers, editing existing customers, and deleting records. It also preserves the current search text between page changes, which improves usability for staff who are repeatedly moving between modules.

Customer Management

The customer page contains a search area, a results count label, and a scrollable table. The table uses six columns: ID, Name, Email, Phone, Address, and Actions. Search works across all customer fields in a case-insensitive way, and the UI rebuilds the table only after the text actually changes, using a debounced update pattern to avoid refreshing on every keystroke. If no records match, the page shows a clear empty-state message: No customers found.

Add Customer form

Add Customer form
The Add Customer form is opened through a modal dialog. It reuses the same internal form logic as the edit screen, which is a smart way to reduce duplicated code. When adding a customer, the system validates that Customer ID and Customer Name are present, and it also checks that the entered customer ID does not already exist. If validation passes, the system inserts the new customer into MySQL, adds the customer to the in-memory dictionary, shows a success message, closes the dialog, and refreshes the customer page.

Edit Customer form

Edit Customer form

The Edit Customer form uses the same dialog layout, but it is pre-filled with the selected customer’s information. On submission, the code updates the customer’s name, email, phone, and address in the database, then updates the in-memory object to keep the UI synchronized. After that, it shows a success message and refreshes the table.

Delete Customer confirmation

Delete Customer confirmation

Deleting a customer is handled through a confirmation dialog titled Delete Customer. The dialog displays the selected customer’s name and ID before removal. This is a good usability feature because it reduces accidental deletions and makes the action explicit.

7. Room Management page

Room Management page

The Room Management page is one of the strongest modules in the project because it combines search, filters, status display, and CRUD operations in one screen. The code explicitly states that this page can display rooms in a searchable and filterable table, add new rooms, edit room details, delete selected rooms, toggle room availability status, filter by status and type, and search by room number, type, status, or price.

Room Management

The page layout is divided into three main cards: a header card, a filter card, and a table card. The header contains the page title plus action buttons. The filter area lets the user filter by All, Available, or Occupied, choose a room type, and use a search box. The table itself is scrollable and uses the columns Room Number, Type, Price, Status, and Actions. The status column is styled as a colored badge, making it easy to distinguish available rooms from occupied ones at a glance.

The search system is also well thought out. It is debounced, meaning the interface waits briefly before refreshing results while the user types. Filtering can be stacked, so a user can view only occupied suites, or all doubles matching a certain search term, for example. If the filter returns no results, the page shows an empty-state message instead of leaving the table blank.

Add Room form

Add Room form

The Add Room dialog includes fields for Room Number, Room Type, and Price. Validation ensures that the room number is present, unique, that a room type has been selected, and that the price is numeric and greater than zero. If everything is valid, the system inserts the new room into the database with a default status of Available, updates the in-memory room dictionary, shows a success message, and refreshes the room list.

Edit Room form

Edit Room form

The Edit Room dialog preloads the room’s current values. Unlike the add form, the room number field is disabled, meaning the room’s identifier cannot be changed after creation. The user can update the room type and price, which is a sensible restriction because room numbers often act as stable keys in hotel systems.

Delete Room confirmation

Delete Room confirmation

The Delete Room action opens a confirmation modal showing the room number and room type before deleting it. Once confirmed, the room is removed from MySQL, removed from the in-memory dictionary, the current selection is cleared, and the room list is refreshed.

8. Reservation Management page

Reservation Management page

The Reservation Management module handles booking logic, which is the most business-critical part of the application. The code lists its major features clearly: viewing reservations in a modern table, filtering by status, sorting by check-in or check-out date, creating new reservations with overlap prevention, cancelling active reservations, deleting cancelled reservations, and automatically updating room status for the current day only.

Reservation Management

When the page opens, it defaults to showing All reservations, sorted by Check In in ascending order. The page includes a header card titled Reservation Management, a subtitle explaining that users can create, review, cancel, or delete reservations, and a New Reservation button. Below that is a filter/sort area and then the reservation table.

The reservation table displays the reservation ID, customer name, room number, check-in date, check-out date, total amount, status, and actions. The status is rendered as a colored badge: active reservations appear in a success style, cancelled ones in a danger style, and other states use a neutral look. The actions column is also status-aware: Active reservations show a Cancel button, Cancelled reservations show a Delete button, and other statuses show a dash.

New Reservation form

New Reservation form

The New Reservation dialog asks for Reservation ID, Customer, Room, Check In Date, and Check Out Date. The save logic is careful and realistic. It validates that the reservation ID is present and unique, confirms that a customer and room have been selected, ensures the room exists, checks that both dates are provided in YYYY-MM-DD format, and requires the check-out date to be later than the check-in date. It then checks whether the selected room already has an overlapping active reservation. Only if all of those conditions pass will the reservation be created.

The overlap logic is especially important. The code compares date ranges and treats checkout day as non-overlapping, which is correct for hotel bookings because a room can usually be reused on the checkout date after the guest leaves. It only checks active reservations, so cancelled bookings do not block future reservations.

After validation, the system calculates total_amount as the number of nights multiplied by the selected room’s nightly price, inserts the reservation into the database with the status Active, stores it in memory, and updates the room status to Occupied only if the reservation actually includes the current date. That last part is a strong design choice because it separates future bookings from rooms that are physically occupied today.

Cancel Reservation confirmation

Cancelling a reservation opens a confirmation dialog. If confirmed, the database record is updated to Cancelled, the in-memory reservation object is updated too, and the system recalculates whether the room should still be marked Occupied today. If no other active reservation covers the current date, the room becomes Available; otherwise, it stays occupied. This prevents incorrect room status changes when multiple reservation situations exist.

Delete Reservation confirmation

Delete Reservation confirmation

Deleting a reservation is restricted to reservations already marked Cancelled. If the user tries to delete any other status, the system shows an error. For cancelled reservations, it opens a confirmation dialog showing the reservation ID and customer name, warns that the action cannot be undone, then removes the record from both the database and memory before refreshing the page.

9. Data models

Data models

The project also uses simple but effective data model classes for Customer, Room, and Reservation. These classes act as in-memory representations of database rows and also provide small helper methods. For example, Room exposes availability helpers, while Reservation provides methods like is_active(), cancel(), and complete(). These model classes make the rest of the application easier to read because the GUI code works with meaningful objects instead of raw tuples or dictionaries everywhere.

10. Database schema

Database schema

The MySQL schema supports the application cleanly. The customers table stores guest identity and contact fields, the rooms table stores room number, room type, price, and current status, and the reservations table links customers to rooms with dates, amount, and status. Foreign key constraints connect reservations to both customers and rooms, which helps preserve referential integrity. The SQL dump also includes sample records, showing how the application can be preloaded with demo hotel data.

Get the Full Project Source Code

If you enjoyed this project and would like to get the full source code, you can support us by purchasing it for just $5. Your support truly means a lot to us and helps us continue creating more useful, creative, and inspiring projects like this one. Every small contribution helps us keep building, improving, and sharing more with you. 







VB.Net Hotel Management System Source Code

Hotel Management System In Visual Basic.Net And MySQL Database With Source Code

VB.Net Hotel Management System Project


in this visual basic .net project tutorial we will see how to create a simple desktop application with winforms to manage hotel reservations using vb.net programming language and mysql database.


goals of this project:
- give students / curious persons an example so they can learn from.
give beginners a step by step project so they can create their own. 
- help people to learn vb.net by making projects.
sharing knowledge with others.


tools:
- visual basic .net programming language.
- visual studio express 2013.
- mysql database.
- xampp server.
- phpmyadmin.



Watch The Full Project Tutorial




if you want the source code click on the download button below





in this project we will create 4 classes and 4 forms:
- classes: 
* CONNECTION > create the connection with mysql database.
* ClIENT > where we will add functions for the client.
* ROOMS > where we will add functions for the room. 
* RESERVATIONS > where we will add functions for the reservation.  

- forms: 
* Login > where the user can enter his username to login.
* Manage Clients > where we will manage the hotel client informations.
* Manage Rooms > where we will mange the hotel's rooms. 
* Manage Reservations > where we will add functions for the reservation.  

> and you need to download mysql connector from here -> https://dev.mysql.com/downloads/connector/net/8.0.html


1 - The Login Form 

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



vb.net hotel management system - login form



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


vb.net hotel management system - main form menu

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


vb.net hotel management system - manage clients form


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.


vb.net hotel management system - 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

vb.net hotel management system - manage rooms form

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.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.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.ToString())

            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



vb.net hotel management system - manage reservations form