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);
        }
        public ITCCrossSellingProducts(Boolean isBetterWoman)
        {
            isBW = isBetterWoman;

            siteID = isBW == false ? 21 : 22;

            try
            {
                m_db = new OTCDatabase();
                m_db.ConnectionString = Convert.ToString(ConfigurationManager.AppSettings["connection"]);
                m_db.Open();

                //buildProductTable();
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public static DataTable GetProductAssociation(int otcPromotionId)
 {
     DataTable dt   = new DataTable();
     OTCDatabase db = new OTCDatabase();
     db.Open();
     dt = db.GetDataset("spGetOTCProductByPromotion @OTCPromotionID = " + otcPromotionId).Tables[0];
     db.ReleaseConnection();
     return(dt);
 }
        private void Page_Load(object sender, System.EventArgs e)
        {
            //loadJavaScript();

            Session["site"] = this.m_site = Request.QueryString.ToString().IndexOf("site") > - 1 ? Request.QueryString["site"] : "bm";
            this.m_googleTrackingCode = (this.m_site == "bm" ? "UA-1185020-2" : "UA-1185020-1");
            this.m_preselectedProduct = Request.QueryString.ToString().IndexOf("PID")  > - 1 ? Convert.ToInt32(Request.QueryString["PID"]) : 0;
            this.m_thread = Request.QueryString.ToString().IndexOf("thread") > - 1 ? Request.QueryString["thread"] : "";
            this.m_page = new ITCPage();

            this.chkAutoship.Attributes.Add("onClick", "changeAutoShipState()");
            //this.chkNotAutoship.Attributes.Add("onClick", "changeNotAutoShipState()");

            Log.InfoFormat("Starting order for product id: {0}", m_preselectedProduct.ToString());

            if(!Page.IsPostBack)
            {
                if(this.m_thread == "test")
                    this.txtPromotionCode.Text = Request.QueryString["PKEY"];

                OTCDatabase db = new OTCDatabase();
                string categoryId = this.m_site == "bm" ? "21" : "22";
                db.Open();
                this.m_dt = db.GetDataset("spGetINT_VisibleProducts " + categoryId).Tables[0];
                db.ReleaseConnection();

                OTCShoppingCart cart = new OTCShoppingCart(Session.SessionID);

                bool haveSelection = false;

                foreach(DataRow dr in this.m_dt.Rows)
                {
                    ListItem item = new ListItem(dr["DisplayText"].ToString(),dr["OTCProductId"].ToString());
                    if(cart.CartContainsProduct(Convert.ToInt32(item.Value)) || cart.CartContainsProduct(Convert.ToInt32(dr["OTCSubordinateProductId"]))){
                        if(!haveSelection)
                            item.Selected = true;
                        haveSelection = true;
                    }
                    if(!ddProducts.Items.Contains(item))
                        this.ddProducts.Items.Add(item);
                }

                if(Convert.ToBoolean(Session["wantsMembership"]))
                    this.chkAutoship.Checked = true;

                string file = Request.ServerVariables["APPL_PHYSICAL_PATH"] + "Product\\MembershipHTML\\" + this.ddProducts.SelectedValue + ".htm";
                OTCHtmlReader reader = new OTCHtmlReader(file);
                this.m_membershipHTML = reader.HTML;

                DirectoryInfo dInfo = new DirectoryInfo(Request.ServerVariables["APPL_PHYSICAL_PATH"] + "Product\\MembershipHTML\\");

                foreach(FileInfo f in dInfo.GetFiles())
                {
                    reader = new OTCHtmlReader(f.FullName);
                    this.m_hiddenDivs += "<div id=\"div" + f.Name.Replace(".htm","") + "\" class=\"hidden\">" + reader.HTML + "</div>" + CR;
                }
            }
        }
        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");

            }
        }
Exemple #6
0
 /// <summary>
 /// 
 /// </summary>
 public ITC()
 {
     this.db = new OTCDatabase();
     this.m_siteId = Convert.ToInt32(ConfigurationManager.AppSettings["applicationId"]);
 }
        private void Page_Load(object sender, System.EventArgs e)
        {
            this.m_page = new ITCPage();
            this.m_page.HideWest = true;

            if(!(this.m_page.CheckLogin()))
                Response.Redirect("/interceuticals/admin/login.aspx");

            if(!Page.IsPostBack)
            {
                this.m_thread = Request.QueryString.ToString().IndexOf("thread") > - 1 ? Request.QueryString["thread"] : "";
                switch(this.m_thread)
                {
                    case "AC":
                        OTCDatabase db = new OTCDatabase();
                        db.Open();
                        int reportId = Convert.ToInt32(db.GetDataset("SELECT EngagementReportId FROM EngagementReport WHERE SQL = 'spGetReport_CoordinatorDocument'").Tables[0].Rows[0]["EngagementReportId"]);
                        db.ReleaseConnection();
                        string lineOrderNumber = Request.QueryString["LON"];
                        Response.Write(reportId + " " + lineOrderNumber);
                        Response.Redirect("default.aspx?RID=" + reportId + "&LON=" + lineOrderNumber);
                        break;
                }

                DateTime startDate  = Convert.ToDateTime(System.DateTime.Now.Month.ToString() + "/1/" + System.DateTime.Now.Year.ToString());
                DateTime endDate    = System.DateTime.Now.AddDays(1);
                this.txtReportTypeId.Value = Request.QueryString["RID"];
                OTCReport report = new OTCReport(Convert.ToInt32(Request.QueryString["RID"]));
                this.lblReportHeader.Text = report.OTCReportName;
                this.lblDescription.Text = report.OTCReportDescription;
                this.cldStartDate.VisibleDate = startDate;
                this.cldEndDate.VisibleDate = endDate;
                this.cldStartDate.SelectedDate = startDate;
                this.cldEndDate.SelectedDate = endDate;
                ///his.ddLineOrders.Visible = false;
                //this.ddPartner.Visible = false;

                string strCookieValue = "";

                //Grab the cookie
                HttpCookie cookie = Request.Cookies["ExportToExcel"];

                //Check to make sure the cookie exists
                if (null != cookie)
                {
                    //Write the cookie value
                    strCookieValue = cookie.Value.ToString();
                }
                if(strCookieValue == "true")
                    this.chkExport.Checked = true;

                /*
                if((report.ReportRestrictions & (int)EDGAReport.Restriction.PartnerSpecific) > 0)
                {
                    this.ddPartner.Visible = true;
                    this.ddPartner.Fill();
                }

                if((report.ReportRestrictions & (int)EDGAReport.Restriction.LineOrderSpecific) > 0)
                {
                    this.ddLineOrders.Visible = true;
                    this.ddLineOrders.Fill();
                    if(Request.QueryString.ToString().IndexOf("LON") > - 1){
                        string lineOrderNumber = Request.QueryString["LON"];
                        this.ddLineOrders.SetActiveItem(lineOrderNumber);
                        this.ddLineOrders.Enabled = false;
                        BTG.ITPaper.BTGLineOrder lineOrder = new BTG.ITPaper.BTGLineOrder(Convert.ToInt32(lineOrderNumber));
                        this.cldStartDate.VisibleDate = lineOrder.StartDate;
                        this.cldEndDate.VisibleDate = System.DateTime.Now;
                        this.cldStartDate.SelectedDate = lineOrder.StartDate;
                        this.cldEndDate.SelectedDate = System.DateTime.Now;
                    }
                }
                */
            }
        }
        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;
            }
        }