Esempio n. 1
0
 private void AddNewOrder(Order order)
 {
     var todaysOrders = GetTodaysOrders();
     todaysOrders.Add(order);
     var r = new OrderRepository();
     r.SaveOrdersToFile(todaysOrders, _filename);
     Console.WriteLine("Your order has been saved!");
 }
 private void SaveUpdatedFile()
 {
     var ord = new OrderRepository();
     ord.SaveOrdersToFile(_ordersToDisplay, _currentFile);
 }
Esempio n. 3
0
        public void WriteToFile()
        {
            string fake = "fake";

            var saveInput = new List<Order>();
            var testOrder = new Order();
            testOrder.OrderNumber = 1;
            testOrder.Name = "Smith";
            testOrder.State = "OH";
            testOrder.TaxRate = .0235M;
            testOrder.ProductType = "Carpet";
            testOrder.Area = 2M;
            testOrder.LaborCostPerSquareFoot = 1.50M;
            testOrder.LaborCostPerSquareFoot = 3.25M;
            testOrder.MaterialCost = testOrder.Area * testOrder.CostPerSquareFoot;
            testOrder.LaborCost = testOrder.LaborCostPerSquareFoot*testOrder.Area;
            testOrder.Tax = testOrder.TaxRate*testOrder.MaterialCost;
            testOrder.Total = testOrder.MaterialCost + testOrder.LaborCost + testOrder.Tax;

            saveInput.Add(testOrder);
            var fm = new OrderRepository();
            fm.SaveOrdersToFile(saveInput, fake);
        }