Exemplo n.º 1
0
        /// <summary>
        /// a method that creates a new list of the ticket class, adds the ticket to the list and then writes the list to file
        /// </summary>
        public void InitialiseTickets()
        {
            List <Ticket> ticketList = new List <Ticket>();

            ticketList.Add(this);
            Persister.WriteToBinaryFile(@"Tickets.txt", ticketList, false);
        }
Exemplo n.º 2
0
 public void AddTicketToList(Ticket ticket)
 {
     ticket.InitialiseTicketId();
     _validTicketList = Persister.ReadFromBinaryFile <List <Ticket> >(@_location + "_tickets.txt");
     _validTicketList.Add(ticket);
     Persister.WriteToBinaryFile(@_location + "_tickets.txt", _validTicketList, false);
 }
Exemplo n.º 3
0
        public void RemoveTimedTicketFromList(Ticket ticket)
        {
            var tickets = Persister.ReadFromBinaryFile <List <Ticket> >(@"Tickets.txt");

            tickets.Remove(ticket);
            Persister.WriteToBinaryFile(@"Tickets.txt", tickets, false);
        }
Exemplo n.º 4
0
        /// <summary>
        /// A method that calls InitialiseTicketId() and then reads existing tickets into a list of the ticket class and then adds the ticket to the list and writes the list to the file.
        /// </summary>
        public void SerialiseTickets()
        {
            InitialiseTicketId();
            var tickets = Persister.ReadFromBinaryFile <List <Ticket> >(@"Tickets.txt");

            tickets.Add(this);
            Persister.WriteToBinaryFile(@"Tickets.txt", tickets, false);
        }
Exemplo n.º 5
0
 private void InitialStationLoad() {
     var stations = File.ReadAllLines(@"StationNames.txt");
     List<Station> stationsj = new List<Station>();
     foreach (var singleLine in stations) {
         stationsj.Add(new Station(new DepartureList(), singleLine));
     }
     Persister.WriteToBinaryFile<List<Station>>(@"Stations.txt", stationsj, false);
 }
Exemplo n.º 6
0
 public void RemoveTicketFromList(Ticket ticket)
 {
     _validTicketList = Persister.ReadFromBinaryFile <List <Ticket> >(@_location + "_tickets.txt");
     foreach (var tick in _validTicketList)
     {
         if (tick.GetTicketId() == ticket.GetTicketId())
         {
             _validTicketList.Remove(tick);
             break;
         }
     }
     Persister.WriteToBinaryFile(@_location + "_tickets.txt", _validTicketList, false);
 }
Exemplo n.º 7
0
 public void SaveAdminData()
 {
     Persister.WriteToBinaryFile(@"AdminAccounts.txt", _listOfAdminAccounts, false);
 }
Exemplo n.º 8
0
 /// <summary>
 /// A method that calls the private Persister.WriteToBinaryFile method with the required parameters
 /// </summary>
 public void SaveCustomerData()
 {
     Persister.WriteToBinaryFile(@"Accounts.txt", _listOfAccounts, false);
 }
Exemplo n.º 9
0
 /// <summary>
 /// A method that writes a ticket to LastTicket.txt which is used to keep ticketids unique
 /// </summary>
 public void InitialiseTicketId()
 {
     Persister.WriteToBinaryFile(@"LastTicket.txt", this, false);
 }
Exemplo n.º 10
0
 public void InitialiseTicketList(Ticket ticket)
 {
     _validTicketList = new List <Ticket>();
     _validTicketList.Add(ticket);
     Persister.WriteToBinaryFile(@_location + "_tickets.txt", _validTicketList, false);
 }