コード例 #1
0
        public Orders RemoveEditLoadOrder(DateTime date, string input)
        {
            List <Orders> results = new List <Orders>();

            _orderPath = "Orders_" + date.Month.ToString("d2") + date.Day.ToString("d2") + date.Year + ".txt";

            using (StreamReader sr = new StreamReader(_orderPath))
            {
                string row = sr.ReadLine();
                while ((row = sr.ReadLine()) != null)
                {
                    Orders c = OrderMapper.ToOrder(row, date);
                    results.Add(c);
                }
            }

            return(results.FirstOrDefault(a => a.OrderNumber.ToString() == input));
        }
コード例 #2
0
        public List <Orders> LoadOrders(DateTime date)
        {
            List <Orders> results = new List <Orders>();

            _orderPath = "Orders_" + date.Month.ToString("d2") + date.Day.ToString("d2") + date.Year + ".txt";

            if (!File.Exists(_orderPath))
            {
                File.Create(_orderPath).Close();

                return(results);
            }

            using (StreamReader sr = new StreamReader(_orderPath))
            {
                string row = sr.ReadLine();
                while ((row = sr.ReadLine()) != null)
                {
                    Orders c = OrderMapper.ToOrder(row, date);
                    results.Add(c);
                }
            }
            return(results);
        }