コード例 #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            int orderId = Convert.ToInt32(Request.QueryString["OID"]);
            this.m_order = new OTCSalesOrder(orderId);
            string sql = "SELECT * FROM OTCSalesOrderDetail WHERE OTCSalesOrderId = " + this.m_order.OTCSalesOrderId;
            OTCDatabase db = new OTCDatabase();
            db.Open();
            DataTable dt = db.GetDataset(sql).Tables[0];
            db.ReleaseConnection();
            foreach(DataRow dr in dt.Rows){
                int productId = Convert.ToInt32(dr["OTCProductId"]);
                OTCProduct p = new OTCProduct(productId);
                if(p.CategoryId != 21)
                    Response.End();
                m_productPrice = p.Price;
            }

            EmailSender mail = new EmailSender();

            String subject = "Order Confirmtion - Interceuticals Order " + this.m_order.OTCSalesOrderId;
            String body = "Marketing Information Captured";
            String notifyEmails = "*****@*****.**";

            mail.AddEmailAddresses(notifyEmails);
            //mail.SendEmail(subject, body);
        }
コード例 #2
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;
            }
            */
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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;
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// 
        /// </summary>
        public void buildStep1()
        {
            OTCShoppingCart cart = new OTCShoppingCart(this.m_shoppingCartId);
            OTC.Web.Promotion.OTCPromotion p = new OTC.Web.Promotion.OTCPromotion(cart.OTCPromotionId);

            if(cart.CartItems.Length == 0)
                this.btnCheckout.Enabled = false;

            if (cart.CartItems.Length == 0)
            {
                Response.Write("<br><br><div align=\"center\" class=\"no-items\"><font color=\"red\">You have no items in your bag!</font><br><a href=\"http://www.interceuticals.com/interceuticals/product/default.aspx" + (this.m_page.IsBetterWoman ? "?site=bw" : "") + "\"><font class=\"tableFont\">continue shopping</a></div>");
                Control form = this.Page.Controls[0];
                foreach (Control c in form.Controls)
                {
                    if (c.GetType().ToString() == "System.Web.UI.WebControls.TextBox")
                    {
                        System.Web.UI.WebControls.TextBox ctrl = (System.Web.UI.WebControls.TextBox)c;
                        ctrl.Enabled = false;
                    }
                }
            }
            else
            {
                Response.Write(CR + "<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" border=\"0\" class=\"tableWrapper\">"

                    + CR + " <tr>"
                    + CR + "  <td class=\"rowWrapper\" width=\"50%\"><font class=\"tableFont\">You've Added The Item(s) Below To Your Cart</td>"
                    //+ CR + "  <td class=\"rowWrapper\"><font class=\"tableFont\">Quantity</td>"
                    + CR + "  <td class=\"rowWrapper\"><font class=\"tableFont\">Unit Price</td>"
                    + CR + "  <td class=\"rowWrapper\"><font class=\"tableFont\">Total Price</td>"
                    + CR + "  <td>&nbsp;</td>"
                    + CR + " </tr>" + CR
                    );

            }

            //Response.Write(cart.CartItems.Length > 0);
            //Response.Write(Request.QueryString.ToString());
            //return;

            if(cart.CartItems.Length > 0)
            {
                foreach(OTCShoppingCartItem item in cart.CartItems)
                {
                    string memberShipString = "";
                    OTCProduct prod = new OTCProduct(item.ProductID);
                    if(item.ProductPrice * item.ItemCount != item.OrderPrice * item.ItemCount)
                    {
                        Response.Write("<tr><td>" + p.PromotionName + " " + p.PromotionDescription + "</td></tr>");
                        Response.Write(" <tr>"
                                + CR + "  <td class=\"productInfo\">" + prod.ProductName + " " + memberShipString + "</td>"
                                //+ CR + "  <td class=\"productInfo\">" + item.ItemCount + "</td>"
                                + CR + "  <td class=\"productInfoStrikeThrough\">" + item.ProductPrice.ToString("c") + "</td>"
                                + CR + "  <td class=\"productInfo\">" + (item.OrderPrice * item.ItemCount).ToString("c") + "</td>"
                                + CR + "  <td>[ <a href=\"CheckOut.aspx?" + Request.QueryString.ToString() + "&remove=" + item.ShoppingCartItemID + "\">remove</a> ]</td>"
                                + CR + " </tr>" + CR
                                );
                    }
                    else
                    {
                        Response.Write(" <tr>"
                                + CR + "  <td class=\"productInfo\">" + prod.ProductName + " " + memberShipString + "</td>"
                                //+ CR + "  <td class=\"productInfo\">" + item.ItemCount + "</td>"
                                + CR + "  <td class=\"productInfo\">" + item.ProductPrice.ToString("c") + "</td>"
                                + CR + "  <td class=\"productInfo\">" + (item.ProductPrice * item.ItemCount).ToString("c") + "</td>"
                                + CR + "  <td>[ <a href=\"CheckOut.aspx?" + Request.QueryString.ToString() + "&remove=" + item.ShoppingCartItemID + "\">remove</a> ]</td>"
                                + CR + " </tr>" + CR
                                );
                    }
                    try
                    {
                        if(prod.CategoryId == 21)
                            this.m_googleTrackingCode = "UA-1185020-2";
                        else
                            this.m_googleTrackingCode = "UA-1185020-1";
                    }
                    catch(Exception ex) {}
                }

            }

            Response.Write("</table>");
        }
コード例 #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);
        }
コード例 #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 : ""));
        }
コード例 #8
0
        /// <summary>
        /// 
        /// </summary>
        private void fillForm(object sender, System.EventArgs e)
        {
            OTCProduct product = new OTCProduct(this.m_productId);
            this.txtDescription.Value = product.ProductDescription;
            //this.txtDiscount.Text = 0.00;//product.Discount.ToString();
            this.txtPrice.Text = product.Price.ToString("c").Replace("$","");
            this.txtProductId.Value = product.ProductId.ToString();
            this.txtProductName.Text = product.ProductName;
            //this.txtShippingCosts.Text = product.ShippingPrice.ToString();
            //this.txtShippingDetails.Value = product.ShippingDetails;
            this.ddCategory.SetActiveItem(product.CategoryId);
            this.txtSku.Text = product.SKU;
            //ddCategory_SelectedIndexChanged(sender,e);
            //this.ddSubCategory.SetActiveItem(product.SubCategoryId);
            //this.ddVendors.SetActiveItem(product.VendorId);
            //this.chkActive.Checked = product.IsActive;
            //this.chkFeaturedItem.Checked = product.IsFeatured;

            //foreach(ListItem item in this.lstColors.Items)
            //	if(product.ProductHasFeature(Convert.ToInt32(item.Value)))
            //		item.Selected = true;

            //foreach(ListItem item in this.lstSizes.Items)
            //	if(product.ProductHasFeature(Convert.ToInt32(item.Value)))
            //		item.Selected = true;

            string savePath = Request.PhysicalApplicationPath + "images\\product\\" + product.ImageName;

            if(File.Exists(savePath))
                this.m_imageTag = "<img src=\"/Interceuticals/images/product/" + product.ImageName + "\" width=\"250\" height=\"250\">";
            else
                this.m_imageTag  = "";
        }
コード例 #9
0
 private void btnDelete_Click(object sender, System.EventArgs e)
 {
     if(Convert.ToInt32(this.txtProductId.Value) > 0)
     {
         OTCProduct product = new OTCProduct(Convert.ToInt32(this.txtProductId.Value));
         product.Delete();
         Response.Redirect("product.aspx");
     }
 }
コード例 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Expire the page to avoid users from clicking the back button.
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
            Response.Cache.SetNoStore();
            Response.AppendHeader("Pragma", "no-cache");

            m_currentSession = Session["SessionID"] != null ? Session["SessionID"].ToString() : "";

            if (m_currentSession == "")
                m_orderMessage = "You're order has already been processed. <br>";
            else
                m_orderMessage = "Thank you - Please wait and do not click the back button, your order is processing...";

            string siteName = Request.QueryString.ToString().IndexOf("site") > -1 ? Request.QueryString["site"] : "bm";

            if (!Page.IsPostBack)
            {
                if (m_currentSession != "")
                {
                    OTCEncryption crypt = new OTCEncryption(7);
                    int id = Convert.ToInt32(Request.QueryString["OID"]);
                    this.m_order = new OTCSalesOrder(id);
                    this.m_member = new OTCSiteMember(this.m_order.OTCSiteMemberId);
                    this.m_card = new OTCCreditCard(this.m_order.OTCSalesOrderId, Session.SessionID);

                    if (this.m_card.IISSessionId != Session.SessionID)
                    {
                        if (Request.ServerVariables["HTTP_HOST"].IndexOf("localhost") > -1)
                            Response.Redirect("/interceuticals/default.aspx");
                        else
                            Response.Redirect("http://www.interceuticals.com");
                    }

                    this.m_page = new ITCPage();
                    this.m_db.Open();
                    this.m_dt = this.m_db.GetDataset("spGetOTCSalesOrderDetails_Verisign @OTCSalesOrderId = " + id).Tables[1];

                    foreach (DataRow dr in this.m_dt.Rows)
                    {
                        this.m_product += dr["ProductName"].ToString();
                    }

                    this.m_db.ReleaseConnection();

                    //hack to finish and get deployed.
                    string sql = "SELECT * FROM OTCSalesOrderDetail WHERE OTCSalesOrderId = " + this.m_order.OTCSalesOrderId;
                    OTCDatabase db = new OTCDatabase();
                    db.Open();
                    DataTable dt = db.GetDataset(sql).Tables[0];
                    db.ReleaseConnection();

                    //this.m_siteString = "|BM|BetterMan|Male|";
                    //UTM:T|<%=Order.OTCSalesOrderId%>|<%=this.SiteName%>|<%=Order.TotalCost%>|<%=Convert.ToDouble(ProductPrice * Order.SalesTax).ToString("c").Replace("$","")%>|<%=Order.ShippingCost%>|<%=Order.City%>|<%=Order.State%>|<%=Order.Country%> UTM:I|<%=Order.OTCSalesOrderId%><%=this.SiteString%><%=ProductPrice%>|<%=ProductQty%>
                    this.m_siteName = siteName == "bm" ? "BetterManNow" : "BetterWomanNow";
                    //this.m_googleTrackingCode	= this.m_page.AnalyticsTracking;

                    foreach (DataRow dr in dt.Rows)
                    {
                        int productId = Convert.ToInt32(dr["OTCProductId"]);
                        OTCProduct p = new OTCProduct(productId);
                        if (p.CategoryId == 21)
                        {
                            this.m_siteString += "UTM:T|" + Order.OTCSalesOrderId + "|" + this.SiteName + "|" + Order.TotalCost + "|" + Convert.ToDouble(ProductPrice * Order.SalesTax).ToString("c").Replace("$", "") + "|" + Order.ShippingCost + "|" + Order.City + "|" + Order.State + "|" + Order.Country + "UTM:I|" + Order.OTCSalesOrderId + "|BM|BetterMan|Male|" + ProductPrice + "|" + ProductQty + (char)10;//"|BM|BetterMan|Male|";
                            //this.m_siteName   = "BetterManNow";
                            //this.m_googleTrackingCode = "UA-1185020-2";
                        }
                        else
                        {
                            //this.m_siteString = "|BW|BetterWoman|Female|";
                            this.m_siteString += "UTM:T|" + Order.OTCSalesOrderId + "|" + this.SiteName + "|" + Order.TotalCost + "|" + Convert.ToDouble(ProductPrice * Order.SalesTax).ToString("c").Replace("$", "") + "|" + Order.ShippingCost + "|" + Order.City + "|" + Order.State + "|" + Order.Country + "UTM:I|" + Order.OTCSalesOrderId + "|BW|BetterWoman|Female|" + ProductPrice + "|" + ProductQty + (char)10;//"|BM|BetterMan|Male|";
                            //this.m_siteName   = "BetterWomanNow";
                            //this.m_googleTrackingCode = "UA-1185020-1";
                        }
                        m_productPrice = p.Price;
                        Session["WantsMembership"] = true;

                    }

                    //Do this to avoid duplicate order post to paypal.
                    Session.Clear();
                    Session.Abandon();

                }
                else
                    Response.Redirect("PostedMessage.aspx");

            }
        }
コード例 #11
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.");
            }
        }
コード例 #12
0
        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();
        }
コード例 #13
0
        public void Close()
        {
            if (_product != null)
                _product = null;

            if (_item != null)
                _item = null;

            if (_cart != null)
                _cart = null;
        }
コード例 #14
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            string siteName = Request.QueryString.ToString().IndexOf("site") > - 1 ? Request.QueryString["site"] : "bm";
            OTCEncryption crypt = new OTCEncryption(7);
            int id = Convert.ToInt32(Request.QueryString["OID"]);
            this.m_order  = new OTCSalesOrder(id);
            this.m_member = new OTCSiteMember(this.m_order.OTCSiteMemberId);
            this.m_card   = new OTCCreditCard(this.m_order.OTCSalesOrderId,Session.SessionID);

            if(this.m_card.IISSessionId != Session.SessionID)
                Response.Redirect("/interceuticals/index.html");

            this.m_page   = new ITCPage();
            this.m_db.Open();
            this.m_dt	  = this.m_db.GetDataset("spGetOTCSalesOrderDetails_Verisign @OTCSalesOrderId = " + id).Tables[1];

            foreach(DataRow dr in this.m_dt.Rows)
            {
                this.m_product += dr["ProductName"].ToString();
            }

            this.m_db.ReleaseConnection();

            //hack to finish and get deployed.
            string sql = "SELECT * FROM OTCSalesOrderDetail WHERE OTCSalesOrderId = " + this.m_order.OTCSalesOrderId;
            OTCDatabase db = new OTCDatabase();
            db.Open();
            DataTable dt = db.GetDataset(sql).Tables[0];
            db.ReleaseConnection();

            //this.m_siteString = "|BM|BetterMan|Male|";
            //UTM:T|<%=Order.OTCSalesOrderId%>|<%=this.SiteName%>|<%=Order.TotalCost%>|<%=Convert.ToDouble(ProductPrice * Order.SalesTax).ToString("c").Replace("$","")%>|<%=Order.ShippingCost%>|<%=Order.City%>|<%=Order.State%>|<%=Order.Country%> UTM:I|<%=Order.OTCSalesOrderId%><%=this.SiteString%><%=ProductPrice%>|<%=ProductQty%>
            this.m_siteName = siteName == "bm" ? "BetterManNow" : "BetterWomanNow";
            //this.m_googleTrackingCode	= this.m_page.AnalyticsTracking;

            foreach(DataRow dr in dt.Rows)
            {
                int productId = Convert.ToInt32(dr["OTCProductId"]);
                OTCProduct p = new OTCProduct(productId);
                if(p.CategoryId == 21){
                    this.m_siteString += "UTM:T|" + Order.OTCSalesOrderId + "|" + this.SiteName + "|" + Order.TotalCost + "|" + Convert.ToDouble(ProductPrice * Order.SalesTax).ToString("c").Replace("$","") + "|" + Order.ShippingCost + "|" + Order.City + "|" + Order.State + "|" + Order.Country + "UTM:I|" + Order.OTCSalesOrderId + "|BM|BetterMan|Male|" + ProductPrice + "|" + ProductQty  + (char)10;//"|BM|BetterMan|Male|";
                    //this.m_siteName   = "BetterManNow";
                    //this.m_googleTrackingCode = "UA-1185020-2";
                } else {
                    //this.m_siteString = "|BW|BetterWoman|Female|";
                    this.m_siteString += "UTM:T|" + Order.OTCSalesOrderId + "|" + this.SiteName + "|" + Order.TotalCost + "|" + Convert.ToDouble(ProductPrice * Order.SalesTax).ToString("c").Replace("$","") + "|" + Order.ShippingCost + "|" + Order.City + "|" + Order.State + "|" + Order.Country + "UTM:I|" + Order.OTCSalesOrderId + "|BW|BetterWoman|Female|" + ProductPrice + "|" + ProductQty + (char)10;//"|BM|BetterMan|Male|";
                    //this.m_siteName   = "BetterWomanNow";
                    //this.m_googleTrackingCode = "UA-1185020-1";
                }
                m_productPrice = p.Price;
                Session["WantsMembership"] = true;
            }
        }
コード例 #15
0
        /// <summary>
        /// 
        /// </summary>
        public void WriteProductInformation()
        {
            double productCalculator = 0.0; //used for UI purposes only.
            DataTable dt = OTCSalesOrder.GetOrderItems(this.m_order.OTCSalesOrderId);
            Response.Write("<table width=\"100%\" class=\"tableWrapper\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">"
                    + CR + " <tr>"
                    + CR+  "  <td colspan=\"4\" class=\"formHeader\">Your Order Info</td>"
                    + CR + " </tr>"
                    + CR + " <tr>"
                    + CR + "  <td>Product Name</td>"
                    + CR + "  <td>&nbsp;</td>"
                    + CR + "  <td>Product Price</td>"
                    + CR + " </tr>"
                    );

            foreach(DataRow dr in dt.Rows)
            {
                OTCProduct p = new OTCProduct((int)dr["OTCProductId"]);
                Response.Write(" <tr>"
                        + CR + "  <td>" + p.ProductName + "</td>"
                        + CR + "  <td class=\"" +(p.Price != Convert.ToDouble(dr["ItemPrice"]) ? "productInfoStrikeThrough" : "")+ "\">&nbsp;</td>"
                        + CR + "  <td>" + Convert.ToDouble(dr["ItemPrice"]).ToString("c") + "</td>"
                        + CR + " </tr>"
                        );
                productCalculator += p.Price;
            }

            if(this.m_order.OTCPromotionId > 0)
            {
                Response.Write(" <tr height=\"5\"><td></td></tr>" + CR);
                OTC.Web.Promotion.OTCPromotion p = new OTC.Web.Promotion.OTCPromotion(this.m_order.OTCPromotionId);
                if(!(p.HasProducts))
                {
                    if(p.DiscountAmount > 0)
                    {
                        Response.Write(" <tr>"
                                + CR + "  <td>Special Promotion</td>"
                                + CR + "  <td></td>"
                                + CR + "  <td>(-" + p.DiscountAmount.ToString("c") + ")</td>" + CR
                                + CR + " </tr>" + CR
                                );
                    }
                    else
                    {
                        Response.Write(" <tr>"
                                + CR + "  <td>You're eligible for the following promotion -  " + p.PromotionName + " " + p.DiscountPercentage.ToString("p").Split('.')[0] + "% off.</td>"
                                + CR + "  <td></td>"
                                + CR + "  <td>(-" + (productCalculator * p.DiscountPercentage).ToString("c") + ")</td>" + CR
                                + CR + " </tr>" + CR
                            );
                    }
                }
                else
                {
                    Response.Write(" <tr>"
                            + CR + "  <td colspan=\"3\">You're eligible for the following promotion - " + p.PromotionName + ". Please see order price above.</td>"
                            + CR + " </tr>" + CR
                            );
                }

                Response.Write(" <tr height=\"5\"><td></td></tr>" + CR);
                //Response.Write(" <tr><td>&nbsp;</td><td align=\"right\">Final Price:</td><td>" + this.m_order.OrderCost.ToString("c") + "</td></tr>");
            }

            Response.Write(" <tr>"
                    + CR + "  <td>&nbsp;</td>"
                    + CR + "  <td align=\"right\">S/H cost:</td>"
                    + CR + "  <td>" + this.m_order.ShippingCost.ToString("c") + "</td>"
                    + CR + " </tr>" + CR
                    );

            //Response.Write(this.m_order.SalesTax);

            Response.Write(" <tr>"
                    + CR + "  <td>&nbsp;</td>"
                    + CR + "  <td align=\"right\">Sales Tax:</td>"
                    + CR + "  <td>" + (this.m_order.SalesTax * this.m_order.OrderCost).ToString("c") + "</td>"
                    + CR + " </tr>" + CR
                    );

            Response.Write(" <tr>"
                    + CR + "  <td>&nbsp;</td>"
                    + CR + "  <td align=\"right\">Total Cost:</td>"
                    + CR + "  <td>" + this.m_order.TotalCost.ToString("c") + "</td>"
                    + CR + " </tr>" + CR
                    );

            Response.Write("</table>");
            /*
            <table width="100%" border class="tableWrapper">
            <tr valign="top">
            <td width="15%">Total Cost: </td>
            <td><%=this.Product + " " + Order.TotalCost.ToString("c")%></td>
            </tr>
            <tr>
            <td width="15%">Shipping Cost: </td>
            <td><%=Order.ShippingCost.ToString("c")%></td>
            </tr>
            <%this.WritePromotionInformation();%>
            </table>
            */
        }
コード例 #16
0
        public void buildStep1()
        {
            //Note: Using HTML5 in MasterPage.  Table attribute only supports border "" or 1.
            Response.Write("<div align=\"center\">"
                    + CR + "<table width=\"100%\" cellpadding=\"3\" cellspacing=\"2\" border=\"0\" class=\"tableWrapper\">"
                    + CR + " <tr>"
                    + CR + "  <td colspan=\"4\" align=\"left\" class=\"formHeader\"><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><font face=\"arial\" size='4'><b>Your order info: </b></td><td align=\"right\"></td></tr></table></td>"
                    + CR + " </tr>"
                    + CR + " <tr>"
                    + CR + "  <td class=\"rowWrapper\" align=\"left\" width=\"50%\"><font class=\"productHeader\">Product</td>"
                //+ CR + "  <td class=\"rowWrapper\"><font class=\"tableFont\">Quantity</td>"
                    + CR + "  <td class=\"rowWrapper\" align=\"left\"><font class=\"productHeader\">Unit Price</td>"
                    + CR + "  <td class=\"rowWrapper\" align=\"left\"><font class=\"productHeader\">Total Price</td>"
                    + CR + "  <td>&nbsp;</td>"
                    + CR + " </tr><tr><td colspan='4'>&nbsp;</td><tr>" + CR
                    );

            OTCShoppingCart cart = new OTCShoppingCart(this.m_shoppingCartId);
            OTC.Web.Promotion.OTCPromotion p = new OTC.Web.Promotion.OTCPromotion(cart.OTCPromotionId);

            if (cart.CartItems.Length == 0)
                this.btnCheckout.Enabled = false;

            if (cart.CartItems.Length == 0)
            {
                string baseUrl = "http://www.interceuticals.com/interceuticals/product/default.aspx";

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

                if (host.IndexOf("localhost") > -1)
                    baseUrl = "/interceuticals/product/default.aspx";

                Response.Write("<br><br><div align=\"center\" class=\"tableFont\"><font color=\"red\">You have no items in your bag!</font><br><a href=\"" + baseUrl + (this.m_page.IsBetterWoman ? "?site=bw" : "") + "\"><font class=\"tableFont\">continue shopping</a></div><br><br>");
                Control form = this.Page.Controls[0];
                foreach (Control c in form.Controls)
                {
                    if (c.GetType().ToString() == "System.Web.UI.WebControls.TextBox")
                    {
                        System.Web.UI.WebControls.TextBox ctrl = (System.Web.UI.WebControls.TextBox)c;
                        ctrl.Enabled = false;
                    }
                }
            }

            if (cart.CartItems.Length > 0)
            {
                foreach (OTCShoppingCartItem item in cart.CartItems)
                {
                    string memberShipString = "";
                    OTCProduct prod = new OTCProduct(item.ProductID);
                    if (item.ProductPrice * item.ItemCount != item.OrderPrice * item.ItemCount)
                    {
                        Response.Write("<tr><td>" + p.PromotionName + " " + p.PromotionDescription + "</td></tr>");
                        Response.Write(" <tr>"
                                + CR + "  <td align=\"left\" class=\"productInfo\">" + prod.ProductName + " " + memberShipString + "</td>"
                            //+ CR + "  <td class=\"productInfo\">" + item.ItemCount + "</td>"
                                + CR + "  <td align=\"left\" class=\"productInfoStrikeThrough\">" + item.ProductPrice.ToString("c") + "</td>"
                                + CR + "  <td align=\"left\" class=\"productInfo\">" + (item.OrderPrice * item.ItemCount).ToString("c") + "</td>"
                                + CR + "  <td>[ <a href=\"PreCheckOut.aspx?" + Request.QueryString.ToString() + "&remove=" + item.ShoppingCartItemID + "\">remove</a> ]</td>"
                                + CR + " </tr>" + CR
                                );
                    }
                    else
                    {
                        Response.Write(" <tr>"
                                + CR + "  <td align=\"left\" class=\"productInfo\">" + prod.ProductName + " " + memberShipString + "</td>"
                            //+ CR + "  <td class=\"productInfo\">" + item.ItemCount + "</td>"
                                + CR + "  <td align=\"left\" class=\"productInfo\">" + item.ProductPrice.ToString("c") + "</td>"
                                + CR + "  <td align=\"left\" class=\"productInfo\">" + (item.ProductPrice * item.ItemCount).ToString("c") + "</td>"
                                + CR + "  <td>[ <a href=\"PreCheckOut.aspx?" + Request.QueryString.ToString() + "&remove=" + item.ShoppingCartItemID + "\">remove</a> ]</td>"
                                + CR + " </tr>" + CR
                                );
                    }
                    try
                    {
                        if (prod.CategoryId == 21)
                            this.m_googleTrackingCode = "UA-1185020-2";
                        else
                            this.m_googleTrackingCode = "UA-1185020-1";
                    }
                    catch (Exception ex) { }
                }

            }

            Response.Write("<tr><td colspan='4'>&nbsp;</td><tr></table>"
                    + CR + "</div>" + CR
                    );
        }