Exemplo n.º 1
0
        public void Start()
        {
            do
            {
                Cart            cart = cartServices.GetCartByCustId(customer.Id);
                List <CartItem> ci   = cartItemServices.GetAllCartItemsByCartId(cart.Id);
                Console.WriteLine("These are the items in your cart");
                foreach (CartItem item in ci)
                {
                    Sticks stick = productServices.GetProductByStickId(item.stickId);
                    Console.WriteLine($"{stick.description} \t${stick.Price}");
                }
                Console.WriteLine("Welcome to check out! If there is anything you forget go back otherwise proceed to checkout. Thank you for Shopping with us.");
                Console.WriteLine("[0] Back \n[2] Checkout");
                custInput = Console.ReadLine();
                switch (custInput)
                {
                case "0":
                    break;

                case "2":
                    CheckOutItems();
                    break;

                default:
                    ValidInvalidServices.InvalidInput();
                    break;
                }
            } while (!(custInput.Equals("0")));
        }
        public void Start()
        {
            do
            {
                Console.WriteLine("Please select one of the options below: ");
                Console.WriteLine("[0] Exit \n[1] View Order History \n[2] Browse Products \n[3] View Cart");
                custInpt = Console.ReadLine();
                switch (custInpt)
                {
                case "0":
                    break;

                case "1":
                    orderHistoryMenu.Start();
                    break;

                case "2":
                    productDetails.Start();
                    break;

                case "3":
                    checkout.Start();
                    break;

                default:
                    Console.WriteLine("oops");
                    ValidInvalidServices.InvalidInput();
                    break;
                }
            } while (!(custInpt.Equals("0")));
        }
        public void Start()
        {
            do
            {
                Console.WriteLine("Welcome to your order history, please select one of the options below: ");
                Console.WriteLine("[0] Go back \n[1] Sort By Date Asc \n[2] Sort By Date Desc \n[3] Sort By Price Asc \n[4] Sort By Price Desc");

                custInput = Console.ReadLine();
                switch (custInput)
                {
                case "0":
                    break;

                case "1":
                    GetOrdersByDateAsc();
                    break;

                case "2":
                    GetOrdersByDateDesc();
                    break;

                case "3":
                    GetOrdersByPriceAsc();
                    break;

                case "4":
                    GetOrdersByPriceDesc();
                    break;

                default:
                    ValidInvalidServices.InvalidInput();
                    break;
                }
            } while (!(custInput.Equals("0")));
        }
Exemplo n.º 4
0
        public void Start()
        {
            do
            {
                Console.WriteLine("Welcome manager, follow the steps below to replenish the stock.");

                Console.WriteLine("Select a location to replenish inventory at:");
                Console.WriteLine("[0] Exit \n[1] Location 1 \n[2] Location 2 \n[3] Location 3");

                manInput    = Console.ReadLine();
                selectedLoc = Int32.Parse(manInput);
                switch (manInput)
                {
                case "0":
                    break;

                case "1":
                    ManageInventory(1);
                    break;

                case "2":
                    ManageInventory(2);
                    break;

                case "3":
                    ManageInventory(3);
                    break;

                default:
                    Console.WriteLine("oops");
                    ValidInvalidServices.InvalidInput();
                    break;
                }
            } while (!(manInput.Equals("0")));
        }
Exemplo n.º 5
0
        public Customer CustomerValidation()
        {
            string filepath = "../lacrosseDB/DBFiles/Customer.txt";

            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .WriteTo.File(filepath, rollingInterval: RollingInterval.Day)
                         .CreateLogger();

            string   email;
            Customer cust = new Customer();

            Console.WriteLine("Enter email");
            email = Console.ReadLine();
            try
            {
                cust = customerServices.GetCustomerByEmail(email);
                if (cust.email != email)
                {
                    throw new System.ArgumentException();
                }
                else
                {
                    customer = cust;
                    Log.Information($"{cust.email} has signed in");
                    CustMenu custMenu = new CustMenu(customer, context);
                    try
                    {
                        cartServices.DeleteCart(cartServices.GetCartByCustId(customer.Id));
                    }
                    catch (InvalidOperationException) { }
                    finally
                    {
                        Cart newCart = new Cart();
                        newCart.custId = customer.Id;
                        cartServices.AddCart(newCart);
                        custMenu.Start();
                    }
                }
            }
            catch (ArgumentException)
            {
                Log.Information($"Customer {cust.email} tried and failed to login.");
                ValidInvalidServices.InvalidInput();
            }
            catch (InvalidOperationException)
            {
                Log.Information($"Customer tried to sign into an account the DNE.");
                ValidInvalidServices.InvalidInput();
            }
            return(cust);
        }
Exemplo n.º 6
0
        public Manager ManagerValidation()
        {
            string filepath = "../lacrosseDB/DBFiles/Manager.txt";

            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .WriteTo.File(filepath, rollingInterval: RollingInterval.Day)
                         .CreateLogger();

            List <Manager> print = managerServices.GetAllManagers();

            Console.WriteLine("Managers:");
            foreach (Manager m in print)
            {
                managerServices.GetManagerByManId(m.Id);
                Console.WriteLine($"{m.FirstName} ");
            }

            string  email;
            Manager man = new Manager();

            Console.WriteLine("Enter email");
            email = Console.ReadLine();
            try
            {
                man = managerServices.GetManagerByEmail(email);
                if (man.email != email)
                {
                    throw new System.ArgumentException();
                }
                else
                {
                    manager = man;
                    Log.Information($"{man.email} has signed in");
                    ManagerLogin manLogin = new ManagerLogin(man, context, new DBRepo(context), new DBRepo(context));
                    manLogin.Start();
                }
            }
            catch (ArgumentException)
            {
                Log.Information($"Manager {man.email} tried and failed to login.");
                ValidInvalidServices.InvalidInput();
            }
            catch (InvalidOperationException)
            {
                Log.Information($"Manager tried to sign into an account the DNE.");
                ValidInvalidServices.InvalidInput();
            }
            return(man);
        }
Exemplo n.º 7
0
        public Customer NewCustomerValidation()
        {
            string          NewLoc;
            List <Customer> custs = customerServices.GetAllCustomers();
            Customer        cust  = new Customer();

            do
            {
                Console.WriteLine("Enter First Name: ");
                cust.FirstName = Console.ReadLine();
                Console.WriteLine("Enter Last Name: ");
                cust.LastName = Console.ReadLine();
                Console.WriteLine("Enter email: ");
                cust.email = Console.ReadLine();
            } while (ValidInvalidServices.ValidEmail(cust.email) == false && validInvalidServices.IsUniqueEmail(cust.email, custs) == false);
            Boolean keepRunning = true;

            do
            {
                Console.WriteLine("Choose from the follow locations: ");
                Console.WriteLine("[1] Location 1 \n[2] Location 2 \n[3] Location 3");
                NewLoc = Console.ReadLine();
                switch (NewLoc)
                {
                case "1":
                    cust.LocationId = 1;
                    keepRunning     = false;
                    break;

                case "2":
                    cust.LocationId = 2;
                    keepRunning     = false;
                    break;

                case "3":
                    cust.LocationId = 3;
                    keepRunning     = false;
                    break;

                default:
                    ValidInvalidServices.InvalidInput();
                    break;
                }
            } while (keepRunning);
            Console.WriteLine("New Customer Created");
            return(cust);
        }
 public IActionResult ManSignUp(Manager manager)
 {
     try
     {
         List <Manager> man = managerServices.GetAllManagers();
         if (ValidInvalidServices.ValidEmail(manager.email) == false && validInvalidServices.IsUniqueEmail(manager.email, man) == false)
         {
             return(StatusCode(409));
         }
         managerServices.AddManager(manager);
         return(Ok());
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
        public void Start()
        {
            do
            {
                Console.WriteLine("Select From Our Lacrosse Sticks Below: ");
                List <Inventory> items = GetProductsForCustomerLocation();
                Console.WriteLine("[0] Exit");
                foreach (Inventory item in items)
                {
                    Sticks product = productServices.GetProductByStickId(item.stickId);
                    Console.WriteLine($"[{product.Id}]: {product.description}, ${product.Price}, remaining: {item.quantity}");
                }

                custInput = Console.ReadLine();
                switch (custInput)
                {
                case "0":
                    break;

                case "1":
                    sticks          = productServices.GetProductByStickId(1);
                    productDetails2 = new ProductDetails2(customer, sticks, context, new DBRepo(context), new DBRepo(context), new DBRepo(context), new DBRepo(context), new DBRepo(context));
                    productDetails2.Start();
                    break;

                case "2":
                    sticks          = productServices.GetProductByStickId(2);
                    productDetails2 = new ProductDetails2(customer, sticks, context, new DBRepo(context), new DBRepo(context), new DBRepo(context), new DBRepo(context), new DBRepo(context));
                    productDetails2.Start();
                    break;

                case "3":
                    sticks          = productServices.GetProductByStickId(3);
                    productDetails2 = new ProductDetails2(customer, sticks, context, new DBRepo(context), new DBRepo(context), new DBRepo(context), new DBRepo(context), new DBRepo(context));
                    productDetails2.Start();
                    break;

                default:
                    Console.WriteLine("oppps");
                    ValidInvalidServices.InvalidInput();
                    break;
                }
            } while (!(custInput.Equals("0")));
        }
Exemplo n.º 10
0
        public void Start()
        {
            do
            {
                Inventory selected = inventoryServices.GetItemByLocIdStickId(customer.LocationId, stick.Id);
                inventoryQuantity = selected.quantity;

                Console.WriteLine("The item you have selected: ");
                Console.WriteLine($"{stick.description} \t${stick.Price}");

                Console.WriteLine("Would you like to add this item to cart?");
                Console.WriteLine("[0] No \n[1] Yes");
                custInput = Console.ReadLine();
                switch (custInput)
                {
                case "0":
                    break;

                case "1":
                    int quantity;

                    do
                    {
                        Console.WriteLine("How many would you like of this item?");
                        quantity = Int32.Parse(Console.ReadLine());
                    } while (ValidInvalidServices.InvalidQuanityOfItems(inventoryQuantity, quantity) == false);
                    CartItem ci       = new CartItem();
                    Cart     custCart = cartServices.GetCartByCustId(customer.Id);
                    ci.cartId   = custCart.Id;
                    ci.stickId  = stick.Id;
                    ci.quantity = quantity;
                    cartItemServices.AddCartItem(ci);
                    Console.WriteLine("Your item has been added to your cart");
                    break;

                default:
                    ValidInvalidServices.InvalidInput();
                    break;
                }
            } while (!(custInput.Equals("1")));
        }
 public IActionResult CustSignUp(Customer customer)
 {
     try
     {
         List <Customer> custs = customerServices.GetAllCustomers();
         if (ValidInvalidServices.ValidEmail(customer.email) == false && validInvalidServices.IsUniqueEmail(customer.email, custs) == false)
         {
             return(StatusCode(409));
         }
         customerServices.AddCustomer(customer);
         Customer newCust = customerServices.GetCustomerByEmail(customer.email);
         Cart     cart    = new Cart();
         cart.custId = newCust.Id;
         cartServices.AddCart(cart);
         return(Ok());
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
Exemplo n.º 12
0
        public void ManageInventory(int locationId)
        {
            do
            {
                Console.WriteLine("Select which item to replenish by selecting the number in brackets.");
                List <Inventory> items = GetProductsByLocation(locationId);
                Console.WriteLine("[0] Back");

                foreach (Inventory item in items)
                {
                    Sticks product = productServices.GetProductByStickId(item.stickId);
                    Console.WriteLine($"[{product.Id}] {product.description}, remaining: {item.quantity}");
                }
                manInput2 = Console.ReadLine();
                switch (manInput2)
                {
                case "0":
                    break;

                case "1":
                    updateStock(1);
                    break;

                case "2":
                    updateStock(2);
                    break;

                case "3":
                    updateStock(3);
                    break;

                default:
                    Console.WriteLine("oops");
                    ValidInvalidServices.InvalidInput();
                    break;
                }
            } while(!(manInput2.Equals("0")));
        }
Exemplo n.º 13
0
        /// <summary>
        /// Here start() allows the shopper/employee to be directed to the correct domain of the shop
        /// </summary>
        public void Start()
        {
            do
            {
                Console.WriteLine("Welcome to Lacrosse101, a store for all your lacrosse needs!");
                Console.WriteLine("Please choose one of the options below by typing the correspoing number.");
                Console.WriteLine("[0] Exit the Store \n[1] New Shopper \n[2] Store Manager \n[3] Returning Shopper Shop Equipment Here");
                shoperInput = Console.ReadLine();
                switch (shoperInput)
                {
                case "3":
                    Console.WriteLine("Welcome Shopper!");
                    Customer cust = CustomerValidation();
                    break;

                case "1":
                    Customer newCust = NewCustomerValidation();
                    customerServices.AddCustomer(newCust);
                    break;

                case "2":
                    Console.WriteLine("Welcome Manager!");
                    Manager man = ManagerValidation();
                    break;

                case "0":
                    Console.WriteLine("Goodbye!");
                    // this line will exit the current session
                    Environment.Exit(0);
                    break;

                default:
                    ValidInvalidServices.InvalidInput();
                    break;
                }
            } while (!shoperInput.Equals("3"));
        }