Пример #1
0
        public List <Orders> LoadOrder()
        {
            List <Orders> results = new List <Orders>();

            StreamReader sr = null;

            try
            {
                //date needs to be a varible that is gotten from...something...
                sr = new StreamReader(FILENAME);
                sr.ReadLine();
                string row = "";
                while ((row = sr.ReadLine()) != null)
                {
                    Orders o = OrderMapper.ToOrder(row);
                    results.Add(o);
                }
                orders = results;
            }
            catch (FileNotFoundException filenNotFound)
            {
                Console.WriteLine(filenNotFound.FileName + " was not found");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                if (sr != null)
                {
                    sr.Close();
                }
            }
            return(results);
        }