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