コード例 #1
0
    protected void CategoryFilter_Click(object sender, EventArgs e)
    {
        LinkButton linkBtn = (LinkButton)sender;

        CurrentCategoryId.Text = linkBtn.CommandArgument;
        string catDescription = (linkBtn.Parent.FindControl("DescriptionLabel") as Label).Text;

        catFilterType.Text = catDescription;
        if (Request.IsAuthenticated)
        {
            var loggedInGridview = (GridView)ProductsLoggedIn.FindControl("ProductListByCatLoged");
            loggedInGridview.DataBind();
        }
        DisplayCurrentCartQty();
    }
コード例 #2
0
    protected void AddToCartBtn_Click(object sender, EventArgs e)
    {
        LinkButton  linkBtn   = (LinkButton)sender;
        string      username  = User.Identity.Name;
        GridViewRow grdrow    = (GridViewRow)((LinkButton)sender).NamingContainer;
        int         productid = int.Parse(linkBtn.CommandArgument.ToString());
        int         quantity  = int.Parse((grdrow.Cells[2].FindControl("AddQtyValue") as TextBox).Text);

        MessageUserControl.TryRun(() =>
        {
            ShoppingCartItemController sysmgr = new ShoppingCartItemController();
            sysmgr.Add_Product_To_ShoppingCart(username, productid, quantity);
            var loggedInGridview = (GridView)ProductsLoggedIn.FindControl("ProductListByCatLoged");
            loggedInGridview.DataBind();
            DisplayCurrentCartQty();
        }, "Added Product", "Product added to shopping cart!");
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.IsAuthenticated)
        {
            string currentUser = User.Identity.Name;
            OnlineCustomerController custmgr = new OnlineCustomerController();
            custmgr.Add_New_OnlineCustomer(currentUser);
            DisplayCurrentCartQty();
            CurrentLoggedInUser.Text = User.Identity.Name;

            if (!Page.IsPostBack)
            {
                var loggedInGridview = (GridView)ProductsLoggedIn.FindControl("ProductListByCatLoged");
                loggedInGridview.DataBind();
            }
        }
    }