public void BindShoppingCart() { BPShoppingCartDetails bpDetails = new BPShoppingCartDetails(); if (CustomerID != 0) { BPShoppingCarts bpCart = new BPShoppingCarts(); DSShoppingCarts = bpCart.SelectByCustomerID (CustomerID); DSShoppingCarts.Merge(bpDetails.SelectAllByCustomerID(CustomerID)); } else { DSShoppingCarts = bpDetails.SelectAllByCartID(CartID); } rptProductsList.DataBind (); }
public decimal GetShippingSurcharge(int cartID) { decimal surcharge = 0; BPShoppingCartDetails bp = new BPShoppingCartDetails(); BEShoppingCarts dsDetails = new BEShoppingCarts(); dsDetails = bp.SelectAllByCartID(cartID); foreach (BEShoppingCarts.tbl_ShoppingCartDetailsRow dr in dsDetails.tbl_ShoppingCartDetails.Rows) { if (!dr.IsProductShippingSurchargeNull()) surcharge += (dr.ProductShippingSurcharge * dr.ShoppingCartDetailQuantity); } return surcharge; }
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(); }
public void BindShoppingCart() { BPShoppingCartDetails bpDetails = new BPShoppingCartDetails(); if (CustomerID != 0) { int ShippingMethodID, ShippingRegionID; BPShoppingCarts bpCart = new BPShoppingCarts(); DSShoppingCarts = bpCart.SelectByCustomerID (CustomerID); if (DSShoppingCarts.tbl_ShoppingCarts.Count > 0) { ShippingMethodID = DSShoppingCarts.tbl_ShoppingCarts[0].ShippingMethodID; ShippingRegionID = DSShoppingCarts.tbl_ShoppingCarts[0].ShippingRegionID; ShippingCost = GetShippingCost(ShippingMethodID, ShippingRegionID); } DSShoppingCarts.Merge(bpDetails.SelectAllByCustomerID(CustomerID)); } else { DSShoppingCarts = bpDetails.SelectAllByCartID(CartID); } rptProductsList.DataBind (); }