public void GetOrdersTest()
 {
     var ops = new OrderOperations();
     var response = ops.GetOrders("06012014");
     var orderNums = response.OrderList.Count();
     Assert.AreEqual(orderNums, 3);
 }
Beispiel #2
0
 public void Execute(OrderOperations orderOps)
 {
     _orderOps = orderOps;
     _formattedDate = GetDateFromUser();
     GetOrderNumberFromUser();
     UpdateOrder();
 }
        public void CreateNewOrderNumberTest()
        {
            var ops = new OrderOperations();
            var newOrderNum = ops.CreateNewOrderNumber("06012014");

            Assert.AreEqual(newOrderNum, 4);
        }
        public void AddOrderOpsTest()
        {
            var ops = new OrderOperations();
            Order newOrder = new Order();
            newOrder.ProductInfo = new Product();

            newOrder.OrderNumber = 4;
            newOrder.CustomerName = "Dave";
            newOrder.TaxRate = (decimal)6.25;
            newOrder.ProductInfo.ProductType = "Wood";
            newOrder.Area = (decimal)100.00;
            newOrder.ProductInfo.CostPerSquareFoot = (decimal)5.15;
            newOrder.ProductInfo.LaborCostPerSquareFoot = (decimal)4.75;
            newOrder.MaterialCost = (decimal)515.00;
            newOrder.LaborCost = (decimal)475.00;
            newOrder.Tax = (decimal)61.88;
            newOrder.Total = (decimal)1051.88;
            newOrder.State = "OH";

            ops.AddOrder(newOrder, "06012014");

            var response = ops.GetOrders("06012014");
            var orderNum = response.OrderList.Count();

            Assert.AreEqual(orderNum, 4);
        }
Beispiel #5
0
 public void AddOrder()
 {
     OrderOperations orderOperations = new OrderOperations();
     orderOperations.LoadOrdersFromFile();
     var request = new AddEntryRequest();
     CreateOrderRequest(request);///not quite sure on the order
     orderOperations.CreateOrder(request);
 }
Beispiel #6
0
 public void Execute(OrderOperations orderOps)
 {
     _orderOps = orderOps;
     _newOrder = new Order();
     _newOrder.ProductInfo = new Product();
     GetCustomerNameFromUser();
     GetCustomerState();
     GetProductType();
     GetArea();
     BuildOrder();
     DisplayNewOrder();
 }
        public void EditOrderOpsTest()
        {
            var ops = new OrderOperations();
            var response = ops.GetSpecificOrder("06012014", 1);

            var order = response.OrderList.FirstOrDefault(o => o.OrderNumber == 1);

            order.CustomerName = "Dave";

            ops.EditOrder(order, "06012014");
            response = ops.GetOrders("06012014");

            var editedOrder = response.OrderList.FirstOrDefault(o => o.OrderNumber == 1);

            Assert.AreEqual(editedOrder.CustomerName, "Dave");
        }
Beispiel #8
0
        public void CreateOrderRequest(AddEntryRequest request)
        {
            Validate validate = new Validate();

            Console.WriteLine("ORDER ENTRY");
            Console.WriteLine();

            request.CustomerName = validate.PromptforString("Enter customer name: ");
            request.State = validate.PromptforState("Please enter the state abbreviation: IN, PA, MI, OH");
            request.ProductType = validate.PromptforProduct("Please Enter a product: Wood, Tile, Laminate, Carpet ");
            request.Area = validate.PromptforDecimal("Please Enter the Area:");
            request.OrderDate = validate.PromptforDate("Please enter the Date MM/DD/YYYY");
            Console.Clear();
            Console.WriteLine(@"Your order details are:
            Customer Name: {0}
            State: {1}
            Product Type: {2}
            Area: {3:n0}
            Order Date: {4}", request.CustomerName, request.State, request.ProductType, request.Area, request.OrderDate);

            Console.WriteLine();

            Console.WriteLine("Would you like to add this order? (Y)es or (N)o?");
            string newOrderReply = Console.ReadLine().ToUpper();

            if (newOrderReply == "Y")
            {
                OrderOperations orderOperations = new OrderOperations();
                orderOperations.CreateOrder(request);
            }

            else
            {
                DisplayMenu returnToMain = new DisplayMenu();
                returnToMain.MainMenu();
            }
        }
        public void RemoveOrderOpsTest()
        {
            var ops = new OrderOperations();
            ops.RemoveOrder("06012014", 2);
            ops.RemoveOrder("06012014", 1);
            var response = ops.GetOrders("06012014");
            var orderNums = response.OrderList.Count();

            Assert.AreEqual(orderNums, 1);
        }
        public void GetSpecificOrderTest()
        {
            var ops = new OrderOperations();
            var response = ops.GetSpecificOrder("06012014", 1);
            Console.WriteLine(response.Message);
            Order order = response.OrderList.FirstOrDefault(o => o.OrderNumber == 1);

            Assert.AreEqual(1, order.OrderNumber);
            Assert.AreEqual("Jim", order.CustomerName);
        }
Beispiel #11
0
        public void EditEntries()
        {
            OrderOperations orderOperations = new OrderOperations();
            Validate validate = new Validate();
            bool goodDate = false;

            Console.WriteLine("EDIT ORDER");
            Console.WriteLine();

            do
            {

                string OrderDate = validate.PromptforDate("Please enter the date of the order you want to change MM/DD/YYYY");
                int orderNumber = Convert.ToInt32(validate.PromptforDecimal("Please enter your order number"));

                goodDate = orderOperations.FindOrder(OrderDate, orderNumber);

                if (goodDate == true)
                {

                    Console.WriteLine("What would you like to change, Customer Name, State, Area, or Product?");//propertyEdit
                    propertyEdit = Console.ReadLine().ToUpper();//valid info continue, one of these

                    if ((propertyEdit == "CUSTOMER NAME" || propertyEdit == "STATE" || propertyEdit == "AREA" || propertyEdit == "AREA" || propertyEdit == "PRODUCT"))
                    {
                        if (propertyEdit == "CUSTOMER NAME")
                        {
                            Console.WriteLine("What would you like to change it to?");
                            userInput = Console.ReadLine().ToUpper();
                        }

                        if (propertyEdit == "STATE")
                        {
                            userInput = validate.PromptforState("What would you like to change it to? IN, OH, PA, or MI");
                        }

                        if (propertyEdit == "AREA")
                        {
                            decimal userArea;

                            userArea = validate.PromptforDecimal("What would you like to change it to?");
                            userInput = userArea.ToString();

                        }

                        if (propertyEdit == "PRODUCT")
                        {
                            userInput = validate.PromptforProduct("What would you like to change it to? Wood, Tile, Carpet, or Laminate");

                        }
                    }
                    else
                    {

                        Console.WriteLine("That was not a valid choice, please try again!");
                    }
                    orderOperations.EditOrder(OrderDate, propertyEdit, userInput);

                    Console.Clear();
                    Console.WriteLine("Your order has been successfully updated! Press Enter to continue!");
                    string edits = Console.ReadLine().ToUpper();
                }

                else
                {

                    Console.WriteLine("That is not a valid order, please try again!");
                }

            } while (!goodDate);
        }
 public RemoveOrderWorkFlow(OrderOperations orderOperations)
 {
     Ops = orderOperations;
 }
Beispiel #13
0
 public EditWorkflow(OrderOperations orderOperations)
 {
     Ops = orderOperations;
 }
Beispiel #14
0
 public LookupWorkFlow(OrderOperations orderOperations)
 {
     Ops = orderOperations;
 }
 public void Execute(OrderOperations orderOps)
 {
     _orderOps = orderOps;
     _formattedDate = GetDateFromUser();
     DisplayOrder(_formattedDate);
 }
Beispiel #16
0
        public void RemoveTheOrder()
        {
            OrderOperations orderOperations = new OrderOperations();

            Validate validate = new Validate();
            AddEntry display = new AddEntry();
            //bool alreadydisplayed = false;
            bool validinput = false;
            bool goodDate = false;

            Console.WriteLine("REMOVE ORDER");
            Console.WriteLine();

            do
            {
                OrderDate = validate.PromptforDate("Please enter the Date of the order MM/DD/YYYY");
                Console.WriteLine("Enter Order Number:");
                OrderNumber = Console.ReadLine();
                goodNumber = int.TryParse(OrderNumber, out output);
                if (validinput = (goodNumber == true))
                {
                    goodDate = (orderOperations.FindOrder(OrderDate, output));
                }
               if (goodDate == false)
                {
                    Console.WriteLine("That was not a valid order!");
                    //Console.ReadLine();
                }

            } while (!goodDate && !goodNumber);

            if (goodDate == true)
            {
                Console.WriteLine("Would you like to delete order? y/n");
                string answer;
                answer = Console.ReadLine();
                if (answer == "y")
                {
                    //string OrderDate = validate.PromptforDate("Please enter the Date MM/DD/YYYY");
                    //decimal ordnum = validate.PromptforDecimal("EnterOrder Number: ");
                    List<Order> removeO = orderOperations.LoadOrdersFromFile();
                    var remove = orderOperations.LoadOrdersFromFile();
                    var resultsr = from order in removeO
                                   where order.OrderDate != OrderDate || order.OrderNumber != output
                                   select new
                                   {
                                       order.OrderDate,
                                       order.OrderNumber,
                                       order.CustomerName,
                                       order.State,
                                       order.TaxRate,
                                       order.Tax,
                                       order.ProductType,
                                       order.Area,
                                       order.CostPerSquareFoot,
                                       order.LaborCost,
                                       order.LaborCostPerSquareFoot,
                                       order.MaterialCost,
                                       order.Total
                                   };

                    using (StreamWriter ord = new StreamWriter("Orders.txt"))
                    {
                        foreach (var order in resultsr)
                        {
                            ord.WriteLine(order.OrderDate + "," + order.OrderNumber + "," + order.CustomerName + "," + order.State + "," +
                                +order.TaxRate + "," + order.Tax + "," + order.ProductType + "," + order.Area + "," + order.CostPerSquareFoot + "," + order.LaborCost + "," + order.LaborCostPerSquareFoot + "," +
                                 order.MaterialCost + "," + order.Total);
                        }
                        Console.WriteLine("Your order has been removed!");
                        Console.ReadLine();
                    }
                }
                else
                {
                    DisplayMenu m = new DisplayMenu();
                    m.HomeMenu();
                }
            }
            else
            {
                Console.WriteLine("That is not a valid order!");
            }
        }
 public AddOrderWorkflow(OrderOperations orderOperations)
 {
     Ops = orderOperations;
 }