protected void Page_Load(object sender, EventArgs e)
    {
        if (this.CurrentCart == null) throw new CartException("Could not load cart data");

        if (this.CurrentCart.Completed == false)
        {
            CartDB db = new CartDB();
            db.CartUpdateCompleted(CurrentCart.CartId, true);
        db.CartDeleteAllByUserID(CurrentCart.UserId);
        confirmation = true;
        orderid = Session["orderpoid"].ToString();
        }

        if (!CartUsers.IsUserLoggedIn(Session))
        {
            CreateAccountPanel.Visible = true;
        }
        if (Session["SAPER"] != null)
        {
            if (Convert.ToBoolean(Session["SAPER"]) != false)
            {
                StudentVerificationPanel.Visible = true;
            }
        }
        Session["SAPER"] = null;
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.IsSecureConnection != false)
        {
            string redirect = Request.Url.ToString().Replace("https://", "http://");
            Response.Redirect(redirect);
            return;
        }

        try
        {
            string Torch_Order_Detail = "";
            //-- Left Menu Active
            if (Request.QueryString["am"] != null && Request.QueryString["am"] != "")
            {
                try { SiteConstants.LeftMenuActive = Convert.ToInt32(Request.QueryString["am"].ToString()); }
                catch { SiteConstants.LeftMenuActive = 4; }
            }
            else { SiteConstants.LeftMenuActive = 4; }
            //--
            SetChildPage("cart.aspx");
            this.CurrentCart = Cart.GetCartFromSession(Session);

            if (this.CurrentCart.CheckoutStep >= (int)Constants.CheckoutStep.ThankYou)
            {
                CartDB db = new CartDB();
                db.CartUpdateCompleted(this.CurrentCart.CartId, true);
                db.CartDeleteAllByUserID(this.CurrentCart.UserId);
                Response.Redirect("cart.aspx");
            }

            if (this.CurrentCart.Dirty) this.CurrentCart.Clean();

            CartDisplayPanel.Visible = this.CurrentCart.HasItems;
            CartEmptyPanel.Visible = !CartDisplayPanel.Visible;
            StudentItemMessagePanel.Visible = CartEmptyPanel.Visible == false && this.CurrentCart.HasStudentItems;

            DebugPanel.Controls.Add(new LiteralControl(Helper.VarDump(CurrentCart)));
            if (CurrentCart.ItemsWeight > 100)
            {
                overweigth = true;
            }
            DebugPanel.Visible = false;

            //ItemsGrid.RowCommand += new GridViewCommandEventHandler(ItemsGrid_RowCommand);
            //ItemsGrid.RowDataBound += new GridViewRowEventHandler(ItemsGrid_RowDataBound);

            ItemsList.ItemDataBound += new RepeaterItemEventHandler(ItemsList_ItemDataBound);
            ItemsList.ItemCommand += new RepeaterCommandEventHandler(ItemsList_ItemCommand);

            string SocialTwistScript = "<div style='width: 100px; float: right; margin-top: -20px;margin-right:12px;'>" + Global.globalSocialTwist + "</a></div>";
            string link = String.Format("http://"+Request.Url.Host.ToString()+"/cart_share.aspx?id={0}", CurrentCart.UniqueId.ToString());
            CartDisplayPanel.Controls.AddAt(0, new LiteralControl(SocialTwistScript.Replace("window.location", "'"+link+"'")));

            LoadControls();

            if (CartDisplayPanel.Visible)
            {
                this.BindData(CurrentCart.Items);
            }

            Page.RegisterStartupScript("RegisterControls", String.Format(" <script type='text/javascript'>{0}</script>", Helper.GenerateScriptToAccessControls(Page.Controls)));
            //Helper.MakeGridViewAccessible(ref ItemsGrid);
        }
        catch (CartException ex)
        {
            Response.Write("exception!" + ex.Message);
            this.DisplayMessage(ex.Message);
            CartDisplayPanel.Visible = false;
            CartEmptyPanel.Visible = false;
            StudentItemMessagePanel.Visible = false;
        }
        if (completeNames == "")
        {
            QuoteThisButton.Visible = false;
        }
        else {
            QuoteThisButton.Visible = true;
        }
    }