protected void DeleteItemBtn_Click(object sender, EventArgs e) { LinkButton cmdBtn = (LinkButton)sender; int shoppingcartitemid = int.Parse(cmdBtn.CommandArgument); MessageUserControl.TryRun(() => { ShoppingCartController sysmgr = new ShoppingCartController(); sysmgr.DeleteItemFromCart(User.Identity.Name, shoppingcartitemid); ShoppingCartItemListView.DataBind(); FetchShoppingCartTotal(); DisplayCurrentCartQty(); if (!CheckForItemsInCart()) { checkoutBtn.HRef = "~/Pages/Sales/PartsCatalog.aspx"; } }, "Removal Successful", "Part was successfully removed form your shopping cart"); }
protected void UpdateQty_Click(object sender, EventArgs e) { LinkButton cmdBtn = (LinkButton)sender; string direction = cmdBtn.CommandArgument.ToString(); int partid = int.Parse((cmdBtn.Parent.FindControl("ProductIdLabel") as Label).Text); MessageUserControl.TryRun(() => { ShoppingCartController sysmgr = new ShoppingCartController(); sysmgr.ChangeQtyOfPart(User.Identity.Name, partid, direction); ShoppingCartItemListView.DataBind(); FetchShoppingCartTotal(); DisplayCurrentCartQty(); if (!CheckForItemsInCart()) { checkoutBtn.HRef = "~/Pages/Sales/PartsCatalog.aspx"; } }, "Quantity Updated", "Part Quantity has been updated"); }