Esempio n. 1
0
        public CustomerMenu(ICustomerRepo repo, IMessagingService service)
        {
            this.service = service;

            this.customer = new models.Customer();

            this.customerService = new CustomerService(repo);
        }
Esempio n. 2
0
 /// <summary>
 /// Gets user input for existing Customer
 /// </summary>
 /// <returns></returns>
 public models.Customer SignIn()
 {
     models.Customer customer = new models.Customer();
     Console.Write("\nEnter Your Name: ");
     customer.Name = Console.ReadLine();
     Console.Write("Enter Your Password: ");
     customer.Password = Console.ReadLine();
     return(customer);
 }
Esempio n. 3
0
        public void Start()
        {
            do
            {
                Console.WriteLine("\nWelcome Customer! What would you like to do?");
                Console.WriteLine("[0] Signup?");
                Console.WriteLine("[1] Login?");
                Console.WriteLine("[2] Go back to the main menu?");
                userInput = Console.ReadLine();
                switch (userInput)
                {
                case "0":
                    try{
                        SignUp();
                    } catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        break;
                    }
                    Log.Information("New Customer Created");
                    // Sets customer id
                    customer = customerService.GetCustomer(customer.Name, customer.Password);
                    Log.Information("Moved to Location Menu");
                    locationMenu = new LocationMenu(customer, (ILocationRepo)customerService.repo, new MessagingService());
                    locationMenu.Start();
                    break;

                case "1":
                    //call create a customer, get customer details
                    models.Customer loginCustomer = SignIn();
                    try{
                        customerService.GetCustomer(loginCustomer.Name, loginCustomer.Password);
                    } catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        break;
                    }
                    customer          = customerService.GetCustomer(loginCustomer.Name, loginCustomer.Password);
                    customerOrderMenu = new CustomerOrderMenu(customer, (ICustomerRepo)customerService.repo, new MessagingService());
                    customerOrderMenu.Start();
                    break;

                case "2":
                    //back to main menu message
                    Log.Information("Back to Main Menu");
                    service.BackToMainMenuMessage();
                    break;

                default:
                    //invalid input message;
                    Log.Information($"Invalid Input Customer Menu: {userInput}");
                    service.InvalidInputMessage();
                    break;
                }
            } while (!userInput.Equals("2"));
        }
        public CustomerOrderMenu(models.Customer customer, ICustomerRepo customerRepo, IMessagingService service)
        {
            this.customer = customer;
            this.service  = service;

            this.customerService = new CustomerService(customerRepo);
            this.locationService = new LocationService((ILocationRepo)customerRepo);
            this.orderService    = new OrderService((IOrderRepo)customerRepo);
            this.productService  = new ProductService((IProductRepo)customerRepo);
        }
Esempio n. 5
0
        public LocationMenu(models.Customer customer, ILocationRepo locationRepo, IMessagingService service)
        {
            this.customer = customer;
            this.service  = service;


            this.locationService  = new LocationService(locationRepo);
            this.inventoryService = new InventoryService((IInventoryRepo)locationRepo);
            this.orderService     = new OrderService((IOrderRepo)locationRepo);
            this.productService   = new ProductService((IProductRepo)locationRepo);
            //this.customerService = new CustomerService((ICustomerRepo) locationRepo);
        }