Exemplo n.º 1
0
        public void EditOrder(Order order, DateTime date)
        {
            Logger.Info("Edit order called", "OrderOps - EditOrder");

            order = CalculateOrderTotals(order, order.State, order.ProductType);
            _orderRepository.UpdateOrder(order, date);
        }
Exemplo n.º 2
0
 public AddOrderWorkFlow(OrderOperations oops)
 {
     _oops = oops;
     _orderInfo = new Order();
     _productsList = new List<Product>();
     _errorResponse = new ErrorResponse();
 }
 public static void DisplayRemoveOrderInfo(Order order)
 {
     Logger.Info("Display Removal Order Information for Confirmation", "DisplayOrderInformation.DisplayRemoveOrderConfirmation");
     Console.Clear();
     Console.WriteLine("Order Number: {0}\n Customer Name: {1}\n State: {2}\n Tax Rate: {3:p}\n Product Type: {4}\n Area: {5}\n Cost per Square Foot: {6:c}\n Labor Cost Per Square Foot: {7:c}\n Material Cost: {8:c}\n Labor Cost: {9:c}\n Total Tax: {10:c}\n Total Cost: {11:c}",
         order.OrderNumber, order.CustomerName, order.State.StateAbbreviation, order.TaxRate / 100, order.ProductType.ProductType, order.Area,
         order.CostPerSquareFoot, order.LaborCostPerSquareFoot, order.MaterialCost, order.LaborCost, order.Tax, order.Total);
     Console.WriteLine();
 }
Exemplo n.º 4
0
 public EditOrderPrompts(Order order)
     : base()
 {
     this._isValidInput = false;
     this.Response.Order = order;
     Response.Updated = false;
     this._orderOperations = new OrderOperations();
     this._repositoryOperations = new RepositoryOperations();
 }
Exemplo n.º 5
0
 public Response()
 {
     Message = "";
     Order = new Order();
     Slip = new OrderSlip();
     OrderList = new List<Order>();
     State = new State();
     Product = new Product();
 }
Exemplo n.º 6
0
        public void GetOrderInfoTest()
        {
            Order orderInput = new Order() {OrderNumber = 1, OrderDate = DateTime.Parse("06/01/2013")};

            var returnedOrderInfo = _oops.GetOrderInfo(orderInput);

            Assert.AreEqual(returnedOrderInfo.Order.CustomerName, "Wise");
            Assert.AreEqual(returnedOrderInfo.Order.State, "OH");
            Assert.AreEqual(returnedOrderInfo.Order.ProductType, "Wood");
        }
Exemplo n.º 7
0
        public Order CalculateOrderTotals(Order Order, State state, Product product)
        {
            Logger.Info("Calculate order Totals called", "OrderOps - CalculateOrderTotals");

            Order.CostPerSquareFoot = _productsRepository.GetProduct(product).CostPerSquareFoot;
            Order.LaborCostPerSquareFoot = _productsRepository.GetProduct(product).LaborCostPerSquareFoot;
            Order.TaxRate = _statesRepository.GetState(state).TaxRate;
            Order.LaborCost = Order.LaborCostPerSquareFoot * Order.Area;
            Order.MaterialCost = Order.CostPerSquareFoot * Order.Area;
            Order.Tax = (Order.MaterialCost + Order.LaborCost) * (Order.TaxRate / 100);
            Order.Total = Order.LaborCost + Order.MaterialCost + Order.Tax;

            return Order;
        }
Exemplo n.º 8
0
        public Response CreateOrder(OrderSlip slip)
        {
            Logger.Info("Create order called", "OrderOps - CreateOrder");

            var orderToCreate = new Order();

            orderToCreate.CustomerName = slip.CustomerName;
            orderToCreate.State = slip.State;
            orderToCreate.ProductType = slip.ProductType;
            orderToCreate.Area = slip.Area;

            orderToCreate = CalculateOrderTotals(orderToCreate, orderToCreate.State, orderToCreate.ProductType);

            _response.Order = orderToCreate;
            _response.Success = true;

            return _response;
        }
Exemplo n.º 9
0
        public virtual List<Order> GetAllOrders(DateTime Date)
        {
            try
            {
                Orders = new List<Order>();

                var reader = File.ReadAllLines(FilePath + Date.ToString("MMddyyy") + ".txt");

                for (int i = 1; i < reader.Length; i++)
                {
                    var firstIndexOfName = reader[i].IndexOf("\"");
                    var lastIndexOfName = reader[i].LastIndexOf("\"");

                    var order = new Order();

                    order.OrderNumber = int.Parse(reader[i].Substring(0, firstIndexOfName - 1));
                    order.CustomerName = reader[i].Substring(firstIndexOfName + 1, lastIndexOfName - firstIndexOfName - 1);

                    var columnsToParse = reader[i].Substring(lastIndexOfName + 2);
                    var columns = columnsToParse.Split(',');

                    order.State.StateAbbreviation = columns[0];
                    order.TaxRate = decimal.Parse(columns[1]);
                    order.ProductType.ProductType = columns[2];
                    order.Area = decimal.Parse(columns[3]);
                    order.CostPerSquareFoot = decimal.Parse(columns[4]);
                    order.LaborCostPerSquareFoot = decimal.Parse(columns[5]);
                    order.MaterialCost = decimal.Parse(columns[6]);
                    order.LaborCost = decimal.Parse(columns[7]);
                    order.Tax = decimal.Parse(columns[8]);
                    order.Total = decimal.Parse(columns[9]);

                    Orders.Add(order);
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Order Repo - GetAllOrders");
            }
            return Orders;
        }
Exemplo n.º 10
0
        public Order GetOrder(Order OrderInfo)
        {
            List<Order> orders = GetOrdersFromDate(OrderInfo.OrderDate);

            Order updatedOrderInfo = new Order();

            if (orders != null)
            {
                updatedOrderInfo = orders.FirstOrDefault(o => o.OrderNumber == OrderInfo.OrderNumber);

                OrderInfo = updatedOrderInfo;
            }

            else
            {
                OrderInfo = null;
            }

            return OrderInfo;
        }
Exemplo n.º 11
0
        public void SubmitRemoveOrderToRepoTest()
        {
            Order orderToRemove = new Order() {OrderNumber = 1, OrderDate = DateTime.Parse("06/01/2013")};

            var response = _oops.SubmitRemoveOrderToRepo(orderToRemove);

            Assert.AreEqual(response.Success, true);
            Assert.AreEqual(response.Message, "The order was successfully removed!!");
        }
Exemplo n.º 12
0
        public void SubmitOrderToRepoTest()
        {
            Order inputOrder = new Order() {OrderNumber = 15, CustomerName = "Dean Choi", State = "OH"};

            Order returnedOrder = _oops.SubmitOrderToRepo(inputOrder);

            Assert.AreEqual(inputOrder.OrderNumber, returnedOrder.OrderNumber);
        }
Exemplo n.º 13
0
        public void SubmitEditOrderToRepoTest()
        {
            Order orderToRemove = new Order()
            {
                OrderNumber = 1,
                OrderDate = DateTime.Parse("06/01/2013"),
                CustomerName = "Dean Choi",
                Total = 100.00M
            };

            var response = _oops.SubmitEditOrderToRepo(orderToRemove);

            Assert.AreEqual(response.Success, true);
            Assert.AreEqual(response.Message, "The order was successfully edited!!");
        }
Exemplo n.º 14
0
        public Response GetOrderInfo(Order OrderInfo)
        {
            var response = new Response();
            var order = _orderRepo.GetOrder(OrderInfo);

            if (order == null)
            {
                response.Success = false;
                response.Message = "That order is not in our database.";
            }
            else
            {
                response.Success = true;
                response.Order = order;
            }

            return response;
        }
Exemplo n.º 15
0
 public Response SubmitRemoveOrderToRepo(Order OrderToRemove)
 {
     //submit to data layer to remove
     var response = _orderRepo.RemoveOrderFromRepo(OrderToRemove);
     return response;
 }
Exemplo n.º 16
0
        public Response RemoveOrderFromRepo(Order OrderToRemove)
        {
            string filePath = @"DataFiles\Prod\Orders_";
            filePath += OrderToRemove.OrderDate.ToString("MMddyyyy") + ".txt";

            var ordersList = GetOrdersFromDate(OrderToRemove.OrderDate);

            var newOrdersList = ordersList.Where(o => o.OrderNumber != OrderToRemove.OrderNumber);

            using (var writer = File.CreateText(filePath))
            {
                writer.WriteLine(
                    "OrderNumber,CustomerName,State,TaxRate,ProductType,Area,CostPerSquareFoot,LaborCostPerSquareFoot,MaterialCost,LaborCost,Tax,Total");

                foreach (var order in newOrdersList)
                {
                    writer.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}", order.OrderNumber,
                        order.CustomerName, order.State, order.TaxRate, order.ProductType, order.Area,
                        order.CostPerSquareFoot, order.LaborCostPerSquareFoot, order.MaterialCost, order.LaborCost,
                        order.Tax, order.Total);
                }
            }

            var response = new Response();
            response.Success = true;
            response.Message = "The order was successfully removed.";

            return response;
        }
Exemplo n.º 17
0
 public EditOrderWorkFlow(OrderOperations oops)
 {
     _orderToEdit = new Order();
     _errorResponse = new ErrorResponse();
     _oops = oops;
 }
Exemplo n.º 18
0
 public string ToCSVForTesting(Order order)
 {
     return String.Format("{0},\"{1}\",{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}", order.OrderNumber,
                 order.CustomerName, order.State.StateAbbreviation, order.TaxRate, order.ProductType.ProductType,
                 order.Area, order.CostPerSquareFoot,
                 order.LaborCostPerSquareFoot, order.MaterialCost, order.LaborCost, order.Tax, order.Total);
 }
Exemplo n.º 19
0
 public virtual void WriteNewLine(Order order, DateTime Date)
 {
     try
     {
         using (var writer = File.AppendText(FilePath + Date.ToString("MMddyyy") + ".txt"))
         {
             writer.WriteLine("{0},\"{1}\",{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}", order.OrderNumber,
                 order.CustomerName, order.State.StateAbbreviation, order.TaxRate, order.ProductType.ProductType,
                 order.Area, order.CostPerSquareFoot,
                 order.LaborCostPerSquareFoot, order.MaterialCost, order.LaborCost, order.Tax, order.Total);
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex, "Order Repo - WriteNewLine");
     }
 }
Exemplo n.º 20
0
        public virtual void UpdateOrder(Order OrderToUpdate, DateTime Date)
        {
            try
            {
                var orders = GetAllOrders(Date);
                var order = orders.First(o => o.OrderNumber == OrderToUpdate.OrderNumber);

                order.CustomerName = OrderToUpdate.CustomerName;
                order.State = OrderToUpdate.State;
                order.TaxRate = OrderToUpdate.TaxRate;
                order.ProductType = OrderToUpdate.ProductType;
                order.Area = OrderToUpdate.Area;
                order.CostPerSquareFoot = OrderToUpdate.CostPerSquareFoot;
                order.LaborCostPerSquareFoot = OrderToUpdate.LaborCostPerSquareFoot;
                order.MaterialCost = OrderToUpdate.MaterialCost;
                order.LaborCost = OrderToUpdate.LaborCost;
                order.Tax = OrderToUpdate.Tax;
                order.Total = OrderToUpdate.Total;

                OverwriteFile(orders, Date);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Order Repo - UpdateOrder");
            }
        }
Exemplo n.º 21
0
        public Response EditOrderToRepo(Order OrderWithEdits)
        {
            string filePath = @"DataFiles\Prod\Orders_";
            filePath += OrderWithEdits.OrderDate.ToString("MMddyyyy") + ".txt";

            var ordersList = GetOrdersFromDate(OrderWithEdits.OrderDate);
            //find index of order to edit in ordersList
            int index = ordersList.IndexOf(OrderWithEdits);
            //use index number to make direct reference type modification
            var response = new Response();

            if (index == -1)
            {

                response.Success = false;
                response.Message = "Failed to find order in system. Internal glitch. Report to admin";
                return response;
            }

            ordersList[index] = OrderWithEdits;

            using (var writer = File.CreateText(filePath))
            {
                writer.WriteLine(
                    "OrderNumber,CustomerName,State,TaxRate,ProductType,Area,CostPerSquareFoot,LaborCostPerSquareFoot,MaterialCost,LaborCost,Tax,Total");

                foreach (var order in ordersList)
                {
                    writer.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}", order.OrderNumber,
                        order.CustomerName, order.State, order.TaxRate, order.ProductType, order.Area,
                        order.CostPerSquareFoot, order.LaborCostPerSquareFoot, order.MaterialCost, order.LaborCost,
                        order.Tax, order.Total);
                }
            }

            response.Success = true;
            response.Message = "Your request has been proceessed.";

            return response;
        }
Exemplo n.º 22
0
        public Order WriteNewOrderToRepo(Order NewOrder)
        {
            string filePath = @"DataFiles\Prod\Orders_";
            filePath += NewOrder.OrderDate.ToString("MMddyyyy") + ".txt";

            //determine new order number
            string filePathOrderHistory = @"DataFiles\Prod\OrderNumbersHistory.txt";
            var reader = File.ReadAllLines(filePathOrderHistory);
            int[] readerInts = Array.ConvertAll(reader, int.Parse);

            if (readerInts.Length == 0)
            {
                NewOrder.OrderNumber = 1;
            }
            else
            {
                NewOrder.OrderNumber = readerInts.Max() + 1;
            }

            if (File.Exists(filePath))
            {
                using (var writer = File.AppendText(filePath))
                {
                    writer.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}", NewOrder.OrderNumber,
                        NewOrder.CustomerName,
                        NewOrder.State, NewOrder.TaxRate, NewOrder.ProductType, NewOrder.Area,
                        NewOrder.CostPerSquareFoot, NewOrder.LaborCostPerSquareFoot,
                        NewOrder.MaterialCost, NewOrder.LaborCost, NewOrder.Tax, NewOrder.Total);
                }
            }
            else
            {
                using (var writer = File.CreateText(filePath))
                {
                    writer.WriteLine(
                        "OrderNumber,CustomerName,State,TaxRate,ProductType,Area,CostPerSquareFoot,LaborCostPerSquareFoot,MaterialCost,LaborCost,Tax,Total");
                    writer.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}", NewOrder.OrderNumber,
                        NewOrder.CustomerName,
                        NewOrder.State, NewOrder.TaxRate, NewOrder.ProductType, NewOrder.Area,
                        NewOrder.CostPerSquareFoot, NewOrder.LaborCostPerSquareFoot,
                        NewOrder.MaterialCost, NewOrder.LaborCost, NewOrder.Tax, NewOrder.Total);
                }
            }
            using (var writer = File.AppendText(filePathOrderHistory))
            {
                writer.WriteLine(NewOrder.OrderNumber);
            }

            return NewOrder;
        }
Exemplo n.º 23
0
        public bool ConfirmEditsToOrder()
        {
            Console.Clear();

            if (_changesCount > 0)
            {
                Console.WriteLine("Order Modifications:");
                Console.WriteLine("----------------------------------------------------------");
            }

            Order orderEditPreview = new Order();

            if (_orderPreEdit.CustomerName != null)
            {
                orderEditPreview.CustomerName = _orderPreEdit.CustomerName;
                Console.WriteLine("-Customer Name: {0} ---> {1}", _orderToEdit.CustomerName, orderEditPreview.CustomerName);
            }
            else
            {
                orderEditPreview.CustomerName = _orderToEdit.CustomerName;
            }

            if (_orderPreEdit.State != null)
            {
                orderEditPreview.State = _orderPreEdit.State;
                orderEditPreview.TaxRate = _orderPreEdit.TaxRate;
                Console.WriteLine("-State: {0} ---> {1}", _orderToEdit.State, orderEditPreview.State);
            }
            else
            {
                orderEditPreview.State = _orderToEdit.State;
                orderEditPreview.TaxRate = _orderToEdit.TaxRate;
            }

            if (_orderPreEdit.ProductType != null)
            {
                orderEditPreview.ProductType = _orderPreEdit.ProductType;
                orderEditPreview.CostPerSquareFoot = _orderPreEdit.CostPerSquareFoot;
                orderEditPreview.LaborCostPerSquareFoot = _orderPreEdit.LaborCostPerSquareFoot;
                Console.WriteLine("-Product Type: {0} ---> {1}", _orderToEdit.ProductType, orderEditPreview.ProductType);
            }
            else
            {
                orderEditPreview.ProductType = _orderToEdit.ProductType;
                orderEditPreview.CostPerSquareFoot = _orderToEdit.CostPerSquareFoot;
                orderEditPreview.LaborCostPerSquareFoot = _orderToEdit.LaborCostPerSquareFoot;
            }

            if (_orderPreEdit.Area != 0)
            {
                orderEditPreview.Area = _orderPreEdit.Area;
                Console.WriteLine("-Area: {0} sqft ---> {1} sqft", _orderToEdit.Area, orderEditPreview.Area);
            }
            else
            {
                orderEditPreview.Area = _orderToEdit.Area;
            }

            //calculate new total prices
            orderEditPreview.MaterialCost = orderEditPreview.CostPerSquareFoot*orderEditPreview.Area;
            orderEditPreview.LaborCost = orderEditPreview.LaborCostPerSquareFoot*orderEditPreview.Area;
            decimal subtotalPreview = orderEditPreview.MaterialCost + orderEditPreview.LaborCost;
            orderEditPreview.Tax = subtotalPreview*(orderEditPreview.TaxRate/100);
            orderEditPreview.Total = subtotalPreview + orderEditPreview.Tax;

            orderEditPreview.OrderDate = _orderToEdit.OrderDate;
            orderEditPreview.OrderNumber = _orderToEdit.OrderNumber;

            if (_changesCount > 0)
            {
                Console.WriteLine();
                Console.WriteLine("Here is your updated Order Summary: ");
                Console.WriteLine();
            }

            if (_changesCount == 0)
            {
                Console.WriteLine("You didn't make any changes.");
                Console.WriteLine();
                Console.WriteLine("Here is your Order Summary");
                Console.WriteLine();
            }

            Console.WriteLine("Order Number ----- {0}", orderEditPreview.OrderNumber);
            Console.WriteLine("Order Date ------- {0:d}", orderEditPreview.OrderDate);
            Console.WriteLine("Customer Name ---- {0}", orderEditPreview.CustomerName);
            Console.WriteLine("State ------------ {0}", orderEditPreview.State);
            Console.WriteLine("Product Type ----- {0}", orderEditPreview.ProductType);
            Console.WriteLine("Area ------------- {0:N} sqft", orderEditPreview.Area);
            Console.WriteLine("Materials Cost --- {0:c}", orderEditPreview.MaterialCost);
            Console.WriteLine("Labor Cost ------- {0:c}", orderEditPreview.LaborCost);
            Console.WriteLine("Subtotal --------- {0:c}", orderEditPreview.Total - orderEditPreview.Tax);
            Console.WriteLine("Tax -------------- {0:c}", orderEditPreview.Tax);
            Console.WriteLine("Total ------------ {0:c}", orderEditPreview.Total);
            Console.WriteLine();

            if (_changesCount > 0)
            {
                string input = "";
                do
                {
                    Console.Write("Submit updated Order Information? (Y)es, (N)o, or (Q)uit: ");
                    input = Console.ReadLine().ToUpper();

                } while (input != "Y" && input != "N" && input !="Q");

                if (input == "Y")
                {
                    //Run method and updated orderInfo to BLL with orderEditPreview
                    var response = _oops.SubmitEditOrderToRepo(orderEditPreview);
                    Console.WriteLine(response.Message);
                    Console.WriteLine("Press ENTER to return to MAIN MENU.");
                    Console.ReadLine();
                    return true;

                }
                else if (input == "N")
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }

            else
            {
                string input;
                do
                {
                    Console.Write("Edit again? (Y)es or (N)o: ");
                    input = Console.ReadLine().ToUpper();

                } while (input != "Y" && input != "N");

                if (input == "Y")
                {
                    return false;
                }
                else
                {
                    return true;
                }

            }
        }
Exemplo n.º 24
0
 public Order SubmitOrderToRepo(Order NewOrder)
 {
     return _orderRepo.WriteNewOrderToRepo(NewOrder);
 }
Exemplo n.º 25
0
        public Order LoadFromCSVForTesting(string orderCSV)
        {
            var order = new Order();

            var firstIndexOfName = orderCSV.IndexOf("\"");
            var lastIndexOfName = orderCSV.LastIndexOf("\"");

            order.OrderNumber = int.Parse(orderCSV.Substring(0, firstIndexOfName - 1));
            order.CustomerName = orderCSV.Substring(firstIndexOfName + 1, lastIndexOfName - firstIndexOfName - 1);

            var columnsToParse = orderCSV.Substring(lastIndexOfName + 2);
            var columns = columnsToParse.Split(',');

            order.State.StateAbbreviation = columns[0];
            order.TaxRate = decimal.Parse(columns[1]);
            order.ProductType.ProductType = columns[2];
            order.Area = decimal.Parse(columns[3]);
            order.CostPerSquareFoot = decimal.Parse(columns[4]);
            order.LaborCostPerSquareFoot = decimal.Parse(columns[5]);
            order.MaterialCost = decimal.Parse(columns[6]);
            order.LaborCost = decimal.Parse(columns[7]);
            order.Tax = decimal.Parse(columns[8]);
            order.Total = decimal.Parse(columns[9]);

            return order;
        }
Exemplo n.º 26
0
        public List<Order> GetOrdersFromDate(DateTime orderDate)
        {
            string filePath = @"DataFiles\Prod\Orders_";
            filePath += orderDate.ToString("MMddyyyy") + ".txt";

            List<Order> orders = null;

            if (File.Exists(filePath))
            {
                orders = new List<Order>();
                var reader = File.ReadAllLines(filePath);

                for (int i = 1; i < reader.Length; i++)
                {
                    var columns = reader[i].Split(',');
                    int L = columns.Length;

                    var order = new Order();

                    order.OrderNumber = int.Parse(columns[0]); //first assignment

                    for (int j = 1; j < L - 10; j++) //the name assignments
                    {
                        if (j == L - 11) //last one doesnt get comma
                        {
                            order.CustomerName += columns[j];
                        }
                        else //others get a comma
                        {
                            order.CustomerName += (columns[j] + ",");
                        }
                    }
                    //the other assignments
                    order.State = columns[L - 10];
                    order.TaxRate = decimal.Parse(columns[L - 9]);
                    order.ProductType = columns[L - 8];
                    order.Area = decimal.Parse(columns[L - 7]);
                    order.CostPerSquareFoot = decimal.Parse(columns[L - 6]);
                    order.LaborCostPerSquareFoot = decimal.Parse(columns[L - 5]);
                    order.MaterialCost = decimal.Parse(columns[L - 4]);
                    order.LaborCost = decimal.Parse(columns[L - 3]);
                    order.Tax = decimal.Parse(columns[L - 2]);
                    order.Total = decimal.Parse(columns[L - 1]);

                    orders.Add(order);
                }

            }

            return orders;
        }
Exemplo n.º 27
0
        public void Execute()
        {
            do
            {
                exitToMainMenu = false;
                PromptForOrderDate();
                PromptForOrderNumber();
            } while (!FetchOrderInfoToEdit());

            if (!exitToMainMenu)
            {
                do
                {
                    _changesCount = 0;
                    _orderPreEdit = new Order();

                    PromptForEditsFromUser();

                } while (!ConfirmEditsToOrder());
            }
        }
Exemplo n.º 28
0
        public bool FetchOrderInfoToEdit()
        {
            var response = _oops.GetOrderInfo(_orderToEdit);
            string input = "";

            if (response.Success)
            {
                do
                {
                    Console.Clear();
                    Console.WriteLine("Order to modify:");
                    Console.WriteLine();

                    response.Order.OrderDate = _orderToEdit.OrderDate;
                    _orderToEdit = response.Order;

                    DisplayOrderInfo();

                    Console.WriteLine("Is this the correct order?");
                    Console.Write("(Y)es, (N)o, or (Q)uit: ");
                    input = Console.ReadLine().ToUpper();

                    if (input == "Y")
                    {
                        return true;
                    }
                    if (input == "N")
                    {
                        return false;
                    }
                    if (input == "Q")
                    {
                        exitToMainMenu = true;
                        return true;
                    }

                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine();
                    Console.WriteLine("That is an invalid entry.");
                    Console.WriteLine("Press ENTER to continue...");
                    Console.ResetColor();
                    Console.ReadLine();

                } while (true);

            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine();
                Console.WriteLine(response.Message);
                Console.WriteLine("Press ENTER to continue...");
                Console.ResetColor();
                Console.ReadLine();
                return false;
            }
        }
Exemplo n.º 29
0
        public virtual Order GetOrder(int OrderNumber, DateTime Date)
        {
            var order = new Order();

            try
            {
                List<Order> orders = GetAllOrders(Date);
                order = orders.FirstOrDefault(o => o.OrderNumber == OrderNumber);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Order Repo - GetOrder");
            }

            return order;
        }
Exemplo n.º 30
0
        public Response SubmitEditOrderToRepo(Order OrderWithEdits)
        {
            var response = _orderRepo.EditOrderToRepo(OrderWithEdits);

            return response;
        }