public static void DisplayRepoInfo(OrderSlip orderQuery)
        {
            Logger.Info("Display Order Repo Info", "DisplayOrderInformation.DisplayRepoInfo");

            var ops = new OrderOperations();
            var response = ops.GetAllOrders(orderQuery.Date);

            Console.Clear();
            if (response.Success)
            {
                foreach (var order in response.OrderList)
                {
                    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();
                }

            }
            else
            {
                Console.WriteLine(response.Message);
                Console.WriteLine();
            }

            Console.WriteLine("Press any key to return to Main menu...");
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public void Execute()
        {
            var prompts = new UserPrompts();
            var ops = new OrderOperations();
            EditOrderPrompts query;
            var response = new Response();
            var slip = new OrderSlip();
            bool tryAgain = false;

            do
            {
                tryAgain = false;
                slip = prompts.GetOrderInfoFromUser();
                response = ops.GetOrder(slip.OrderNumber, slip.Date);
                if (!response.Success)
                {
                    Console.WriteLine(response.Message);
                    tryAgain = prompts.PromptUserToTryAgain();
                }
                else
                {
                    query = new EditOrderPrompts(response.Order);
                    var queryResponse = query.EditOrder();

                    if (queryResponse.Updated)
                    {
                        ops.EditOrder(queryResponse.Order, slip.Date);
                    }

                    DisplayOrderInformation.DisplayEditOrderInfo(queryResponse.Order);
                }
            } while (tryAgain);
        }
Ejemplo n.º 3
0
        public void Execute()
        {
            var prompts = new UserPrompts();
            var ops = new OrderOperations();

            var orderToCreate = prompts.GetNewOrderInfoFromUser();
            var response = ops.CreateOrder(orderToCreate);

            DisplayOrderInformation.DisplayNewOrderInfo(response.Order);

            bool isSaving = prompts.AskUserToSave();

            if (isSaving)
            {
                response.Slip = orderToCreate;
                ops.WriteNewOrderToRepository(response);
                DisplayOrderInformation.DisplayNewOrderConfirmation(response.Order);
            }
            else
            {
                Console.WriteLine("Returning to Main Menu.");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
        }
Ejemplo n.º 4
0
 public AddOrderWorkFlow(OrderOperations oops)
 {
     _oops = oops;
     _orderInfo = new Order();
     _productsList = new List<Product>();
     _errorResponse = new ErrorResponse();
 }
Ejemplo n.º 5
0
 public EditOrderPrompts(Order order)
     : base()
 {
     this._isValidInput = false;
     this.Response.Order = order;
     Response.Updated = false;
     this._orderOperations = new OrderOperations();
     this._repositoryOperations = new RepositoryOperations();
 }
Ejemplo n.º 6
0
        public void Execute()
        {
            var prompts = new UserPrompts();
            var orderSlipFromUser = prompts.GetOrderInfoFromUser();
            var ops = new OrderOperations();

            bool goAgain = false;

            do
            {
                var orderResponse = ops.GetOrder(orderSlipFromUser.OrderNumber, orderSlipFromUser.Date);

                if (!orderResponse.Success)
                {
                    Console.WriteLine(orderResponse.Message);
                    Console.WriteLine("Do you want to try again?");
                    string tryAgainOrNot = Console.ReadLine().ToUpper();
                    Console.Clear();

                    switch (tryAgainOrNot)
                    {
                        case "Y":
                            goAgain = true;
                            break;
                        case "N":
                            goAgain = false;
                            break;
                        default:
                            Console.WriteLine("That was not a valid input.");
                            break;
                    }
                }
                else
                {
                    DisplayOrderInformation.DisplayRemoveOrderInfo(orderResponse.Order);

                    var confirmation = prompts.RemovalConfirmation();

                    if (confirmation)
                    {
                        ops.RemoveOrder(orderSlipFromUser.OrderNumber, orderSlipFromUser.Date);
                        Console.WriteLine();
                        Console.WriteLine("Order removed. press any key to return to Main menu.");
                        Console.ReadKey();
                        goAgain = false;
                    }
                }
            } while (goAgain);
        }
Ejemplo n.º 7
0
 public void oopSetup()
 {
     _oops = new OrderOperations();
 }
Ejemplo n.º 8
0
 static void Main(string[] args)
 {
     OrderOperations oops = new OrderOperations();
     var menu = new MainMenu(oops);
     menu.Execute();
 }
Ejemplo n.º 9
0
 public MainMenu(OrderOperations oops)
 {
     _oops = oops;
 }
Ejemplo n.º 10
0
 public DisplayOrdersWorkFlow(OrderOperations oops)
 {
     _oops = oops;
     _errorResponse = new ErrorResponse();
 }
Ejemplo n.º 11
0
 public EditOrderWorkFlow(OrderOperations oops)
 {
     _orderToEdit = new Order();
     _errorResponse = new ErrorResponse();
     _oops = oops;
 }
Ejemplo n.º 12
0
        public void Setup()
        {
            ops = new OrderOperations();

            projectMode = ConfigurationManager.AppSettings["mode"];

            orders = new string[]
            {
             "1,\"Wise\",OH,6.25,WOOD,100.00,5.15,4.75,515.00,475.00,61.88,1051.88",
            "2,\"Ward\",MI,5.75,CARPET,250.24,2.25,2.10,563.0400,525.5040,62.59128000,1151.13528000",
            "3,\"Wise, Eric\",PA,6.75,LAMINATE,0.75,1.75,2.10,1.3125,1.5750,0.19490625,3.08240625",
            "4,\"Ward, Eric\",IN,6.00,TILE,345.12,3.50,4.15,1207.9200,1432.2480,158.410080,2798.578080",
            "5,\"James, LeBron\",OH,6.25,TILE,150.54,3.50,4.15,526.8900,624.7410,71.97693750,1223.60793750"
            };

            createdOrders = new string[1]
            {
                "5,\"James, LeBron\",OH,6.25,TILE,150.54,3.50,4.15,526.8900,624.7410,71.97693750,1223.60793750"
            };

            editedOrders = new string[5]
            {
                "1,\"Wise\",OH,6.25,WOOD,100.00,5.15,4.75,515.00,475.00,61.88,1051.88",
                "2,\"Ward\",MI,5.75,CARPET,250.24,2.25,2.10,563.0400,525.5040,62.59128000,1151.13528000",
                "3,\"Wise, Eric\",PA,6.75,LAMINATE,0.75,1.75,2.10,1.3125,1.5750,0.19490625,3.08240625",
                "4,\"Jones, Bob\",MI,5.75,LAMINATE,500.56,1.75,2.10,875.9800,1051.1760,110.81147000,2037.96747000",
                "5,\"James, LeBron\",OH,6.25,TILE,150.54,3.50,4.15,526.8900,624.7410,71.97693750,1223.60793750"
            };

            allOrders = new string[4]
            {
                "1,\"Wise\",OH,6.25,WOOD,100.00,5.15,4.75,515.00,475.00,61.88,1051.88",
                "2,\"Ward\",MI,5.75,CARPET,250.24,2.25,2.10,563.0400,525.5040,62.59128000,1151.13528000",
                "3,\"Wise, Eric\",PA,6.75,LAMINATE,0.75,1.75,2.10,1.3125,1.5750,0.19490625,3.08240625",
                "4,\"Ward, Eric\",IN,6.00,TILE,345.12,3.50,4.15,1207.9200,1432.2480,158.410080,2798.578080",
            };
        }
Ejemplo n.º 13
0
 public RemoveOrderWorkFlow(OrderOperations oops)
 {
     _orderToRemove = new Order();
     _oops = oops;
     _errorResponse = new ErrorResponse();
 }