Exemple #1
0
        public override void DataBind()
        {
            lw.ShoppingCart.ShoppingCart cart = new lw.ShoppingCart.ShoppingCart();

            this.Value = cart.MaskVoucher();

            base.DataBind();
        }
        public override void DataBind()
        {
            if (bound)
            {
                return;
            }
            bound = true;

            lw.ShoppingCart.ShoppingCart cart = new lw.ShoppingCart.ShoppingCart();

            Type classType = cart.ShoppingItems.GetType();

            PropertyInfo[] pi = classType.GetProperties();

            HybridDictionary dic = new HybridDictionary();

            foreach (PropertyInfo _pi in pi)
            {
                if (_pi.CanRead)
                {
                    dic.Add(_pi.Name, _pi.GetValue(cart.ShoppingItems, null));
                }
            }

            if (Detail == ShoppingCartDetailsItems.GiftVoucherValue && cart.ShoppingItems.GiftVoucherValue == 0)
            {
                this.Visible = false;
                return;
            }
            if (detail == ShoppingCartDetailsItems.Discount && cart.ShoppingItems.Discount == 0)
            {
                this.Visible = false;
                return;
            }
            if (cart.ShoppingItems.Payment != null && detail == ShoppingCartDetailsItems.PaymentCost && cart.ShoppingItems.Payment.AdditionalCost == 0)
            {
                this.Visible = false;
                return;
            }
            if (cart.ShoppingItems.Payment != null && detail == ShoppingCartDetailsItems.PaymentType && cart.ShoppingItems.Payment.AdditionalCost == 0)
            {
                this.Visible = false;
                return;
            }
            if (dic[Detail.ToString()] != null)
            {
                if (Detail == ShoppingCartDetailsItems.PaymentType)
                {
                    this.Text = string.Format(Format, cart.ShoppingItems.Payment.DisplayName);
                }
                else
                {
                    this.Text = string.Format(Format, dic[Detail.ToString()]);
                }
            }
            base.DataBind();
        }
Exemple #3
0
 public override void DataBind()
 {
     if (bound)
     {
         return;
     }
     bound = true;
     lw.ShoppingCart.ShoppingCart sCart = new lw.ShoppingCart.ShoppingCart();
     this.DataSource = new DataView(sCart.ShoppingItems.BasketItems);
     base.DataBind();
 }
Exemple #4
0
        public void ProcessRequest(HttpContext context)
        {
            lw.ShoppingCart.ShoppingCart cart   = new lw.ShoppingCart.ShoppingCart();
            CartUpdateStatus             status = cart.Update(context.Request, context.Request["GiftVoucher"]);

            if (status == CartUpdateStatus.IncorrectGiftVoucher)
            {
                WebContext.Response.Redirect(WebContext.Root + "/shopping-cart/?status=" + status.ToString() + "&v=" + context.Request["GiftVoucher"]);
            }
            else
            {
                WebContext.Response.Redirect(WebContext.Root + "/shopping-cart/");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            System.Web.HttpRequest  Request  = context.Request;
            System.Web.HttpResponse Response = context.Response;



            int itemId = -1, qty = 1;

            if (Request.Form["ItemId"] != null)
            {
                try
                {
                    itemId = Int32.Parse(Request.Form["ItemId"]);
                }
                catch
                {
                }
            }
            else
            {
                if (Request.QueryString["ItemId"] != null)
                {
                    try
                    {
                        itemId = Int32.Parse(Request.QueryString["ItemId"]);
                    }
                    catch
                    {
                    }
                }
            }
            if (Request.Form["QTY"] != null)
            {
                try
                {
                    qty = Int32.Parse(Request.Form["QTY"]);
                }
                catch
                {
                }
            }
            else
            {
                if (Request.QueryString["QTY"] != null)
                {
                    try
                    {
                        qty = Int32.Parse(Request.QueryString["QTY"]);
                    }
                    catch
                    {
                    }
                }
            }



            lw.ShoppingCart.ShoppingCart sCart = new lw.ShoppingCart.ShoppingCart();
            sCart.Empty();
            string optionsKey = Request["Options"];

            optionsKey = String.IsNullOrEmpty(optionsKey)? "": optionsKey;

            ChoicesMgr cMgr = new ChoicesMgr();

            if (optionsKey == "")
            {
                DataTable dt = cMgr.GetItemOptions(itemId);
                if (dt.Rows.Count > 0)
                {
                    Config   cfg  = new Config();
                    ItemsMgr iMgr = new ItemsMgr();
                    DataRow  item = iMgr.GetItem(itemId);
                    string   ProductDetailsFolder = cfg.GetKey("ProductDetailsFolder");
                    string   red = string.Format("{2}/{1}/{0}.aspx",
                                                 item["UniqueName"],
                                                 ProductDetailsFolder,
                                                 WebContext.Root
                                                 );
                    Response.Redirect(red + "?err=" + lw.CTE.Errors.SelectItemOptions);
                }
            }

            sCart.AddItem(itemId, qty, optionsKey, "", "");
            Response.Redirect(WebContext.Root + "/shopping-cart/");
        }