Esempio n. 1
0
        protected void stockList_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            ShoppingCartList.Visible = true;
            totalLabel.Visible       = true;
            TotalbuttonLabel.Visible = true;

            string username = User.Identity.Name;
            int    itemid   = int.Parse(e.CommandArgument.ToString());
            int    employeeid;

            MessageUserControl.TryRun(() =>
            {
                //connect to your BLL
                ApplicationUserManager secmgr = new ApplicationUserManager(new UserStore <ApplicationUser>(new ApplicationDbContext()));
                EmployeeInfo info             = secmgr.User_GetEmployee(username);
                employeeid   = info.EmployeeID;
                int quantity = int.Parse((e.Item.FindControl("QuantityLabel") as TextBox).Text);
                ShoppingCartItemController sysmgr = new ShoppingCartItemController();
                sysmgr.Add_AddToCart(employeeid, itemid, quantity);//Need to put the quantity in the list!!!!!

                List <UserShoppingCartItem> infos = sysmgr.List_ItemsForShoppingCart(employeeid);
                notificationIcon.Style.Remove("visibility");
                //TotalButton.InnerText = (e.Item.FindControl("Total") as Label).ToString();
                ShoppingCartList.DataSource = infos;
                notificationIcon.Value      = infos.Count.ToString();
                ShoppingCartList.DataBind();

                refresh_totallabel();
            }, "Shopping Items Added", $"The item has been addded, you have currently {notificationIcon.Value} items in the shopping cart");
        }