예제 #1
0
        // Loads the Ticket List from a data file
        public void LoadTicketList()
        {
            if (!File.Exists(_ticketListDataFile))
            {
                // throw "file does not exist error"
                return;
            }

            StreamReader fin = new StreamReader(_ticketListDataFile);

            while (!fin.EndOfStream)
            {
                string tempBuffer = fin.ReadLine();

                if (tempBuffer.Equals("$START TICKETLIST$"))
                {
                    tempBuffer = fin.ReadLine();

                    while (!tempBuffer.Equals("$END TICKETLIST$"))
                    {
                        string[] token = tempBuffer.Split('%');

                        string tempMobileNum = token[0];
                        int tempExpiryTime = System.Convert.ToInt32(token[1]);

                        TicketExpiry tempTicket = new TicketExpiry(tempMobileNum, tempExpiryTime);
                        _ticketList.Add(tempTicket);

                        // read next interrupt
                        tempBuffer = fin.ReadLine();
                    }
                }
            }
            fin.Close();
        }
예제 #2
0
        /****************************************************************************************************/
        // METHODS - MODIFIERS
        /****************************************************************************************************/

        // insert mobile num at the end of the ticket list
        public void Add(TicketExpiry newTicket)
        {
            _ticketExpiryList.Add(newTicket);
        }
예제 #3
0
 // issues a new ticket
 public void IssueNewTicket(string mobileNum)
 {
     TicketExpiry newTicket = new TicketExpiry(mobileNum, _time + T_VAL);
     _ticketList.Add(newTicket);
     _userList.FindUserWithMobileNumber(mobileNum).UpdateTicketExpiry(_time + T_VAL);
     //sendSMS("hello "+ FindUserWithMobileNumber(mobileNum), mobileNum);
 }