Skip to content

Alireza-Zwolf/Socket-Based-Hotel-Management-System

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hotel AliBaba Description

Hotel Management Service

This is a hotel reservation system implemented in C++. It consists of a server and multiple clients, which communicate with each other using sockets. The server handles requests from clients and manages the hotel reservation database. Clients can connect to the server and make various requests, such as reserving a room, checking availability, and canceling a reservation.

The server stores the reservation data in .json files, which can be loaded and saved as needed. The server also ensures that multiple clients can access the system concurrently without conflicts or data corruption. The clients interact with the system using a command-line interface (CLI), which allows them to enter commands and receive responses from the server. The commands are parsed and validated on the server side to ensure that they are properly formatted and authorized.

Project Structure

There are 5 main folders containing the source and info of this project:

  1. src folder: This folder contains the source code of the project.
  2. logs folder: This folder contains the logs of the main server and each client.
  3. configuration: This folder contains the needed config files.
  4. bin: This folder contains the object files (.o) produced after compiling src files.
  5. description: The Persian description of the project.

In the src folder, there are several class entities including:

  • HotelManagement: The main processing unit of the program, this class handles the given requests to the server, and gives responses to the clients.
  • User: This class contains the data of program users, including ordinary users and admin.
  • Room: This class contains room data.
  • Reservation: The entity of reservation made by users.
  • Date: Contain date data. We use Howard Hinnant date library to handel date operations.
  • Logger: This class saves the log of the program into .log files.
  • Parser: Used for parsing JSON and string data.

Server

The server IP and port can be modified from the config.json file. The server gets requests in JSON format, parses them and makes a response in JSON again, and sends it to the corresponding client.
Here is the roadmap of how to run and setup server:

  1. Run server executable:
./server.out
  1. Set the current date of the program:
>> <Date Time>

Screenshot from 2023-03-16 19-49-28

Client

Each client can connect to the main server whose config is found in the config.json file. The client gets requests in JSON format, parses them and makes a response in JSON again, and sends it to the main server.
the client file can be run via following command:

./client.out

The client program contains two main menu, the Login, and the Main menu.

Login Menu

There are 3 available command in this menu:

  • Sign up:
>> signup <username>
>> <password>
>> <purse>
>> <phone number>
>> <address>

Screenshot from 2023-03-16 20-01-45

  • Sign in:
>> signin <username> <password>

Screenshot from 2023-03-16 20-06-28

  • Exit:
>> exit

Screenshot from 2023-03-16 20-08-19

Main Menu

Here is the list of available commands:

Screenshot from 2023-03-16 23-14-50

  1. View user information:

    Screenshot from 2023-03-16 20-11-59

  2. View all users: This command is only available for admin users.

    Screenshot from 2023-03-16 20-14-00

  3. View rooms information:

    Screenshot from 2023-03-16 20-16-52

  4. Booking:

    book <RoomNum> <NumOfBeds> <CheckInDate> <CheckOutDate>

Screenshot from 2023-03-16 20-21-22

  1. Canceling:
    canceling <RoomNum> <Number of reservation(per person)>

Screenshot from 2023-03-16 20-30-52

  1. Pass Day:
    passDay <value>

Screenshot from 2023-03-16 20-32-57

  1. Edit Information:
    passDay <value>

Screenshot from 2023-03-16 20-44-15

  1. Leaving Room:
    room <room number>

If you are admin, this command forces people to leave rooms that they are in right now.

Screenshot from 2023-03-16 23-05-14

If you are a regular customer, you should use this command to leave early.

Screenshot from 2023-03-16 22-06-11

  1. Manage Rooms: There are 3 different managing options:
  • Add a room:
    add <room number> <max capacity> <price>

Screenshot from 2023-03-16 22-18-14

  • Modify a room:
    modify <room number> <new max capacity> <new price>

Screenshot from 2023-03-16 22-18-57

  • Delete a room:
    remove <room number>

Screenshot from 2023-03-16 22-19-13

  1. Log out:

Screenshot from 2023-03-16 22-12-21

How to Run

  1. navigate to project's root directory
  2. make client and server executables using:
make
  1. run server executable:
./server.out
  1. run clients executables:
./client.out

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 99.7%
  • Makefile 0.3%