예제 #1
0
        // Loads all the customers from the CSV into a list of customers (ListOfCostumer Singleton Class)
        public void GetCostumers()
        {
            // Create a streamReader object to access the file
            StreamReader    reader       = new StreamReader(File.OpenRead(csvCostumerPath));
            ListOfCostumers costumerList = ListOfCostumers.Instance();//Get an instance of the ListOfCustomer (Singleton) class

            // Create a streamReader object to access the file
            while (!reader.EndOfStream)
            {
                var      line      = reader.ReadLine();
                var      values    = line.Split(',');
                Costumer aCostumer = new Costumer(Int32.Parse(values[0]), values[1], values[2]); //Create a new customer and sets its properties to the values on the csv
                costumerList.AddCostumer(aCostumer);                                             //adds the customer to the custumer list (in the ListOfCustumers in the singleton class)
            }
            reader.Dispose();
        }
예제 #2
0
 //Adds a new custumer to the custumer list given a costumer object
 public void AddCostumer(Costumer aCostumer)
 {
     costumerList.AddCostumer(aCostumer);
 }