Example #1
0
        private void startButton_Click(object sender, System.EventArgs e)
        {
            //  create a CartTask object; Task object allow us to package
            //  the Task-Logon correlation code
            CartTask task = new CartTask(Page.User.Identity.Name);

            //  ask UIPManager to Start Task--that is,
            //  Send us to a new NavGraph and initiate a new Task...or use a known Task..in that new NavGraph
            UIPManager.StartNavigationTask("Shopping", task);
        }
Example #2
0
        public void start()
        {
            Console.WriteLine("Select a location!");
            LocationTask    locationtask = new LocationTask(repo);
            List <Location> Location     = locationtask.GetAllLocations();
            CartTask        cartTask     = new CartTask(repo);
            CartItemTask    cartitemtask = new CartItemTask(repo);
            ProductTask     producttask  = new ProductTask(repo);
            Cart            cart         = cartTask.GetCartByCustomer(1);

            count = 1;
            foreach (Location singleLocation in Location)
            {
                Console.WriteLine("[" + count + "]");
                Console.WriteLine(singleLocation.Name);
                count++;
            }
            userInput = Console.ReadLine();
            int           Locationid    = Int32.Parse(userInput);
            InventoryTask inventorytask = new InventoryTask(repo);

            Console.WriteLine("Getting items...");
            List <Inventory> Items        = inventorytask.GetInventoryByLocation(Locationid);
            string           continueloop = "y";

            while (continueloop == "y")
            {
                foreach (Inventory Item in Items)
                {
                    int     id   = Item.ProductId;
                    Product prod = producttask.GetProduct(id);
                    Console.WriteLine("Product ID: " + id);
                    Console.WriteLine("Item Name: " + prod.Name);
                    Console.WriteLine("Cost: " + prod.Cost);
                    Console.WriteLine("Quantity: " + Item.Quantity);
                    Console.WriteLine(" ");
                }

                Console.WriteLine("Select a product (By ID!)");
                userInput = Console.ReadLine();
                Product  chosenproduct = producttask.GetProduct(Int32.Parse(userInput));
                CartItem cartitem      = new CartItem();
                cartitem.ProductId = Int32.Parse(userInput);
                Console.WriteLine("How many do you want to buy?");
                string input = Console.ReadLine();
                cartitem.CartId   = 1;
                cartitem.Quantity = Int32.Parse(input);
                cartitemtask.UpdateCartItem(cartitem);
                Console.WriteLine("Item has been added!");
                Console.WriteLine("Keep adding to cart? (y/n)");
                continueloop = Console.ReadLine();
            }
        }
Example #3
0
        public CartMenu()
        {
            SavvyContext context = new SavvyContext();
            DBMapper     mapper  = new DBMapper();

            this.repo          = new SavvyRepo(context, mapper);
            this.locationtask  = new LocationTask(repo);
            this.inventorytask = new InventoryTask(repo);
            this.producttask   = new ProductTask(repo);
            this.carttask      = new CartTask(repo);
            this.cartitemtask  = new CartItemTask(repo);
            this.ordertask     = new OrderTask(repo);
            this.orderitemtask = new OrderItemTask(repo);
        }
Example #4
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //  create a CartTask object; Task object allow us to package
                //  the Task-Logon correlation code
                CartTask task = new CartTask(Page.User.Identity.Name);

                if (task.Get() == Guid.Empty)
                {
                    startButton.Text = "Start to a new buy process";
                }
                else
                {
                    startButton.Text = "Continue the existing buy process";
                }
            }
        }