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;
            }
            */
        }
Esempio n. 2
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);
        }
Esempio n. 3
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 : ""));
        }
Esempio 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.");
            }
        }