Exemplo n.º 1
0
        private void Button1_Click(object sender, System.EventArgs e)
        {
            OTC.Web.Promotion.OTCPromotion p = new OTC.Web.Promotion.OTCPromotion(Convert.ToInt32(this.ddPromotions.SelectedValue));
            OTCProduct pd  = new OTCProduct(Convert.ToInt32(this.lstProducts.SelectedValue));
            OTCShoppingCart c = new OTCShoppingCart(this.m_page.ShoppingCartId);
            OTCShoppingCartItem i = new OTCShoppingCartItem();
            i.ProductID = pd.ProductId;
            i.ProductPrice = pd.Price;
            i.ItemCount = 1;
            c.AddCartItem(i);
            c.ApplyPromotion(this.ddPromotions.SelectedItem.Text,c.ShoppingCartID);
            c = null;
            c = new OTCShoppingCart(this.m_page.ShoppingCartId);
            this.txtProductPrice.Text = c.CartTotal.ToString("c");
            Response.Write(this.m_page.ShoppingCartId);
            p.AddPromotionUsage(1,999999);

            /*
            OTCProduct pd  = new OTCProduct(Convert.ToInt32(this.lstProducts.SelectedValue));
            if(p.DiscountAmount > 0)
            {
                string displayPrice = Convert.ToDouble(pd.Price - p.DiscountAmount).ToString("c");
                this.txtProductPrice.Text = pd.Price.ToString("c");
                this.txtPromotionPrice.Text = displayPrice;
            }

            if(p.DiscountPercentage > 0)
            {
                string displayPrice = Convert.ToDouble(pd.Price - (pd.Price * p.DiscountPercentage)).ToString("c");
                this.txtProductPrice.Text = pd.Price.ToString("c");
                this.txtPromotionPrice.Text = displayPrice;
            }
            */
        }
        public void addToShoppingCart(int productID)
        {
            _item = new OTCShoppingCartItem();
            _product = new OTCProduct(productID);
            _item.ProductID = productID;
            _item.ProductPrice = _product.Price;
            _item.ItemCount = 1;
            _cart.AddCartItem(_item);

            _item = null;
            _product = null;
        }
        public void addToShoppingCart(String[] productList)
        {
            if (productList.Length > 0)
            {
                for (int i = 0; i < productList.Length; i++)
                {
                    _item = new OTCShoppingCartItem();
                    _product = new OTCProduct(Convert.ToInt32(productList[i]));
                    _item.ProductID = Convert.ToInt32(productList[i]);
                    _item.ProductPrice = _product.Price;
                    _item.ItemCount = 1;
                    _cart.AddCartItem(_item);

                    _item = null;
                    _product = null;
                }
            }
        }
Exemplo n.º 4
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                this.m_page = new ITCPage();
                OTCShoppingCart cart = new OTCShoppingCart(Session.SessionID);
                Session["wantsMembership"] = Convert.ToBoolean(Request.QueryString["wantsMembership"]);
                int productId = getCorrectProductId(Convert.ToInt32(Request.QueryString["PID"]));
                bool addedItems = false;
                string f = Request.Form.ToString();
                cart = new OTCShoppingCart(this.m_page.ShoppingCartId);
                //cart.RemoveAllItems(this.m_page.ShoppingCartId);
                OTCShoppingCartItem item = new OTCShoppingCartItem();
                OTCProduct product = new OTCProduct(Convert.ToInt32(productId));
                item.ProductID = Convert.ToInt32(productId);
                item.ProductPrice = product.Price;
                item.ItemCount = 1;
                cart.AddCartItem(item);
                string key = "";

                string host = Request.ServerVariables["HTTP_HOST"];

                if (host.IndexOf("localhost") > -1 || host == "cjeycjey.homedns.org:9001" || host == "68.14.68.91:40401")
                    Response.Redirect("/interceuticals/order/precheckout.aspx?" + Request.QueryString.ToString() + "&PID2=" + productId + "&SCID=" + this.m_page.ShoppingCartId + "&site=" + Session["site"] + "&" + (key.Length > 0 ? "?PKY=" + key : ""));
                else if (host == "interceuticals.serveronline.net")
                    Response.Redirect("http://interceuticals.serveronline.net/interceuticals/order/precheckOut.aspx?" + Request.QueryString.ToString() + "&PID2=" + productId + "&SCID=" + this.m_page.ShoppingCartId + "&site=" + Session["site"] + "&" + (key.Length > 0 ? "?PKY=" + key : ""));
                else
                    Response.Redirect("https://www.interceuticals.com/interceuticals/order/precheckout.aspx?" + Request.QueryString.ToString() + "&PID2=" + productId + "&SCID=" + this.m_page.ShoppingCartId + "&site=" + Session["site"] + "&" + (key.Length > 0 ? "?PKY=" + key : ""));
            }
            catch(System.Web.HttpUnhandledException ex)
            {
                string mailBody = Request.QueryString.ToString();

                EmailSender mail = new EmailSender();

                String subject = "Site Error : " + Request.QueryString["PID"];
                String notifyEmails = AppLookup.RecipientsAlerts;

                mail.AddEmailAddresses(notifyEmails);
                mail.SendEmail(subject, mailBody + (char)10 + ex.Message);

                Response.Write("There was an error in our process. We apologize for the inconvenience. We have notified the web master and the problem will be addressed shortly.");
            }
        }
Exemplo n.º 5
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();
        }
Exemplo n.º 6
0
        /// <summary>
        /// 
        /// </summary>
        private void resetForm()
        {
            int salesOrderId = Convert.ToInt32(Session["SID"]);
            OTCSalesOrder salesOrder = new OTCSalesOrder(salesOrderId);
            OTCShoppingCart cart = new OTCShoppingCart(Session.SessionID);
            Session["shoppingCartId"]   = cart.AddNew();
            cart = new OTCShoppingCart(Convert.ToInt32(Session["shoppingCartId"]));
            OTCShoppingCartItem item = new OTCShoppingCartItem();
            string sql = "SELECT * FROM OTCSalesOrderDetail WHERE OTCSalesOrderId = " + salesOrder.OTCSalesOrderId;
            this.m_db.Open();
            DataTable dt = this.m_db.GetDataset(sql).Tables[0];
            this.m_db.ReleaseConnection();
            foreach(DataRow dr in dt.Rows)
            {
                item.ProductID = Convert.ToInt32(dr["OTCProductId"]);
                item.ProductPrice = Convert.ToDouble(dr["ItemPrice"]);
                item.ItemCount = Convert.ToInt32(dr["ItemCount"]);
                OTCProduct p = new OTCProduct(item.ProductID);
                if(p.CategoryId == 21)
                    Session["site"] = "bm";
                else
                    Session["site"] = "bw";
                cart.AddCartItem(item);
            }
            OTCSiteMember m = new OTCSiteMember(salesOrder.OTCSiteMemberId);
            OTCCreditCard c = new OTCCreditCard(salesOrder.OTCSalesOrderId);

            if(Page.IsPostBack)
                return;

            this.txtAddress.Text = m.Address;
            //this.txtBillingStreet.Text = m.Address;
            this.txtCardNumber.Text = c.CardNumber;
            this.txtCity.Text = m.City;
            this.txtComments.Value = salesOrder.Comments;
            this.txtEmailAddress.Text = m.EmailAddress;
            this.txtFirstName.Text = m.FirstName;
            this.txtLastName.Text = m.LastName;
            this.txtPhone.Text = salesOrder.Phone;
            this.txtZipPostalCode.Text = m.Zip;
            this.txtShippingAddress.Text = salesOrder.ShippingAddress;
            this.txtShippingCity.Text = salesOrder.City;
            this.txtShippingEmailAddress.Text = salesOrder.ShippingEmailAddress;
            this.txtShippingFirstName.Text = salesOrder.ShippingFirstName;
            this.txtShippingLastName.Text = salesOrder.LastName;
            this.txtShippingPhone.Text = salesOrder.Phone;
            this.txtShippingEmailAddress.Text = salesOrder.EmailAddress;
            this.txtShippingStateProvince.Text = salesOrder.ShippingState;
            this.txtShippingZipPostalCode.Text = salesOrder.ShippingZip;

            this.ddState.SQL         = "spGetOTCState";
            this.ddState.TextField   = "StateName";
            this.ddState.IdField     = "StateAbbreviation";
            this.ddState.IntroText   = "Please Select";
            this.ddState.Fill();

            foreach(ListItem i in this.ddState.Items){
                if(i.Text == salesOrder.State){
                    i.Selected = true;
                    break;
                }
            }

            bindStateShipControl();

            foreach (ListItem i in this.ddStateShip.Items)
            {
                if (i.Text == salesOrder.State)
                {
                    i.Selected = true;
                    break;
                }
            }

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

            foreach(ListItem i in this.ddCountry.Items){
                if(i.Text == salesOrder.Country){
                    i.Selected = true;
                    break;
                }

                if (i.Value == "United States")
                    i.Attributes.Add("style", "color:Blue");

            }

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

            foreach(ListItem i in this.ddShippingCountry.Items){
                if(i.Text == salesOrder.Country){
                    i.Selected = true;
                    break;
                }
            }

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

            foreach(ListItem i in this.ddCCType.Items){
                if(i.Text== c.CardType){
                    i.Selected = true;
                    break;
                }
            }

            foreach(ListItem i in this.ddMonth.Items){
                if(i.Value == c.ExpirationMonth){
                    i.Selected = true;
                    break;
                }
            }

            foreach(ListItem i in this.ddYear.Items){
                if(i.Value == c.ExpirationYear){
                    i.Selected = true;
                    break;
                }
            }

            double shippingRate = this.getShippingRate();
            this.ddShippingMethods.Items.Clear();
            ListItem it = new ListItem();
            it.Text  = "S/H in US - $" + shippingRate;
            if(salesOrder.ShippingMethod == it.Text)
                it.Selected = true;
            it.Value = "10.99";
            this.ddShippingMethods.Items.Add(it);

            it = new ListItem();
            it.Text  = "Rush S/H in US - " + (shippingRate + 9.99).ToString();
            it.Value = "19.99";
            if(salesOrder.ShippingMethod == it.Text)
                it.Selected = true;
            this.ddShippingMethods.Items.Add(it);

            it= new ListItem();
            it.Text = "S/H to Canada - $" + (shippingRate + 5.00).ToString();
            it.Value = (shippingRate + 5.00).ToString();
            if(salesOrder.ShippingMethod == it.Text)
                it.Selected = true;
            this.ddShippingMethods.Items.Add(it);

            it = new ListItem();
            it.Text  = "S/H to other countries and the Carribean-$30.99";
            it.Value = "30.99";
            if(salesOrder.ShippingMethod == it.Text)
                it.Selected = true;
            this.ddShippingMethods.Items.Add(it);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddToCart_Click(object sender, System.EventArgs e)
        {
            OTCShoppingCart cart = new OTCShoppingCart(Session.SessionID); //?what am i doing here ?
            int productId = this.getCorrectProductId(Convert.ToInt32(this.ddProducts.SelectedValue));
            bool addedItems = false;
            string f = Request.Form.ToString();
            cart = new OTCShoppingCart(this.m_page.ShoppingCartId);
            cart.RemoveAllItems(this.m_page.ShoppingCartId);
            OTCShoppingCartItem item = new OTCShoppingCartItem();
            OTCProduct product = new OTCProduct(Convert.ToInt32(this.ddProducts.SelectedValue));
            item.ProductID = Convert.ToInt32(productId);
            item.ProductPrice = product.Price;
            item.ItemCount = 1;
            cart.AddCartItem(item);
            string key = "";
            string howie = "?__utma=1.1914565456.1179433560.1179515921.1179867123.5&__utmb=1&__utmc=1&__utmx=-&__utmz=1.1179433560.1.1.utmccn%3D(direct)%7Cutmcsr%3D(direct)%7Cutmcmd%3D(none)&__utmv=-&__utmk=233877919";

            //if(this.txtPromotionCode.Text.Length > 0)
            //	if(OTCPromotion.PromotionKeyExists(this.txtPromotionCode.Text))
            //		key = this.txtPromotionCode.Text;

            if ((Request.ServerVariables["HTTP_HOST"] == "localhost:1047") || (Request.ServerVariables["HTTP_HOST"] == "MVCDesktop"))
                Response.Redirect("../order/PreCheckOut.aspx" + howie + "&SCID=" + this.m_page.ShoppingCartId + "&site=" + Session["site"] + "&" + (key.Length > 0 ? "?PKY=" + key : "") + Request.QueryString);
            else if ((Request.ServerVariables["HTTP_HOST"] == "interceuticals.serveronline.net"))
                Response.Redirect("http://interceuticals.serveronline.net/interceuticals/order/PreCheckOut.aspx" + howie + "&SCID=" + this.m_page.ShoppingCartId + "&site=" + Session["site"] + "&" + (key.Length > 0 ? "?PKY=" + key : ""));
            else
                Response.Redirect("https://www.interceuticals.com/interceuticals/order/PreCheckOut.aspx" + howie + "&SCID=" + this.m_page.ShoppingCartId + "&site=" + Session["site"] + "&" + (key.Length > 0 ? "?PKY=" + key : ""));
        }
        public void addToShoppingCart(ArrayList productList)
        {
            IEnumerator prodEnum = productList.GetEnumerator();

            while (prodEnum.MoveNext())
            {
                _item = new OTCShoppingCartItem();
                _product = new OTCProduct(Convert.ToInt32(prodEnum.Current));
                _item.ProductID = Convert.ToInt32(prodEnum.Current);
                _item.ProductPrice = _product.Price;
                _item.ItemCount = 1;
                _cart.AddCartItem(_item);

                _item = null;
                _product = null;
            }

            prodEnum.Reset();
        }
        public void Close()
        {
            if (_product != null)
                _product = null;

            if (_item != null)
                _item = null;

            if (_cart != null)
                _cart = null;
        }
Exemplo n.º 10
0
 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('&'));
     }
 }