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 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(); }
private void btnLogin_Click(object sender, EventArgs e) { string email = txtEmail.Text.Trim(); string password = txtPassword.Text.Trim(); if(email == "" || password == "") { lblCreateError.Visible = false; lblLoginError.Visible = true; lblLoginError.Text = "Error: Please enter your Email Address and Password"; return; } if (Login(txtEmail.Text, txtPassword.Text)) { Session["LoggedIn"] = true; //ExtendSession = true; if (CartID != 0) { ConvertTempCart(CartID,CustomerID); }else { BEShoppingCarts cartsDS = new BEShoppingCarts(); BPShoppingCarts bp = new BPShoppingCarts(); //BEShoppingCarts.tbl_ShoppingCartsRow cartRow; //cart = bp.SelectByCustomerID(CustomerID).tbl_ShoppingCarts[0]; //bug fix - 25-Mar-08 hs cartsDS = bp.SelectByCustomerID(CustomerID); if(cartsDS.tbl_ShoppingCarts.Count > 0) CartID = cartsDS.tbl_ShoppingCarts[0].ShoppingCartID; } if (Request.QueryString["return"]!=null) { Response.Redirect(Request.QueryString["return"].ToString()); } else { Response.Redirect("CustomerInformation.aspx"); } } else { lblCreateError.Visible = false; lblLoginError.Visible = true; lblLoginError.Text = "Error: Your username or password is incorrect."; } }
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 (); }