public void CreateCustomer() { Console.Clear(); AsciiHeader.AsciiHead(); Customer newCustomer = new Customer(); Console.WriteLine("Enter Customer First Name: "); newCustomer.FName = Console.ReadLine(); Console.WriteLine("Enter Customer Last Name: "); newCustomer.LName = Console.ReadLine(); Console.WriteLine("Create a username for the customer: "); newCustomer.Username = Console.ReadLine(); Console.WriteLine("Set Customer Account Default Password: "******"Customer {newCustomer.FName} {newCustomer.LName} created successfully!"); Log.Information("New customer added to database"); Console.WriteLine("Press enter to return to the managerial portal."); Console.ReadLine(); Console.Clear(); }
//could create a facade that's an interface that inherits f public void Start() { Boolean stay = true; do { Console.Clear(); AsciiHeader.AsciiHead(); Console.WriteLine("Welcome to the SineShop Managerial application! Please proceed to the Managerial menu."); Console.WriteLine("[0] Manager Menu"); //Console.WriteLine("[1] Customer"); Console.WriteLine("[1] Exit Program"); String userInput = Console.ReadLine(); switch (userInput) { case "0": stay = false; managerMenu.Start(); break; case "1": System.Environment.Exit(0); //client menu stuff break; default: Console.WriteLine("Not a valid menu option!"); break; } } while (stay); }
public void AddInventory() { Console.Clear(); AsciiHeader.AsciiHead(); Location trackedLocation = new Location(); Inventory newInventory = new Inventory(); Product newProduct = new Product(); Console.WriteLine("Please enter the appropriate information to update a store's inventory"); Console.WriteLine("Enter Location Name: "); trackedLocation = _locationBL.FilterLocationByName(Console.ReadLine()); if (trackedLocation.LocationID == 0) { Console.WriteLine("That's not a location Name :( please try again!"); Console.WriteLine("Press Enter to Continue."); Console.ReadLine(); return; } else { newInventory.InventoryLocation = trackedLocation.LocationID; } Console.WriteLine("Create a name for your inventory: "); newInventory.InventoryName = Console.ReadLine(); Console.WriteLine("Please enter a product name to store in this inventory: "); newProduct = _productBL.GetFilteredProduct(Console.ReadLine()); if (newProduct.ProductName == null) { Console.WriteLine("This product does not exist in our system. Please try again :("); return; } newInventory.ProductID = newProduct.ProductID; Console.WriteLine($"how many {newProduct.ProductName} items should be added to this inventory?"); newInventory.ProductQuantity = Int32.Parse(Console.ReadLine()); Console.WriteLine($"Great! the {trackedLocation.LocationName} location has been updated with an inventory of {newInventory.ProductQuantity} {newProduct.ProductName}"); _inventoryBL.AddInventory(newInventory); Console.WriteLine("Inventory update successful! Press enter to continue."); Log.Information($"Inventory at the {trackedLocation.LocationName} location has been updated with {newInventory.ProductQuantity} {newProduct.ProductName}s"); Console.ReadLine(); Console.Clear(); //Console.WriteLine(newInventory.InventoryLocation); }
public void Start() { Console.Clear(); AsciiHeader.AsciiHead(); Boolean stay = true; Console.WriteLine("Welcome to the order search system!"); do { Console.WriteLine("Enter an order ID to view details about a specific order."); Console.WriteLine("Type in \"all\" to view a list of all orders."); //IMPLEMENT THESE SORTING FUNCTIONS!!!!! Console.WriteLine("Type in \"newest\" to see the ten newest orders sorted by newest to oldest."); Console.WriteLine("Type in \"oldest\" to see the ten oldest orders sorted by oldest to newest."); //Console.WriteLine("Type in \"high price\" to see orders sorted by highest cost to lowest"); //Console.WriteLine("Type in \"low price\" to see orders sorted by lowest cost to highest"); Console.WriteLine("Type in \"exit\" to return to the manager menu."); String userInput = Console.ReadLine(); switch (userInput) { case "exit": //return to manager menu - value "true" should still be assigned to manager menu loop. stay = false; Console.Clear(); break; case "all": //return a list of all customers - BUILD IN METHOD TO INTERACT WITH BL GetAllOrders(); break; case "newest": SortOrdersByNewest(); break; case "oldest": SortOrdersByOldest(); break; //case "high price": //SortOrdersByHighPrice(); //break; default: //return specified string values of names retrieved from DB GetSearchedOrders(userInput); break; } } while (stay); }
public void StartUpdateInventories() { Console.Clear(); AsciiHeader.AsciiHead(); Boolean stay = true; Console.WriteLine("Welcome to the inventory update system!"); do { Console.WriteLine("Enter an inventory name, product name, or location name to view a list of inventories associated with that name"); Console.WriteLine("Once a single inventory is found, we will prompt for quantity update."); Console.WriteLine("Type in \"all\" to view a list of all inventories across all locations"); Console.WriteLine("Type in \"exit\" to return to the manager menu."); String userInput = Console.ReadLine(); switch (userInput) { case "exit": //return to manager menu - value "true" should still be assigned to manager menu loop. stay = false; Console.Clear(); break; case "all": //return a list of all customers - BUILD IN METHOD TO INTERACT WITH BL GetAllInventories(); break; default: GetSearchedInventoriesForUpdate(userInput); //return specified string values of store inventories //GetSearchedStoreInventories(userInput); break; } } while (stay); }
public void Start() { Console.Clear(); AsciiHeader.AsciiHead(); Boolean stay = true; Console.WriteLine("Welcome to customer search!"); do { Console.WriteLine("Enter a customer first name, last name, or ID to view details about a specific customer."); Console.WriteLine("Type in \"all\" to view a list of all customers"); Console.WriteLine("Type in \"exit\" to return to the manager menu."); String userInput = Console.ReadLine(); switch (userInput) { case "exit": //return to manager menu - value "true" should still be assigned to manager menu loop. stay = false; Console.Clear(); break; case "all": //return a list of all customers - BUILD IN METHOD TO INTERACT WITH BL GetAllCustomers(); break; default: //return specified string values of names retrieved from DB GetSearchedCustomers(userInput); break; } } while (stay); }
public void Start(Location location, int cartID, List <Inventory> inventories) { Console.Clear(); AsciiHeader.AsciiHead(); Boolean stay = true; do { Console.WriteLine("Enter a product name, or manufacturer to filter the list of products!."); Console.WriteLine("Once you find a product, specify quantity and confirm if you would like to add that product to the order."); Console.WriteLine("Type in \"all\" to view a list of all products"); Console.WriteLine("Type in \"exit\" to finish the product ordering process."); String userInput = Console.ReadLine(); switch (userInput) { case "exit": //return to manager menu - value "true" should still be assigned to manager menu loop. //we will process the cartproduct list here adn return?? stay = false; break; case "all": //return a list of all products GetAllProducts(); break; default: GetFilteredProductsForProcessing(userInput, cartID, inventories, location); break; } } while (stay); }
public void AddProduct() { Console.Clear(); AsciiHeader.AsciiHead(); Product newProduct = new Product(); //newProduct.ProductID = _productBL.GenerateID(); Console.WriteLine("Enter new Product Name:"); newProduct.ProductName = Console.ReadLine(); Console.WriteLine("Enter new Product Description:"); newProduct.ProductDescription = Console.ReadLine(); Console.WriteLine("Enter product manufacturer: "); newProduct.Manufacturer = Console.ReadLine(); Console.WriteLine("Enter Product Price"); newProduct.ProductPrice = Decimal.Parse(Console.ReadLine()); _productBL.AddProduct(newProduct); Console.WriteLine($"Product {newProduct.ProductName} created successfully!"); Log.Information("New Product added to system"); Console.WriteLine("Press enter to continue."); Console.ReadLine(); }
public void Start() { Console.Clear(); Log.Information("Manager menu accessed"); Boolean stay = true; do { AsciiHeader.AsciiHead(); Console.WriteLine("Welcome, manager!"); Console.WriteLine("What would you like to do?"); Console.WriteLine("[0] Add a new Customer"); Console.WriteLine("[1] Search for Customers"); Console.WriteLine("[2] Add Inventory to Store"); Console.WriteLine("[3] Update an existing Inventory"); Console.WriteLine("[4] Review Orders"); Console.WriteLine("[5] Review Inventory"); Console.WriteLine("[6] Review Products"); Console.WriteLine("[7] Add new Product"); Console.WriteLine("[8] Place order for Customer"); Console.WriteLine("[9] Exit"); String userInput = Console.ReadLine(); switch (userInput) { case "0": try { //BL Call - create customer - WORKING :) //still need to implement automatic customer ID assignment CreateCustomer(); } catch (Exception ex) { Log.Error(ex, "Something went wrong creating a customer"); Console.WriteLine("Invalid Input"); continue; } break; case "1": customerSearch.Start(); break; case "2": //BL Call - add inventory to store AddInventory(); break; case "3": //UPDATE EXISTING INVENTORY //******************************* inventorySearch.StartUpdateInventories(); break; case "4": //review orders // menu call - take to orders menu orderSearch.Start(); break; case "5": //review inventory // menu call - take to inventory menu inventorySearch.Start(); break; case "6": //search products productSearch.Start(); break; case "7": //add new product AddProduct(); break; case "8": PlaceOrder(); break; case "9": //exit program Console.Clear(); System.Environment.Exit(0); break; default: Console.WriteLine("Not a valid menu option!"); Console.WriteLine("Press enter to continue."); Console.ReadLine(); Console.Clear(); break; } } while (stay); }
public void PlaceOrder() { Console.Clear(); AsciiHeader.AsciiHead(); Customer customer = new Customer(); customerSearch.Start(customer); //we have the customer //we need the location next Boolean stay = true; Location location = new Location(); while (stay) { Console.Clear(); AsciiHeader.AsciiHead(); Console.WriteLine("Please select customer store location"); Console.WriteLine("[0] Tampa"); Console.WriteLine("[1] Orlando"); string userInput = Console.ReadLine(); switch (userInput) { case "0": location = _locationBL.GetSpecifiedLocation(20000); stay = false; break; case "1": location = _locationBL.GetSpecifiedLocation(20001); stay = false; break; default: Console.WriteLine("Not a valid menu option!"); break; } //Console.WriteLine(location); } Cart cart = new Cart(); //Console.WriteLine(customer); //now, with both a customer and location, we can create a cart OR call a cart //if the customer's cart already exists, it will use that cart try { cart = _cartBL.FindCart(customer.CustomerID); } catch (Exception ex) { Log.Error(ex, "Something went wrong"); } //before we start assigning products to carts, we need to know our inventory ID list to pass into the product search List <Inventory> inventories = _inventoryBL.GetInventory(); List <Inventory> specificInventories = new List <Inventory>(); foreach (Inventory i in inventories) { if (i.InventoryLocation == location.LocationID) { specificInventories.Add(i); } } //THIS is where we would want to call our product search menu // we want to basically run this, then on complete, create a new cartproduct object // we can check against inventory amount here!!! try { productSearch.Start(location, cart.CartID, inventories); } catch (System.ArgumentOutOfRangeException ex) { Log.Error(ex, "Someone tried to order a product that didn't exist"); Console.WriteLine("Sorry, the requested product does not exist at your location.\nPlease try again."); Console.WriteLine("Press enter to continue"); Console.ReadLine(); productSearch.Start(location, cart.CartID, inventories); } List <CartProducts> cartProducts = _cartProductsBL.FindCartProducts(cart.CartID); decimal costTotal = 0; LineSeparator line = new LineSeparator(); Console.WriteLine("Please confirm your order for processing:"); Console.WriteLine("Products Ordered:"); foreach (CartProducts x in cartProducts) { Product currentProduct = _productBL.GetProductByID(x.ProductID); decimal currentProductCost = currentProduct.ProductPrice.Value * x.ProductCount.Value; costTotal = costTotal + currentProductCost; line.LineSeparate(); Console.WriteLine($"| Product Name: {currentProduct.ProductName} | Product Quantity: {x.ProductCount} | Individual Product Cost: {currentProductCost}"); line.LineSeparate(); } line.LineSeparate(); Console.WriteLine($"| Total Cost: {costTotal}"); Console.WriteLine("Is this order accurate?"); Console.WriteLine("[0] Yes"); Console.WriteLine("[1] No"); string confirmationInput; confirmationInput = Console.ReadLine(); bool stayConfirm = true; bool processOrder = true; while (stayConfirm) { switch (confirmationInput) { case "0": Console.WriteLine("Fantastic! Please press enter to begin order processing."); Console.ReadLine(); processOrder = true; stayConfirm = false; break; case "1": Console.WriteLine("Okay, please update your order as necessary and return to this confirmation page."); Console.WriteLine("Please press enter."); Console.ReadLine(); processOrder = false; stayConfirm = false; break; default: Console.WriteLine("Not a valid menu option!"); break; } } if (processOrder == true) { //time to process the order Order finalizedOrder = new Order(); finalizedOrder.CartID = cart.CartID; finalizedOrder.Customer = customer; finalizedOrder.CustomerID = customer.CustomerID; finalizedOrder.LocationID = location.LocationID; finalizedOrder.OrderDate = DateTime.Now; _orderBL.AddOrder(finalizedOrder); //we will need to retrieve the order that was just added for it's ID! //this will let us process what items were included in the order Order orderForItemsProcessing = _orderBL.GetSpecifiedOrder(finalizedOrder.OrderDate); //create a new order item list List <OrderItem> orderItems = new List <OrderItem>(); //add each new orderItem to our database foreach (CartProducts p in cartProducts) { OrderItem orderProcessing = new OrderItem { OrderItemsQuantity = p.ProductCount, OrderID = orderForItemsProcessing.OrderID, productID = p.ProductID, }; _orderItemsBL.AddOrderItem(orderProcessing); } //flush the cart once the order is complete. foreach (CartProducts cartprod in cartProducts) { _cartProductsBL.RemoveCartProducts(cartprod); } Log.Information("Order placed successfully"); Console.WriteLine("Order placed successfully!"); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); } //we now have EVERYTHING ready (I think) //List<OrderItem> orderItemsToConfirm = _orderItemsBL.GetOrderItems(orderForItemsProcessing.OrderID); //now that we have a cart, we need to find products //then add them to a new cartproducts table so the cart //can reference them //we will call cartproduct BL to create a new cartproduct //every time something is added to the inventory. //then, we can return a list of cartproducts after? //then create an order when products/total are ready! }