Airline Reservation System

The Airline Reservation System is a self-project developed out of curiosity to learn and experience the realms of C# language and Server Side Systems using WPF Application. The project was initially started on an online repository of Replit so as the name.

Operations

  • Session-based login and Out Every session will be recorded in the database with a start and end date-time stamps of the system along with the then-current user's or admin's details.
  • Flights and Bookings Count Top of the screen, along with the header, will display the counts of existing flights and bookings in the system.
  • Existing Flights Display When a user or admin session is started, all the existing flights in the system with their details and available seats will be displayed to the user in a list.
  • Welcome Message A welcome message will be displayed at the top along with the user's name after a successful login.
  • User SignUp Allows a new user to create a profile, generates a user id then only the user can login and start a session.
    • User's Operations

      • New Booking Generation Users will be provided a designated form on the screen whereby, providing the required details, a new booking will be generated on behalf of the user and tagged with his ID. After a booking is successfully made, the booking id will be shared with the user, and the flights list will be updated with the updated list of available seats.
      • Users' Past Bookings A designated area will display a list of all the past bookings made by the user.
      • Booking Deletion A designated area on the screen will have a small form for the user if they want to delete any of their own existing bookings in the system.
    • Admin's Operations

      • New Admin SignUp Only an existing admin can sign up for a new admin. After a successful admin login, a button will be provided on the admin's screen to redirect them toward the admin signup form, whereby after providing all the required details, a new admin profile will be created in the system, and its associated admin ID will be shared. Existing logged-in admins can sign up for multiple admins in a single session.
      • New Flight Creation Admins will be provided with a designated form on the screen whereby, providing the required details, a new flight entity will be created and tagged with his ID. After a flight is successfully created, the flight code will be shared with the admin, and the flights list will be updated along with the new flight details.
      • Admin's Past Flights A designated area will display a list of all the past flights created by the admin.
      • Flight Deletion A designated area on the screen will have a small form for the admin if they want to delete any of their own existing flights in the system. It will also delete all the bookings associated with the deleted flight.

Project Structure

Users Class

Provides structure to a user and admin entity in the system.

  • Data Attributes

    • userId A random and unique user ID generated by the system every time a new user signs up.
    • fullname Name of the user as entered by the user.
    • password Password for the user's profile as entered by the user.
    • signUpTimeStamp The date & time stamp of the system when the user profile was created.
    • usedUserIDs A HashMap data structure collection used to keep track of all the existing UserIds in the system to avoid ambiguity by regenerating an identical one.
  • Methods

    • newUser(adFlag, username, password) This method is called every time a new user chooses to sign up. Accesses all the existing entries in the database to avoid any ambiguity with any previous entity by generating an identical id for a new one.

Booking Class

Provides structure to a Booking entity in the system.

  • Data Attributes

    • BookingID A random and unique booking ID is generated by the system every time a new booking is made.
    • FlightCode The flight code for which the booking was made.
    • Name The name of the person for whom the booking is made.
    • SeatNo The specific seat number the user booked for the flight.
    • UserID The userid of the user who made the booking.
    • BCreationTimeStamp The date & time stamp of the system when the booking was made.
    • usedBookingIDs A HashMap data structure collection used to keep track of all the existing BookingIds in the system to avoid ambiguity by regenerating an identical one.
  • Methods

    • newBooking(flightcode, seatno) This method is called every time the user chooses to generate a new booking. Accesses all the existing entries in the database to avoid any ambiguity with any previous entity by generating an identical id for a new one.
    • displayBooking() This method is called every time the user chooses to view details of a specific or all the bookings in the system.

Flight Class

Provides structure to a flight entity in the system.

  • Data Attributes

    • FlightCode The system generates a random and unique flight code every time a new flight entity is made.
    • Flight Destination The destination to which the flight is bound.
    • Available Seats[char] A collection of 10 seats predefined as (A)vailable. Whenever a seat is booked, it will be marked as (R)eserved. The system will only display the list of seats marked as (A)available for users to choose from.
    • adminID id of the administrator who created the flight entity in the system.
    • FcreationTimeStamp The then date & time stamp of the system when the flight was created.
    • usedFlightCodes A HashMap data structure collection used to keep track of all the existing flight codes in the system to avoid ambiguity by regenerating an identical one.
  • Methods

    • List<int> availableSeats() This method will filter out a list of seats marked as (A)available.
    • newFlight() This method is called every time the user chooses to generate a new flight entity. Accesses all the existing entries in the database to avoid any ambiguity with any previous entity by generating an identical code for a new one.
    • displayFlight() This method is called in every iteration of the user session to display available flight details. It is also called whenever a user chooses to view details of a specific flight.

Airline Class

Provides structure to an entity in the system to hold all session-based data and functions encapsulated within an Airline class entity.

  • Data Attributes

    • FlightsList A collection of flights currently available in the system.

    • BookingsList A collection of bookings currently available in the system.

    • The above collections are used for local processing and viewing of data and are updated in every iteration of a session.

    • DBops An object to class DatabaseOperations to access the database CRUD and traversing operations.

  • Methods

    • int flightsCount() This method returns the count of flight entities available in the system.
    • int bookingsCount() This method returns the count of all booking entities available in the system.
    • updateFlights() This method accesses the readDatabaseFT() operation of the DatabaseOperations class to clear the local system collection of flights and update it with fresh data from the database.
    • updateBookings() This method accesses the readDatabaseBK() operation of the DatabaseOperations class to clear the local system collection of bookings and update it with fresh data from the database.
    • char seatAvailability(flightcode, seatno) This method is called every time a new booking is made. It checks the availability of the seat number for the user-specified flight code. After seat availability is ensured, it accesses the createNewBooking(newBooking) operation in DatabaseOperations to handle the database updation.
    • addNewUser() This is the first point of interaction for new users whenever they want to create a new user profile. A new user class entity will be made from here, asking users to enter the required details.
    • addNewBooking() This is the first point of interaction for the users whenever they want to create a new booking. From here, a new Booking class entity will be made, asking users to enter the required details, flight code and seat availability will be ensured, and then the database updation will be called.
    • addNewFlight() This is the first point of interaction for the users whenever they want to create a new flight entity. A new flight class entity will be made from here, asking users to enter the required details. Then, the database update will be called.
    • displayAllBookings() This method is called whenever the user chooses to view all the bookings available in the system.
    • displayAllFlights() This method displays all the flight entities available in the system with their respective details.
    • deleteBooking(bookingID) This method searches for a specific booking and deletes its data from the whole system.
    • deleteFlight(flightcode) This method searches for a specific flight and deletes its data from the whole system. It also updates bookings according to available flights in the system.

GlobalSessionClass Class

Provides structure to a session log entity in the system to hold details of the current user and date and time stamps for log in and out.

  • Data Attributes

    • LogID The system generates a random and unique flight code every time a new session is generated.
    • LogInTimeStamp Date & time stamp of the system when the session started, i.e., the user logged into the system.
    • LogOutTimeStamp Date & time stamp of the system when the session ended, i.e., the user logged out of the system.
    • currentUserID User or Admin ID of the current user who logged into the system.
    • currentUserName The Name of the current user who logged into the system.
  • Methods

    • GlobalSessionClass() This method is called every time a user logs in and starts a session. Accesses all the existing entries in the database to avoid any ambiguity with any previous entity by generating an identical code for a new one.

DatabaseOperations Class

Provides structure to an entity in the system to hold all the database-related operations encapsulated within a DatabaseOperations class entity.

  • Data Attributes

    • connectionString MySQL connection string
    • FTList A Flight type list collection to handle flights data for database management operations.
    • BKList A Booking type list collection to handle bookings data for database management operations.
  • Methods

    • readDatabaseFT() This method reads the updated flights' data from the database and updates the system's local collection.
    • readDatabaseBK() This method reads the updated bookings' data from the database and updates the system's local collection.
    • createNewBooking(newBooking) This method adds a new booking entry to the database.
    • createNewFlight(newFlight) This method adds a new flight entry to the database.
    • SeatsDatabaseUpdation(seatsUpdated[], flightcode) This method updates the seats' status in the database after every update in the collection of the seats for respective flight.
    • deleteFlight(flightcode) This method deletes an entry of a specific flight in the database.
    • deleteBooking(bookingID) This method deletes an entry of a specific booking in the database.
    • deleteFT_Bookings(flightcode) This method deletes bookings related to the respective deleted flight.

DBconsts

Provides structure to an entity in the system to hold all the database-related constants and MySQL queries encapsulated within a DBconsts class entity.

  • Data Attributes

    • Server Holds the server
    • Database Holds the database name
    • Uid Holds the username or user id for the database.
    • Pwd Holds user-specific password for the database.
    • tableF Holds the table name for the flights table.
    • tableB Holds the table name for the bookings table.
    • tableL Holds the table name for the Logs table.
    • tableU Holds the table name for the Users table.
    • tableA Holds the table name for the admins table.
    • uIdPattern Holds the Regex pattern for validating the user's id while logging into the system.
    • adIdPattern Holds the Regex pattern for validating the admin's id while logging into the system.
    • uPassPattern Holds the Regex pattern for validating password for user and admin while logging into the system.
    • destinationPattern Holds the Regex pattern for validating destination input while creating a new flight entity.
    • flightCodePattern Holds the Regex pattern for validating flight code input while creating a new booking or deleting an existing flight.
    • bookingIdPattern Holds the Regex pattern for validating booking id input while deleting an existing booking entity.
  • Methods

    • generateAdminID(name) Generates an Admin id according to the set pattern for a new admin entity.
    • returnConectionString() Returns MySQL connection string for database connectivity.
    • returnAdIdPattern() Returns adIdPattern string required for validating admin login input credentials.
    • returnUIdPattern() Returns UIdPattern string required for validating user login input credentials.
    • returnUPassPattern() Returns uPassPattern string required for validating user or admin login input credentials.
    • returnDestPattern() Returns destinationPattern string required for validating destination input while creating a new flight entity.
    • returnFlightCodePattern() Returns flightCodePattern string required for validating flight code input for flight deletion or new booking.
    • returnBookingIdPattern() Returns BookingIDPattern string required for validating booking id input for deleting an existing booking.
    • readLoginQuery(user id, password) Generates and returns SQL query to read user data from users table while an existing user tries to log in.
    • readAdLoginQuery(userid, password) Generates and returns SQL query to read admin data from the admins table while an existing admin tries to log in.
    • readFlightsQuery() Generates and returns SQL query to read data from flights table.
    • readBookingsQuery() Generates and returns SQL query to read data from bookings table.
    • readLogIdsQuery() Generates and returns SQL query to read existing Log Ids from logs table.
    • readBookingIdsQuery() Generates and returns SQL query to read existing Booking Ids from bookings table.
    • readflightCodesQuery() Generates and returns SQL query to read existing flight codes from flights table.
    • readAdminIdsQuery() Generates and returns SQL query to read existing admin ids from admins table.
    • readuserIdsQuery() Generates and returns SQL query to read existing user IDs from the users table.
    • createNewLogQuery() Generates and returns SQL query to create a new entry for Log entity.
    • createNewUserQuery() Generates and returns SQL query to create a new entry for user entity.
    • createNewAdUserQuery() Generates and returns SQL query to create a new entry for admin entity.
    • createNewFlightQuery(newFlight) Generates and returns SQL query to create a new entry for flight entity.
    • createNewBookingQuery(newBooking) Generates and returns SQL query to create a new entry for booking entity.
    • seatsDatabaseUpdateQuery(seatsUpdated[], flightcode) Generates and returns SQL query to update flight seats.
    • deleteBookingQuery(bookingID) Generates and returns SQL query to delete an entry from bookings table.
    • deleteFlightQuery(flightcode) Generates and returns SQL query to delete an entry from flights table.
    • deleteFT_BookingsQuery(flightcode) Generates and returns SQL query to delete bookings related to a deleted flight.