|
FMI Ticket System
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 1 | Project Topic 4 |
|
Each EventService stores all events and a pointer to HallService. More...
#include <EventService.h>
Public Member Functions | |
| EventService (const HallService *hs) | |
| Sets HallService pointer and initializes events List. | |
| EventService (const HallService *hs, const Event *events, unsigned eventCount) | |
| Sets HallService pointer and copies values from events into events List. | |
| StatusCode | createEvent (int hallNumber, const String &name, const Date &date) |
| Creates an Event, with the given hallNumber, name and date. More... | |
| StatusCode | cancelEvent (const char *name, const Date &date) |
| Cancels an Event with the given name and date. More... | |
| StatusCode | reserveTicket (const char *name, const Date &date, const char *password, const char *note, const Ticket &ticket) |
| Creates a Reservation for an Event by name and date. More... | |
| StatusCode | cancelTicketReservation (const char *name, const Date &date, const Ticket &ticket) |
| Cancels a Reservation for a ticket. More... | |
| StatusCode | ticketIsReserved (const char *name, const Date &date, const Ticket &ticket) |
| Whether a ticket is a reserved or not. More... | |
| StatusCode | buyTicket (const char *name, const Date &date, const Ticket &ticket, const char *password, String *reservationNoteOutput) |
| Buys ticket, assuming it is reserved and stores the reservation note. More... | |
| StatusCode | buyTicket (const char *name, const Date &date, const Ticket &ticket) |
| Buys ticket, assuming it isn't reserved. More... | |
| String | createSeatingString (const char *name, const Date &date, unsigned *seatsPerRow) |
| Creates a special String for status of all seats in given Event (by name and date) and returns seatsPerRow in given pointer. More... | |
| List< Event > | queryMostWatched (unsigned topN) |
| List< Event > | queryInsufficientlyVisited () |
| StatusCode | reportReservations (const char *name, const Date &date) |
| Creates a report that lists all Events (with given name and date) and their reserved tickets. More... | |
| StatusCode | reportBoughtTickets (int hallNumber, const Date &start, const Date &end, bool all=false) |
| Creates a report that Lists all Events (with given name and date) and number of bought tickets. More... | |
| StatusCode | load () |
| Loads Events from a database file. More... | |
| StatusCode | save () |
| Saves Events to a database file. More... | |
Each EventService stores all events and a pointer to HallService.
| StatusCode EventService::buyTicket | ( | const char * | name, |
| const Date & | date, | ||
| const Ticket & | ticket | ||
| ) |
Buys ticket, assuming it isn't reserved.
Calls buyTicket with Reservation, but sets password and noteOutput to nullptr.
| StatusCode EventService::buyTicket | ( | const char * | name, |
| const Date & | date, | ||
| const Ticket & | ticket, | ||
| const char * | password, | ||
| String * | reservationNoteOutput | ||
| ) |
Buys ticket, assuming it is reserved and stores the reservation note.
| StatusCode EventService::cancelEvent | ( | const char * | name, |
| const Date & | date | ||
| ) |
| StatusCode EventService::cancelTicketReservation | ( | const char * | name, |
| const Date & | date, | ||
| const Ticket & | ticket | ||
| ) |
Cancels a Reservation for a ticket.
Canceling a reservation doesn't require password and doesn't return the Reservation's note
| StatusCode EventService::createEvent | ( | int | hallNumber, |
| const String & | name, | ||
| const Date & | date | ||
| ) |
Creates an Event, with the given hallNumber, name and date.
Uses HallService pointer to get Hall from hallNumber
| String EventService::createSeatingString | ( | const char * | name, |
| const Date & | date, | ||
| unsigned * | seatsPerRow | ||
| ) |
| StatusCode EventService::load | ( | ) |
Loads Events from a database file.
Looks for file named "eventsDatabse.fmits", which is just a binary file, and then reads it with the "read" function in events List.
| StatusCode EventService::reportBoughtTickets | ( | int | hallNumber, |
| const Date & | start, | ||
| const Date & | end, | ||
| bool | all = false |
||
| ) |
Creates a report that Lists all Events (with given name and date) and number of bought tickets.
| hallNumber | Number of the Event's Hall |
| start | Starting Date from which to take Events |
| end | Ending Date until which to take Evnets (including) |
Report is saved in a file named "boughtTickets.txt" in the current directory.
All Events are inserted into the file with the << operator and a setting of 0b01001.
| StatusCode EventService::reportReservations | ( | const char * | name, |
| const Date & | date | ||
| ) |
Creates a report that lists all Events (with given name and date) and their reserved tickets.
| name | C-style string, if it is equal to "ALL", reservations from all Events on the given date will be reported |
| date | If day, month and year are equal to 0, reservations from all dates will be reported |
Report is saved in a file in the current directory, named "report-NAME-DATE.txt", where NAME is the given name, and DATE is the given date or "ALL" if the date is 0/0/0
All Events are inserted into the file with the << operator and a setting of 0b00101.
| StatusCode EventService::reserveTicket | ( | const char * | name, |
| const Date & | date, | ||
| const char * | password, | ||
| const char * | note, | ||
| const Ticket & | ticket | ||
| ) |
Creates a Reservation for an Event by name and date.
| StatusCode EventService::save | ( | ) |
Saves Events to a database file.
Looks for file named "eventsDatabse.fmits", which is just a binary file, and then writes to it with the "write" function in events List.
| StatusCode EventService::ticketIsReserved | ( | const char * | name, |
| const Date & | date, | ||
| const Ticket & | ticket | ||
| ) |