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; } */ }
/// <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> </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>"); }
protected void Page_Load(object sender, EventArgs e) { ArrayList products = new ArrayList(); int otcSiteMemberId = Convert.ToInt32(Request.Form["user1"]); int otcSalesOrderId = Convert.ToInt32(Request.Form["user2"]); int result = 0; string authCode = "111111"; string responseMessage = "Denied"; string avsData = "YYY"; string pnrRef = "VPCE3F1D15B1"; //string cardNumber = Request.Form["CARDNUM"]; OTCVerisignTransaction tran = new OTCVerisignTransaction(); OTCSalesOrder order = new OTCSalesOrder(otcSalesOrderId); tran.AuthCode = authCode.ToString(); tran.OTCSalesOrderId = otcSalesOrderId; tran.OTCSiteMemberId = otcSiteMemberId; tran.AVSData = avsData; tran.Cost = order.TotalCost; tran.PNRRef = pnrRef; tran.ResponseMessage = responseMessage; tran.Result = result; tran.Add(); if (responseMessage.ToLower() == "approved") { string mailBody = OTCSalesOrder.GetEmailProductString(order.OTCSalesOrderId); EmailSender mail = new EmailSender(); String subject = "Order Confirmation - Interceuticals Order " + order.OTCSalesOrderId; String notifyEmails = "*****@*****.**"; mail.AddEmailAddresses(notifyEmails); String error = mail.SendEmail(subject, mailBody); if (error == "") Response.Write("Successfully sent email.<br>"); else Response.Write("Error in sending email. " + error); OTC.Web.Promotion.OTCPromotion pr = new OTC.Web.Promotion.OTCPromotion(order.OTCPromotionId); pr.AddPromotionUsage(order.OTCSiteMemberId, order.OTCSalesOrderId); try { //HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create("https://loc1.hitsprocessor.com/confirmation.asp?acct=interceut1&type=60682&s=1&uniqueId=" + order.OTCSalesOrderId + "&orderAmount=" + order.OrderCost); //HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse(); //Response.Write("hit processesor o.k. <br>"); HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create("http://*****:*****@cox.net"; mail.AddEmailAddresses(notifyEmails); mail.SendEmail(subject, mailBody); } } else setAbandoned(tran.OTCSiteMemberId); }
private void Page_Load(object sender, System.EventArgs e) { ArrayList products = new ArrayList(); int otcSiteMemberId = Convert.ToInt32(Request.Form["user1"]); int otcSalesOrderId = Convert.ToInt32(Request.Form["user2"]); SiteName = Request.Form["user3"]; CrossDomainTracking = Request.Form["user4"]; int result = Convert.ToInt32(Request.Form["RESULT"]); string authCode = Request.Form["AUTHCODE"]; string responseMessage = Request.Form["RESPMSG"]; string avsData = Request.Form["AVSDATA"]; string pnrRef = Request.Form["PNREF"]; //string cardNumber = Request.Form["CARDNUM"]; OTCVerisignTransaction tran = null; OTCSalesOrder order = null; try { Log.Info("Received post from paypal."); Log.InfoFormat("MemberID = {0} SalesOrderID = {1} Result = {2} AuthCode = {3} ResponseMessage = {4}", otcSiteMemberId.ToString(), otcSalesOrderId.ToString(), result.ToString(), authCode, responseMessage); tran = new OTCVerisignTransaction(); order = new OTCSalesOrder(otcSalesOrderId); //OTCCreditCard card = new OTCCreditCard(10181); //card.CardNumber = cardNumber; ////card.ExpirationMonth = 7.ToString(); //card.ExpirationYear = 2007.ToString(); //card.OTCSiteMemberId = otcSiteMemberId; //card.Add(); //FFTProduct product = new FFTProduct(productId); //UNCOMMENT ALL THIS tran.AuthCode = authCode.ToString(); tran.OTCSalesOrderId = otcSalesOrderId; tran.OTCSiteMemberId = otcSiteMemberId; tran.AVSData = avsData; tran.Cost = order.TotalCost; tran.PNRRef = pnrRef; tran.ResponseMessage = responseMessage; tran.Result = result; tran.Add(); m_order = order; } catch (Exception error) { Log.Error("Unable to complete Paypal transaction.", error); } if (responseMessage.ToLower() == "approved") { string mailBody = OTCSalesOrder.GetEmailProductString(order.OTCSalesOrderId); EmailSender mail = new EmailSender("*****@*****.**", "BetterMAN.BetterWOMAN"); String subject = "Order Confirmation - Interceuticals Order " + order.OTCSalesOrderId; String notifyEmails = order.EmailAddress; mail.AddEmailAddresses(order.EmailAddress); mail.AddBccEmailAddresses(AppLookup.RecipientsOrders); String error = mail.SendEmail(subject, mailBody); if (error == "") Response.Write("Successfully sent email.<br>"); else { Response.Write("Error in sending email. " + error); Log.Error(error); } OTC.Web.Promotion.OTCPromotion pr = new OTC.Web.Promotion.OTCPromotion(order.OTCPromotionId); pr.AddPromotionUsage(order.OTCSiteMemberId, order.OTCSalesOrderId); try { HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create("https://loc1.hitsprocessor.com/confirmation.asp?acct=interceut1&type=60682&s=1&uniqueId=" + order.OTCSalesOrderId + "&orderAmount=" + order.OrderCost); HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse(); Response.Write("hit processesor o.k. <br>"); /* webreq = (HttpWebRequest)WebRequest.Create("http://www.betterwomannow.com/Interceuticals/Common/Marketing/BetterWoman.aspx?OID=" + order.OTCSalesOrderId); webresp = (HttpWebResponse)webreq.GetResponse(); webreq = (HttpWebRequest)WebRequest.Create("http://www.bettermannow.com/Interceuticals/Common/Marketing/BetterMan.aspx?OID=" + order.OTCSalesOrderId); webresp = (HttpWebResponse)webreq.GetResponse(); Response.Write("mailsent o.k. <br>"); */ } catch (Exception ex) { if (mail == null) mail = new EmailSender(); subject = "ERROR: Order Confirmation - Interceuticals Order " + order.OTCSalesOrderId; mailBody = ex.Message; notifyEmails = "*****@*****.**"; mail.AddEmailAddresses(notifyEmails); mail.SendEmail(subject, mailBody); } } else setAbandoned(tran.OTCSiteMemberId); }
/// <summary> /// /// </summary> public void WritePromotionInformation() { if(this.m_order.OTCPromotionId > 0) { OTC.Web.Promotion.OTCPromotion p = new OTC.Web.Promotion.OTCPromotion(this.m_order.OTCPromotionId); if(p.IsOrderBased) { Response.Write("<tr><td colspan=\"5\"><b>" + p.PromotionKey + " : " + p.PromotionName + "</td></tr>"); } } }
/// <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> </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" : "")+ "\"> </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> </td><td align=\"right\">Final Price:</td><td>" + this.m_order.OrderCost.ToString("c") + "</td></tr>"); } Response.Write(" <tr>" + CR + " <td> </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> </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> </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> */ }
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> </td>" + CR + " </tr><tr><td colspan='4'> </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'> </td><tr></table>" + CR + "</div>" + CR ); }