Component Design
Hotel Reservation System (HRS)
                                      Version 1.0
Submitted in partial fulfillment of the requirements for the degree of Master of Software
                                        Engineering
                                    Cem Oguzhan
                                CIS 895 – MSE Project
                                Kansas State University
1. Introduction
The purpose of this document provides brief description and class diagrams of the
application and classes for the Hotel Reservation System (HRS). A detail description of
the methods and attributes is provided in the MSDN style documentation.
2. Hotel Reservation System
The Hotel Reservation System will provide service to on-line customers, travel agents,
and an administrator. On-line customers and travel agents can make searches,
reservations and cancel an existing reservation on the hotel reservation’s web
site. Administrator can add/update the hotel and the room information
approve/disapprove a new travel agent’s account application and generate a monthly
occupancy rate report for each hotel.
   2.1.    Class Description and Diagrams
   The class diagram below captures middle-tier, business specific layer, of the Hotel
   Reservation System. Business specific layer of the Hotel Reservation System consist
   of eleven classes, User, Customer, Travel Agent, Guest, Administrator, Mail,
   Database, Hotel, Room, Reservation and Error.
                                User
                       userName : String                                                                                                                Administrator
                       email : String                                                                                                                 userName : String
                       password : String                                                                                                              password : String
                       phone : String                                                                                                                                                                        Hotel
                       address : String                                                                                                   1
                                                                                                                                                      verifyLogin()                                      hotelID : String
                       city : String                                                                                    +approveAccount
                                                                                                                                                      getWaitingAgent() +theAdmin                        name : String
                       state : String                                                                                                         1       approveAccount()                                   address : String
                       zip : String                                                                                                                   disApproveAccount() 1                              city : String
                                                                                   Mail                          0..*                                 occupancyReport()                +theHotel         state : String
                       verifyLogin()                                                                                                                                                                     zip : String
                       isValidUserName()                                                                                                                                                      0..*       phone : String
                                                               sendMail(e_address : String) : Boolean
                       getUser()                                                                                                                                                                         rating : Integer
                                                               approveAccount(e-address : String) : Boolean
                                1 +theUser                     disApproveAccount(e_address : String) : Boolean
                                                                                                                                                                                        +theHotel        findHotel()
                                                                                                                                                                                                         getHotel()
                                                                                 0..*                                                                                                            1       newHotel()
                                                                                                                                                                                                         updateHotel()
                                                                                                                                                                                                         numberOfRoom()
                                                                                                                                                                                                         occupancyRate()
                                                       0..*                                                                                                                                              isValidHotelID()
           Customer
                                                       +requestAccount                                                                                                                                             1+theHotel
     firstName : String
     lastName : String                           TravelAgent
     cardType : String                       companyName : String
     cardNumber : long                                                                                                                                                                               +theRoom 1..*
                                             status : String             1
     experationDate : String                                                                                                                                                                                Room
                                             requestAccount()                                                                                                                                        roomNumber : Integer
     createAccount()                         totalSales()                                                           +theReservation                                                                  price : Double
                                                                                                  Reservation
     updateAccount()                         salesCommission()                                                                                                                                       bedType : String
                                                                                            reservationNumber : Integer                                                                              smoking : String
                                                                                            checkIn : Date                        0..*
                                                                                                                                                                                                     handicab_access : String
                                                                                            checkOut : Date                                                                                          roomLock : Date
                                                                                            resvDate : Date
                                                                                            price : Double                                                                      +allocation          getRoomAvl()
            Guest                                                        +theReservation    totalCost : Double            +theReservation
                                                                                                                                                                                                     getRoomAvl()
     reservationNumber : long                                                                                              0..*                                                           1          getRoomAvl()
                                                                                 0..*
                                                                                            makeReservation()                                             Database                                   getRoomAvlPrice()
     getGuest()                                                                             agentMakeReservation()                                                                                   getRoomAvlPrice()
     reservationNumber()                                                                    getReservation()                                      conString()                                        getRoom()
     deleteGuest()                                                                          cancelReservation()                                   queryLogin()                                       getRoom()
                                                                                            calculateTotal()                                      queryIsValidUserName()                             getAllRoom()
                                                                                            calculateTax()                                        queryIsValidAgentUserName()                        newRoom()
                                                                                                                                                  queyGetUserInfo()                                  updateRoom()
                                                                                                                                                  queryGetGuestInfo()                                isValidDoorNumber()
                                                                                                                                                  querySaveNewCustomer()
                                                                                                                                                  queyUpdateCustomerAccount()
                                                                                                                                                  querySaveNewReservation()
                                                                                                                                                  querySaveAgentReservation()
                                                                                                                                                  querySaveGuestInfo()
                                                                                                                                                  queryLoginAdmin()
                                                                                                                                                  queryNumOfReserv()
                                                                                                                                                  queryFindHotel()
                                                                                                                                                  queryGetHotel()
                                                                                                                                                  queryIsValidHID()
                                                                                                                                                  querySaveNewHotel()
                                                                                Error                                                             queryUpdateHotel()
                                                                 EVENT_LOG_SOURCE : String = "HRS"                                                queryNumberOfRoom()
                                                                                                                                                  queryIsValidDoorNumber()
                                                                 Log()                                                                            queryGetAllRoom()
                                                                                                                                                  getRoomAvl()
                                                                                                                                                  getRoomAvl()
                                                                                                                                                  getRoomAvl()
                                                                                                                                                  queryRoomAvlPrice()
                                                                                                                                                  queryRoomAvlPrice()
                                                                                                                                                  queryGetRoom()
                                                                                                                                                  querySaveNewRoom()
                                                                                                                                                  queryCreateRoomID()
                                                                                                                                                  queryUpdateRooml()
                                                                                                                                                  queryGetReservation()
                                                                                                                                                  queryCancelReservation()
                                                                                                                                                  queryDeleteGuest()
                                                                                                                                                  queryGetWaitingAgent()
                                                                                                                                                  queryApproveAccount()
                                                                                                                                                  queryDisApproveAccount()
                                                                                                                                                  queryTotalSales()
                                                                                                                                                  queryRequestAccount()
2.1.1. User
This class will handle user actions. User class is the super class of Customer and
Travel Agent.
Attributes and methods:
    m_userName : User’s user name
    m_email : User’s e-mail address
    m_password : User’s password
    m_phone : User’s phone number
    m_address : User’s address
    m_city : City of the address
    m_state : State of the address
    m_zip : Zip code of the address
    User() : Constructor
    VerifyLogin() : It is responsible to authenticate and authorize the user to use
        secure sites
    idValidUserName() : Checks the user name is unique or not when user creates
        an account
    getUser() : Gets user information
      The other methods are getters and setters for these variables
                                 Components::User
                    -m_userName : string
                    -m_email : string
                    -m_password : string
                    -m_phone : string
                    -m_address : string
                    -m_city : string
                    -m_state : string
                    -m_zip : string
                    +User()
                    +VerifyLogin(in user : User) : bool
                    +isValidUserName(in userName : string) : bool
                    +getUser(in user : User)
                    +userName() : string
                    +email() : string
                    +password() : string
                    +address() : string
                    +city() : string
                    +state() : string
                    +zip() : string
                    +phone() : string
2.1.2. Customer
This class will handle customer actions. It inherits User class responsibilities.
Attributes and methods:
    m_firstName : Customer’s first name
    m_lastName : Customer’s last name
    m_cardType : Customer’s credit card type
    m_cardNumber : Customer’s credit card number
    m_experationDate: Customer’s credit cards’ expiration date
    Customer() : Constructor
    createAccount() : It creates a customer account that the customer can be a
        member of the HRS
    updateAccount() : It updates the customer account properties
    The other methods are getters and setters for these variables
                                                                                                                               Components::Customer
-m_firstName : string
-m_lastName : string
-m_cardType : string
-m_cardNumber : long
-m_experationDate : string
+Customer()
+createAccount(in userName : string, in email : string, in password : string, in firstName : string, in lastName : string, in cardType : string, in cardNumber : long, in experation : string, in phone : string, in address : string, in city : string, in state : string, in zip : int) : bool
+updateAccount(in userName : string, in firstName : string, in lastName : string, in cardType : string, in cardNumber : long, in experationDate : string, in phone : string, in address : string, in city : string, in state : string, in zip : string) : bool
+firstName() : string
+lastName() : string
+cardType() : string
+cardNumber() : long
+experationDate() : string
           2.1.3. Travel Agent
           This class will handle travel agent actions. It inherits User class responsibilities.
           Attributes and methods:
                    m_companyName : Company name of travel agent
                    m_status : Travel agent’s account status (approved, disapproved, or
                      waiting)
                    TravelAgent() : Constructor
                    requestAccount() : It handles travel agent’s account request
                    totalSales() : It calculates total sales of travel agent
                    salesCommussion() : It calculates sales commission of travel agent
                    The other methods are getters and setters for these variables
                                                                                                                                    Components::TravelAgent
            -m_companyName : string
            -m_status : string
            +TravelAgent()
            +requestAccount(in userName : string, in email : string, in password : string, in companyName : string, in phone : string, in address : string, in city : string, in state : string, in zip : string) : bool
            +totalSales(in userName : string, in startingDate : string, in endingDate : string) : string
            +salesCommussion(in totalSales : double) : double
            +companyName() : string
            +status() : string
           2.1.4. Guest
           This class will handle guest information, when a travel agent makes a reservation.
           It inherits from Customer.
           Attributes and methods:
                 m_reservationNumber : Guest’s reservation confirmation number
                 Guest() : Constructor
                 reservationNumber() : It returns Guest’s reservation number
                 deleteGuest() : When the travel agent cancel the reservation, this method
                   deletes Guest information of the reservation
                                          Components::Guest
                      -m_reservationNumber : long
                      +Guest()
                      +getGuest(in guest : Guest)
                      +reservationNumber() : long
                      +deleteGuest(in reservationNumber : int) : bool
2.1.5. Administrator
This class will handle administrator actions.
Attributes and methods:
    m_userName : User name of Administrator
    m_password : Password of Administrator
    Administrator() : Constructor
    VerifyLogin() : Responsible to authenticate administrator
    getWaitingAgent() : Gets waiting travel agent’s account request
    approveAccount() : Approves travel agent’s account request.
    disApproveAccount() : Disapprove travel agent’s account request
    occupancyReport() : Calculates occupancy rate for a hotel
    The other methods are getters and setters for these variables
                                    Components::Administrator
   -m_userName : string
   -m_password : string
   +Administrator()
   +VerifyLogin(in userName : string, in password : string) : bool
   +getWaitingAgent() : DataSetTravelAgent
   +approveAccount(in userName : string) : bool
   +disApproveAccount(in userName : string) : bool
   +occupancyReport(in hotelID : string, in startingDate : string, in endingDate : string) : string
   +userName() : string
   +password() : string
2.1.6. Mail
This class represents mail. It uses a virtual SMTP server. The Travel Agent and the
Administrator class use the Mail class to send an e-mail.
Attributes and methods:
    Mail() : Constructor
    sendMail() : It sends an e-mail that Travel Agent’s account request is received
    approveAccount() : it sends an e-mail that Travel Agent’s account request is
        approved
    disApproveAccount() : It sends an e-mail that Travel Agent’s account request
        is disapproved
                                      Components::Mail
                       +Mail()
                       +sendMail(in e_address : string) : bool
                       +approveAccount(in e_address : string) : bool
                       +disApproveAccount(in e_address : string) : bool
2.1.7. Error
Error class is responsible to write full stack trace to the Application Event Log, when
an error occurs.
Attributes and methods:
     EVENT_LOG_SOURCE: Source of error. (HRS)
     Log() : Writes full stack trace to the Application Event Log
                                            Error
                          -EVENT_LOG_SOURCE : string = "HRS"
                          +Log(in message : string)
2.1.8. Database
All connection to the HRS’ database is provided by Database class. It will allow running
queries against the HRS’ database. 
                                                                                                                                       Components::Database
+Database()
-conString() : string
+queryLogin(in user : User) : string
+queryIsValidUserName(in userName : string) : string
+queryIsValidAgentUserName(in userName : string) : string
+queryGetUserInfo(in user : User)
+queryGetGuestInfo(in guest : Guest)
+querySaveNewCustomer(in userName : string, in email : string, in password : string, in firstName : string, in lastName : string, in cardType : string, in cardNumber : long, in experation : string, in phone : string, in address : string, in city : string, in state : string, in zip : int) : bool
+queryUpdateCustomerAccount(in userName : string, in firstName : string, in lastName : string, in cardType : string, in cardNumber : long, in experationDate : string, in phone : string, in address : string, in city : string, in state : string, in zip : string) : bool
+querySaveNewReservation(in r : Reservation) : bool
+querySaveAgentReservation(in r : Reservation) : bool
+querySaveGuestInfo(in r : Reservation, in guest : Customer) : bool
+queryLoginAdmin(in userName : string, in password : string) : string
+queryNumOfRsrv(in hotelID : string, in startingDate : string, in endingDate : string) : int
+queryFindHotel(in city : string, in state : string) : dsHotelResult
+queryGetHotel(in hotelID : string) : dsHotelResult
+queryIsValidHID(in hotelID : string) : string
+querySaveNewHotel(in hotelID : string, in name : string, in address : string, in city : string, in state : string, in zip : string, in phone : string, in rating : int) : bool
+queryUpdateHotel(in hotelID : string, in name : string, in address : string, in city : string, in state : string, in zip : string, in phone : string, in rating : int) : bool
+queryNumberOfRoom(in hotelID : string) : string
+queryIsValidDoorNumber(in doorNumber : string, in hotelID : string) : string
+queryGetAllRoom(in hotelID : string) : DataSetRoom
+getRoomAvl(in hotelID : string, in bed : string, in smoking : string, in accessible : string, in checkIn : string, in checkOut : string) : DataSetAvlRoom
+getRoomAvl(in hotelID : string, in bed : string, in smoking : string, in accessible : string, in checkIn : string, in checkOut : string, in price : double) : DataSetAvlRoom
+getRoomAvl(in hotelID : string, in bed : string, in smoking : string, in accessible : string, in checkIn : string, in checkOut : string, in price : double, in ds : DataSetAvlRoom) : DataSetAvlRoom
+queryRoomAvlPrice(in hotelID : string, in price : string, in checkIn : string, in checkOut : string) : DataSetAvlRoom
+queryRoomAvlPrice(in hotelID : string, in bed : string, in smoking : string, in accessible : string, in checkIn : string, in checkOut : string, in price : double) : DataSetAvlRoom
+queryGetRoom(in roomNumber : string) : DataSetAvlRoom
+queryGetRoom(in roomNumber : string, in ds : DataSetAvlRoom) : DataSetAvlRoom
+querySaveNewRoom(in doorNumber : string, in price : double, in bedType : string, in smoking : string, in accessible : string, in hotelID : string) : bool
-queryCreateRoomID(in hotelID : string) : string
+queryUpdateRoom(in roomNumber : int, in price : double, in bedType : string, in smoking : string, in handicap_access : string) : bool
+queryGetReservation(in rsrvNumber : int) : DataSetReservation
+queryCancelReservation(in rsrvNumber : int) : bool
+queryDeleteGuest(in rsrvNumber : int) : bool
+queryGetWaitingAgent() : DataSetTravelAgent
+queryApproveAccount(in userName : string) : bool
+queryDisApproveAccount(in userName : string) : bool
+queryTotalSales(in userName : string, in startingDate : string, in endingDate : string) : string
+queryRequestAccount(in userName : string, in email : string, in password : string, in companyName : string, in phone : string, in address : string, in city : string, in state : string, in zip : string) : bool
2.1.9. Hotel
This class represents Hotel.
Attributes and methods:
    m_hotelID : Hotel’s hotel id
    m_name : Hotel’s name
    m_street : Hotel’s address
    m_city : City name of Hotel’s address
    m_state : State name of Hotel’s address
    m_zip : Zip code of Hotel’s address
    m_phone : Hotel’s phone number
    m_rating : Hotel’s star rating
    Hotel() : Constructor method of Hotel class
    isValidHotelID() : When the admin adds a new hotel into the database, this
        method checks that the hotel id is entered is unique or not
    findHotel() : Finds hotel in particular city and state
    getHotel() : Gets hotel information
    newHotel() : Adds a new hotel into the database
    updateHotel() : Updates hotel properties in the databes
    numberofRoom() : Gets total number of room of the Hotel
    occupancyRate() : Calculates occupancy rate of the Hotel
    The other methods are getters and setters for these variables
                                                                                 Hotel
-m_hotelID : string
-m_name : string
-m_street : string
-m_city : string
-m_state : string
-m_zip : string
-m_phone : string
-m_rating : int
+Hotel()
+isValidHID(in hotelID : string) : bool
+findHotel(in city : string, in state : string) : dsHotelResult
+getHotel(in hotelID : string) : bool
+newHotel(in hotelID : string, in name : string, in address : string, in city : string, in state : string, in zip : string, in phone : string, in rating : int) : bool
+updateHotel(in hotelID : string, in name : string, in address : string, in city : string, in state : string, in zip : string, in phone : string, in rating : int) : bool
+numberOfRoom(in hotelID : string) : int
+occupancyRate(in hotelID : string, in startingDate : string, in endingDate : string) : double
+hotelID() : string
+name() : string
+street() : string
+city() : string
+state() : string
+zip() : string
+phone() : string
+rating() : int
2.1.10.             Room
This class represents Room.
Attributes and methods:
    m_roomNunber : Room number is a primary key that uniquely identify each
        room
               m_price : Room’s price
               m_bedType : Bed type of Room (Double, King)
               m_smoking : Smoking type of Room
               m_handicap_access : Accessible type of Room
               m_roomLock : It is a time stamp that when was the last time is check out as
                an available room
               Room() : Constructor method
               isValidDoorNumber() : Checks the door number is unique or not entered by
                administrator when the admin adds a new room
               getRoomAvl() : It has three overload methods. This method gets available
                rooms
               getRoomAvlPrice() : It has two overload methods. This method gets available
                rooms by price
               getRoom() : It has two overload methods. This method gets room by room
                number
               getAllRoom() : Gets all rooms at the Hotel for editing
               newRoom() : Adds a new room into the database
               updateRoom() : Updates an existing room properties
               The other methods are getters and setters for these variables
                                                                                                  Room
-m_roomNumber : int
-m_price : double
-m_bedType : string
-m_smoking : string
-m_handicap_access : string
-m_roomLock : string
+Room()
+isValidDoorNumber(in doorNumber : string, in hotelID : string) : bool
+getRoomAvl(in hotelID : string, in bed : string, in smoking : string, in handicap_access : string, in checkIn : string, in checkOut : string) : DataSetAvlRoom
+getRoomAvl(in hotelID : string, in bed : string, in smoking : string, in handicap_access : string, in checkIn : string, in checkOut : string, in price : double) : DataSetAvlRoom
+getRoomAvl(in hotelID : string, in bed : string, in smoking : string, in handicap_access : string, in checkIn : string, in checkOut : string, in price : double, in ds : DataSetAvlRoom) : DataSetAvlRoom
+getRoomAvlPrice(in hotelID : string, in price : string, in checkIn : string, in checkOut : string) : DataSetAvlRoom
+getRoomAvlPrice(in hotelID : string, in bed : string, in smoking : string, in handicap_access : string, in checkIn : string, in checkOut : string, in price : double) : DataSetAvlRoom
+getRoom(in roomNumber : string) : DataSetAvlRoom
+getRoom(in roomNumber : string, in ds : DataSetAvlRoom) : DataSetAvlRoom
+getAllRoom(in hotelID : string) : DataSetRoom
+newRoom(in hotelID : string, in doorNumber : string, in price : double, in bedType : string, in smoking : string, in handicap_access : string) : bool
+updateRoom(in roomNumber : int, in price : double, in bedType : string, in smoking : string, in handicap_access : string) : bool
+roomNumber() : int
+price() : double
+bedType() : string
+smoking() : string
+handicap_access() : string
+roomLock() : string
2.1.11. Reservation
This class is responsible for reservations.
Attributes and methods:
     m_reservationNumber : Confirmation number for reservation
     m_chekIn : Reservation’s check in date
     m_checkOut : Reservation’s check out date
     m_resvDate : The date of the reservation is made
     m_price : Price of the room each day
     m_totalCost : Total cost of the reservation
     m_roomNumber : Reservation’s room number
     m_userName : User name of the user, who makes the reservation
     m_hotelID : Hotel’s hotel id of the reservation
     Reservation() : Constructor method
   makeReservation() : This method is called a make reservation on Customer
    site of the HRS
   agentMakeReservation() : This method is called a make reservation on Travel
    Agent site of the HRS
   getReservation() : Gets reservation by reservation number
   cancelReservation() : Cancels valid reservation
   calculateTotal() : Calculates total cost of the reservation before tax
   calculateTax() : Calculates tax cost of the reservation
   The other methods are getters and setters for these variables
                                     Reservation
         -m_reservationNumber : int
         -m_checkIn : string
         -m_checkOut : string
         -m_resvDate : string
         -m_price : double
         -m_totalCost : double
         -m_roomNumber : int
         -m_userName : string
         -m_hotelID : string
         +Reservation()
         +makeReservation(in r : Reservation) : bool
         +agentMakeReservation(in r : Reservation, in guest : Customer) : bool
         +getReservation(in reservationNumber : int) : DataSetReservation
         +cancelReservation(in reservationNumber : int) : bool
         +calculateTotal(in r : Reservation) : double
         +calculateTax(in r : Reservation) : double
         +reservationNumber() : int
         +checkIn() : string
         +checkOut() : string
         +resvDate() : string
         +price() : double
         +totalCost() : double
         +roomNumber() : int
         +userName() : string
         +hotelID() : string