public List <WishItem> UpdateWishItems() { using (WishlistCartActions usersWishlistCart = new WishlistCartActions()) { String wishId = usersWishlistCart.GetWishId(); WishlistCartActions.WishlistUpdates[] wishUpdates = new WishlistCartActions.WishlistUpdates[WishList.Rows.Count]; for (int i = 0; i < WishList.Rows.Count; i++) { IOrderedDictionary rowValues = new OrderedDictionary(); rowValues = GetValues(WishList.Rows[i]); wishUpdates[i].ProductId = Convert.ToInt32(rowValues["ProductID"]); CheckBox cbRemove = new CheckBox(); cbRemove = (CheckBox)WishList.Rows[i].FindControl("Remove"); wishUpdates[i].RemoveItem = cbRemove.Checked; TextBox quantityTextBox = new TextBox(); quantityTextBox = (TextBox)WishList.Rows[i].FindControl("WishQuantity"); wishUpdates[i].WishQuantity = Convert.ToInt16(quantityTextBox.Text.ToString()); } usersWishlistCart.UpdateWishlistCartDatabase(wishId, wishUpdates); WishList.DataBind(); lblTotal.Text = String.Format("{0:c}", usersWishlistCart.GetTotal()); return(usersWishlistCart.GetWishItems()); } }
protected void Page_PreRender(object sender, EventArgs e) { using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions()) { string cartStr = string.Format("Cart ({0})", usersShoppingCart.GetCount()); cartCount.InnerText = cartStr; } using (WishlistCartActions usersWishlistCart = new WishlistCartActions()) { string wishStr = string.Format("WishList ({0})", usersWishlistCart.GetCount()); wishCount.InnerText = wishStr; } }
protected void Page_Load(object sender, EventArgs e) { string rawId = Request.QueryString["ProductID"]; int productId; if (!String.IsNullOrEmpty(rawId) && int.TryParse(rawId, out productId)) { using (WishlistCartActions usersWishlistCart = new WishlistCartActions()) { usersWishlistCart.AddToWish(Convert.ToInt16(rawId)); } } else { Debug.Fail("ERROR : We should never get to AddToWish.aspx without a ProductId."); throw new Exception("ERROR : It is illegal to load AddToWish.aspx without setting a ProductId."); } Response.Redirect("WishlistCart.aspx"); }
protected void Page_Load(object sender, EventArgs e) { using (WishlistCartActions usersWishlistCart = new WishlistCartActions()) { decimal wishTotal = 0; wishTotal = usersWishlistCart.GetTotal(); if (wishTotal > 0) { // Display Total. lblTotal.Text = String.Format("{0:c}", wishTotal); } else { LabelTotalText.Text = ""; lblTotal.Text = ""; WishlistCartTitle.InnerText = "Wish List is Empty"; UpdateBtn.Visible = false; } } }
public List <WishItem> GetWishlistItems() { WishlistCartActions actions = new WishlistCartActions(); return(actions.GetWishItems()); }