using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; public partial class viewcart : System.Web.UI.Page { protected void Page_Load(object sender, System.EventArgs e) { if(!Page.IsPostBack) { lbStatus.Text = Util.TmpString; PopulateDetail(); } } private void PopulateDetail() { if (Util.DefaultSystemSetting.Flag_SellingPrice) eCateLib.UpdateOldCartItemPrice(); if (Util.DefaultSystemSetting.Flag_FBLModule && Util.Member != null && Util.Member.Email != "") btFBL.Visible = true; else btFBL.Visible = false; ShoppingCartProxy scp = Util.ShoppingCartProxy; dgCart.DataSource = scp.GetAll(Util.GetShoppingCartId); dgCart.DataBind(); if(dgCart.Items.Count < 1) { btRFQ.Visible = false; btUpdate.Visible = false; btFBL.Visible = false; lbStatus.Text = "There is no item in your cart."; } } private bool UpdateCart() { int qty; for (int i=0; i 0) { Util.TmpString = DBStatus.DBMsg(Util.ShoppingCartProxy.UpdateItem(Util.GetShoppingCartId,ProdID,qty,true)); } else{ return false; } } catch{ return false; } } } return true; } protected void btUpdate_Click(object sender, System.EventArgs e) { if ( UpdateCart() == true) { PopulateDetail(); lbStatus.Text = Util.TmpString; } } protected void btRFQ_Click(object sender, System.EventArgs e) { if ( UpdateCart() == true) { Util.TmpString=""; Response.Redirect("~/cart/checkout.aspx"); } } protected void btFBL_Click(object sender, System.EventArgs e) { if (!eCateLib.MemberLoginStatus()) Response.Redirect("~/general/login.aspx"); try { if ( UpdateCart() == true) { FBLProxy fp = new FBLProxy(); for(int i=0; i < dgCart.Items.Count; i++) { fp.AddItem(Util.Member.MemberID,Int32.Parse(dgCart.Items[i].Cells[dgCart.Items[i].Cells.Count -1].Text),Int32.Parse(((TextBox)dgCart.Items[i].FindControl("txtQuantity")).Text)); } lbStatus.Text = "Item added to your frequent buying list."; } } catch { } } }