private void rptProductsList_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Remove") { BEShoppingCarts details = new BEShoppingCarts(); BPShoppingCartDetails bp = new BPShoppingCartDetails(); details = bp.SelectAllByCartIDAndProductID(CartID,Convert.ToInt32(((HtmlInputControl)e.Item.FindControl("hdnProductID")).Value)); details.tbl_ShoppingCartDetails.Rows[0].Delete(); bp.Update(details); } BindShoppingCart(); }
private void btnUpdate_Click(object sender, System.EventArgs e) { BEShoppingCarts details = new BEShoppingCarts(); BPShoppingCartDetails bp = new BPShoppingCartDetails(); if (CustomerID == 0) { details = bp.SelectAllByCartID(CartID); }else { details = bp.SelectAllByCustomerID(CustomerID); } int quantity; for (int i=0; i < rptProductsList.Items.Count; i++) { if (!IsNumeric(((TextBox)rptProductsList.Items[i].FindControl("txtShoppingCartDetailQuantity")).Text)) { ((TextBox)rptProductsList.Items[i].FindControl("txtShoppingCartDetailQuantity")).Text = "0"; } quantity = Convert.ToInt32(((TextBox)rptProductsList.Items[i].FindControl("txtShoppingCartDetailQuantity")).Text); if (quantity != details.tbl_ShoppingCartDetails[i].ShoppingCartDetailQuantity) { details.tbl_ShoppingCartDetails[i].ShoppingCartDetailQuantity = quantity; } } bp.Update(details); BindShoppingCart(); }