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"); } }
/// <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); }
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; } }