Esempio n. 1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            this.m_page = new ITCPage();

            if (m_page.IsBetterWoman)
            {
                Website = "bw";
            }
            else Website = "bm";

            string removeId = Request.QueryString.ToString().IndexOf("remove") > -1 ? Request.QueryString["remove"] : "0";
            string thread = Request.QueryString.ToString().IndexOf("thread") > -1 ? Request.QueryString["thread"] : "";
            string promotionKey = Request.QueryString.ToString().IndexOf("PRID") > -1 ? Request.QueryString["PRID"] : "";
            this.m_shoppingCartId = Request.QueryString.ToString().IndexOf("SCID") > -1 ? Convert.ToInt32(Request.QueryString["SCID"]) : 0;

            m_productID = Convert.ToInt32(Request.QueryString["PID2"]);
            m_site = Request.QueryString["site"];

            if (Convert.ToInt32(removeId) > 0)
            {
                OTCShoppingCartItem i = new OTCShoppingCartItem(Convert.ToInt32(removeId));
                OTCShoppingCart c = new OTCShoppingCart(this.m_shoppingCartId);
                c.RemoveCartItem(i);
                string newQueryString = "";
                foreach (string s in Request.QueryString.ToString().Split('&'))
                {
                    Response.Write(s + "<br>" + CR);
                    if (s != ("remove=" + removeId))
                    {
                        newQueryString += s + "&";
                    }
                }
                Response.Redirect("Checkout.aspx?" + newQueryString.Trim('&'));
            }

            if (Convert.ToInt32(Session["SID"]) > 0)
            {
                this.resetForm();
            }

            if (!Page.IsPostBack && (thread != "reset"))
            {
                this.ddState.SQL = "spGetOTCState";
                this.ddState.TextField = "StateName";
                this.ddState.IdField = "StateAbbreviation";
                this.ddState.IntroText = "Please Select";
                this.ddState.Fill();

                bindStateShipControl();

                this.ddCountry.IntroText = "Please Select";
                this.ddCountry.SQL = "spGetOTCCountry";
                this.ddCountry.TextField = "CountryName";
                this.ddCountry.IdField = "OTCCountryId";
                this.ddCountry.Fill();

                int index1 = 0;
                int index2 = 0;

                foreach (ListItem i in this.ddCountry.Items)
                {
                    switch (i.Text)
                    {
                        case "United States":
                            i.Attributes.Add("style", "color:Red");
                            break;
                        case "Canada":
                            i.Attributes.Add("style", "color:Red");
                            break;
                        case "Cameroon":
                            index1 = ddCountry.Items.IndexOf(i);
                            break;
                        case "United Arab Emirates":
                            index2 = ddCountry.Items.IndexOf(i);
                            break;
                    }
                }

                //ddCountry.Items.Insert(index1 + 1, new ListItem("Canada", "126"));
                //ddCountry.Items.Insert(index2 + 2, new ListItem("United States", "222"));

                this.ddShippingCountry.IntroText = "Please Select";
                this.ddShippingCountry.SQL = "spGetOTCCountry";
                this.ddShippingCountry.TextField = "CountryName";
                this.ddShippingCountry.IdField = "OTCCountryId";
                this.ddShippingCountry.Fill();

                index1 = 0;
                index2 = 0;

                foreach (ListItem i in this.ddShippingCountry.Items)
                {
                    switch (i.Text)
                    {
                        case "United States":
                            i.Attributes.Add("style", "color:Red");
                            break;
                        case "Canada":
                            i.Attributes.Add("style", "color:Red");
                            break;
                        case "Cameroon":
                            index1 = ddShippingCountry.Items.IndexOf(i);
                            break;
                        case "United Arab Emirates":
                            index2 = ddShippingCountry.Items.IndexOf(i);
                            break;
                    }
                }

                ddShippingCountry.Items.Insert(index1 + 1, new ListItem("Canada", "126"));
                ddShippingCountry.Items.Insert(index2 + 2, new ListItem("United States", "222"));

                this.fillCCLists();
                this.fillShippingMethods();
            }

            this.fillShippingMethods();

            this.m_salesTax = this.ddStateShip.SelectedValue == "MA" ? .0625 : 00;

            if (Request.ServerVariables["HTTP_HOST"].ToString().IndexOf("localhost") > -1)
                if (!Page.IsPostBack)
                    this.setDevelopmentForm();
        }
 private void reloadShoppingCart()
 {
     if (Convert.ToInt32(m_removeId) > 0)
     {
         OTCShoppingCartItem i = new OTCShoppingCartItem(Convert.ToInt32(m_removeId));
         OTCShoppingCart c = new OTCShoppingCart(this.m_shoppingCartId);
         c.RemoveCartItem(i);
         string newQueryString = "";
         foreach (string s in Request.QueryString.ToString().Split('&'))
         {
             Response.Write(s + "<br>" + CR);
             if (s != ("remove=" + m_removeId))
             {
                 newQueryString += s + "&";
             }
         }
         Response.Redirect("PreCheckout.aspx?" + newQueryString.Trim('&'));
     }
 }