Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (AppLogic.AppConfigBool("GoNonSecureAgain"))
     {
         SkinBase.GoNonSecureAgain();
     }
     // set the Customer context, and set the SkinBase context, so meta tags t be set if they are not blank in the XmlPackage results
     Package1.SetContext = this;
     if (Package1.PackageName.Length == 0)
     {
         String PN = CommonLogic.QueryStringCanBeDangerousContent("PackageName");
         if (PN.Length == 0)
         {
             PN = CommonLogic.QueryStringCanBeDangerousContent("XmlPackage");
         }
         if (PN.Length == 0)
         {
             PN = CommonLogic.QueryStringCanBeDangerousContent("Package");
         }
         PN = PN.ToLowerInvariant();
         AppLogic.CheckForScriptTag(PN);
         if (PN.Length == 0)
         {
             Package1.PackageName = "helloworld.xml.config";
         }
         else
         {
             Package1.PackageName = PN;
         }
     }
     if (Package1.ContentType.Length != 0)
     {
         Page.Response.ContentType = Package1.ContentType;
     }
 }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ProductID = CommonLogic.QueryStringUSInt("ProductID");

            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }
            // DOS attack prevention:
            if (AppLogic.OnLiveServer() && (Request.UrlReferrer == null || Request.UrlReferrer.Authority != Request.Url.Authority))
            {
                Response.Redirect(SE.MakeDriverLink("EmailError"));
            }
            if (ProductID == 0)
            {
                Response.Redirect("~/default.aspx");
            }
            if (AppLogic.ProductHasBeenDeleted(ProductID))
            {
                Response.Redirect(SE.MakeDriverLink("ProductNotFound"));
            }


            EmailProduct ep = (EmailProduct)LoadControl("~/Controls/EmailProduct.ascx");

            ep.ProductID = ProductID;

            pnlContent.Controls.Add(ep);
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }
            SectionTitle = AppLogic.GetString("sitemap.aspx.1", SkinID, ThisCustomer.LocaleSetting);
            String XmlPackageName = AppLogic.AppConfig("XmlPackage.SiteMapPage");

            if (XmlPackageName.Length != 0)
            {
                XmlPackageControl ctrl = this.LoadControl("XmlPackageControl.ascx") as XmlPackageControl;
                ctrl.EnforceDisclaimer   = true;
                ctrl.EnforcePassword     = true;
                ctrl.EnforceSubscription = true;
                ctrl.AllowSEPropogation  = true;
                ctrl.ThisCustomer        = ThisCustomer;
                ctrl.PackageName         = XmlPackageName;
                ctrl.SetContext          = this;
                PackagePanel.Controls.Add(ctrl);

                PackagePanel.Visible = true;
                EntityPanel.Visible  = false;
            }
            else
            {
                PackagePanel.Visible = false;
                EntityPanel.Visible  = true;

                Literal1.Text = getXMLTransform();
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (CommonLogic.ServerVariables("HTTP_HOST").IndexOf(AppLogic.LiveServer(), StringComparison.InvariantCultureIgnoreCase) != -1 &&
                CommonLogic.ServerVariables("HTTP_HOST").IndexOf("WWW", StringComparison.InvariantCultureIgnoreCase) == -1)
            {
                if (AppLogic.RedirectLiveToWWW())
                {
                    Response.Redirect("http://www." + AppLogic.LiveServer().ToLowerInvariant());
                }
            }

            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }

            // this may be overwridden by the XmlPackage below!
            SectionTitle = String.Format(AppLogic.GetString("default.aspx.1", SkinID, ThisCustomer.LocaleSetting), AppLogic.AppConfig("StoreName"));

            Package1.PackageName = "page.default.xml.config";

            // set the Customer context, and set the SkinBase context, so meta tags to be set if they are not blank in the XmlPackage results
            Package1.SetContext = this;

            // unsupported feature:
            //System.Diagnostics.Trace.WriteLineIf(Config.TraceLevel.TraceVerbose, "Welcome to AspDotNetStorefront");
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SkinBase skinBase = (SkinBase)this.Page;
            Page     page     = skinBase.Page;

            string pageName = page.GetType().Name;

            liAccount.Attributes.Remove("class");
            liShipping.Attributes.Remove("class");
            liPayment.Attributes.Remove("class");
            liReview.Attributes.Remove("class");
            liComplete.Attributes.Remove("class");

            switch (pageName)
            {
            case "checkoutanon_aspx":
            case "createaccount_aspx":
            case "account_aspx":
                liAccount.Attributes.Add("class", "active");
                lnkShipping.Enabled = false;
                lnkPayment.Enabled  = false;
                lnkReview.Enabled   = false;
                lnkComplete.Enabled = false;
                break;

            case "checkoutshippingmult_aspx":
            case "checkoutshippingmult2_aspx":
            case "checkoutshipping_aspx":
                liShipping.Attributes.Add("class", "active");
                lnkPayment.Enabled  = false;
                lnkReview.Enabled   = false;
                lnkComplete.Enabled = false;
                break;

            case "checkoutgiftcard_aspx":
            case "checkoutpayment_aspx":
                liPayment.Attributes.Add("class", "active");
                lnkReview.Enabled   = false;
                lnkComplete.Enabled = false;
                break;

            case "checkoutreview_aspx":
                liReview.Attributes.Add("class", "active");
                lnkComplete.Enabled = false;
                break;

            case "orderconfirmation_aspx":
                liComplete.Attributes.Add("class", "active");
                lnkAccount.Enabled  = false;
                lnkShipping.Enabled = false;
                lnkPayment.Enabled  = false;
                lnkReview.Enabled   = false;
                lnkComplete.Enabled = false;
                break;

            default:
                break;
            }
        }
Ejemplo n.º 6
0
 public ShowEntityPage(EntitySpecs eSpecs, SkinBase sb)
 {
     m_EntitySpecs      = eSpecs;
     m_SkinBase         = sb;
     m_EntityHelper     = AppLogic.LookupHelper(m_EntitySpecs.m_EntityName, 0);
     m_ResourcePrefix   = String.Format("show{0}.aspx.", m_EntitySpecs.m_EntityName.ToLowerInvariant());
     m_EntityInstanceID = CommonLogic.QueryStringUSInt(m_EntityHelper.GetEntitySpecs.m_EntityName + "ID");
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (AppLogic.AppConfigBool("GoNonSecureAgain"))
     {
         SkinBase.GoNonSecureAgain();
     }
     // set the Customer context, and set the SkinBase context, so meta tags t be set if they are not blank in the XmlPackage results
     Package1.SetContext = this;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");

            SkinBase.RequireSecurePage();
            OrderNumber = CommonLogic.QueryStringUSInt("ordernumber");
            int OrderCustomerID = Order.GetOrderCustomerID(OrderNumber);

            customerLevelId = Order.GetOrderCustomerLevelID(OrderNumber);

            // currently viewing user must be logged in to view receipts:
            if (!ThisCustomer.IsRegistered)
            {
                Response.Redirect("signin.aspx?returnurl=receipt.aspx?" +
                                  Server.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING")));
            }

            // are we allowed to view?
            // if currently logged in user is not the one who owns the order, and this is not an admin user who is logged in, reject the view:
            if (ThisCustomer.CustomerID != OrderCustomerID && !ThisCustomer.IsAdminUser && !IsSubordinateDealer(OrderCustomerID))
            {
                Response.Redirect("OrderNotFound.aspx");
            }

            //For multi store checking
            //Determine if customer is allowed to view orders from other store.
            if (!ThisCustomer.IsAdminUser && AppLogic.StoreID() != AppLogic.GetOrdersStoreID(OrderNumber) &&
                AppLogic.GlobalConfigBool("AllowCustomerFiltering") == true)
            {
                Response.Redirect("OrderNotFound.aspx");
            }

            if (!Page.IsPostBack)
            {
                ClientScriptManager cs = Page.ClientScript;
                cs.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "function ReOrder(OrderNumber) {if(confirm('" + AppLogic.GetString("account.aspx.64", SkinID, ThisCustomer.LocaleSetting) + "')) {top.location.href='reorder.aspx?ordernumber='+OrderNumber;} }", true);
                OrderNumber = CommonLogic.QueryStringUSInt("OrderNumber");
                GetOrderInfo();
                GetOrderItemsDetail();
                SetTrackingInfo();
                hplReOrder.NavigateUrl = "javascript: ReOrder(" + OrderNumber + ");";

                if (ThisCustomer.IsAdminUser)
                {
                    btnResendInfotoFulfillmentAPI.Visible = AppLogic.AppConfig("AllowFulfillmentAPIResend").ToBool();
                }

                if (ThisCustomer.CustomerID != OrderCustomerID)
                {
                    hplPrintReceipt.Visible = false;
                    hplReOrder.Visible      = false;
                }
            }
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }
            SectionTitle = AppLogic.GetString("sitemap.aspx.1", SkinID, ThisCustomer.LocaleSetting);
            //SiteMap1.LoadXml(new SiteMapComponentArt(base.EntityHelpers,SkinID,ThisCustomer).Contents);

            Boolean showCustomerService = AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowCustomerService");

            SiteMap1.LoadXml(new SiteMap(showCustomerService).Contents);
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }

            // this may be overwridden by the XmlPackage below!
            SectionTitle = AppLogic.GetString("news.aspx.1", SkinID, ThisCustomer.LocaleSetting);

            // set the Customer context, and set the SkinBase context, so meta tags to be set if they are not blank in the XmlPackage results
            XmlPackage1.SetContext = this;
        }
Ejemplo n.º 11
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }

            // this may be overwridden by the XmlPackage below!
            SectionTitle = "<img src=\"" + AppLogic.LocateImageURL("App_Themes/skin_" + SkinID.ToString() + "/images/downarrow.gif") + "\" align=\"absmiddle\" border=\"0\"> " + AppLogic.GetString("galleries.aspx.1", SkinID, ThisCustomer.LocaleSetting);

            // set the Customer context, and set the SkinBase context, so meta tags to be set if they are not blank in the XmlPackage results
            XmlPackage1.SetContext = this;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");

            SkinBase.RequireSecurePage();

            OrderNumber = CommonLogic.QueryStringUSInt("ordernumber");
            int OrderCustomerID = Order.GetOrderCustomerID(OrderNumber);

            lnkreceipt.HRef = "OrderReceipt.aspx?ordernumber=" + OrderNumber.ToString() + "&customerid=" + OrderCustomerID.ToString();

            Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer;

            // who is logged in now viewing this page:

            // currently viewing user must be logged in to view receipts:
            if (!ThisCustomer.IsRegistered)
            {
                Response.Redirect("signin.aspx?returnurl=receipt.aspx?" +
                                  Server.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING")));
            }

            // are we allowed to view?
            // if currently logged in user is not the one who owns the order, and this is not an admin user who is logged in, reject the view:
            if (ThisCustomer.CustomerID != OrderCustomerID && !ThisCustomer.IsAdminUser)
            {
                Response.Redirect("OrderNotFound.aspx");
            }

            //For multi store checking
            //Determine if customer is allowed to view orders from other store.
            if (!ThisCustomer.IsAdminUser && AppLogic.StoreID() != AppLogic.GetOrdersStoreID(OrderNumber) &&
                AppLogic.GlobalConfigBool("AllowCustomerFiltering") == true)
            {
                Response.Redirect("OrderNotFound.aspx");
            }
            if (!Page.IsPostBack)
            {
                GetOrderInfo();
                GetOrderItemsDetail();
                SendOrderinfotoRRD();
                // get the billing address
                Address BillingAddress = new Address();
                BillingAddress.LoadFromDB(ThisCustomer.PrimaryBillingAddressID);
                litPaymentMethod.Text = GetPaymentMethod(BillingAddress);
            }
        }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }
            if (!ThisCustomer.IsRegistered)
            {
                dtlPolls.Visible = false;
            }

            lblPoll.Text = AppLogic.GetString("polls.aspx.2", ThisCustomer.SkinID, ThisCustomer.LocaleSetting);

            InitializeDataSource();
        }
Ejemplo n.º 14
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }
            SectionTitle = AppLogic.GetString("searchadv.aspx.1", SkinID, ThisCustomer.LocaleSetting);

            String st = CommonLogic.QueryStringCanBeDangerousContent("SearchTerm").Trim();

            if (st.Length != 0)
            {
                DB.ExecuteSQL("insert into SearchLog(SearchTerm,CustomerID,LocaleSetting) values(" + DB.SQuote(CommonLogic.Ellipses(st, 97, true)) + "," + ThisCustomer.CustomerID.ToString() + "," + DB.SQuote(ThisCustomer.LocaleSetting) + ")");
            }

            Package1.SetContext = this;
        }
Ejemplo n.º 15
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");

            SkinBase.RequireSecurePage();

            int OrderNumber     = CommonLogic.QueryStringUSInt("OrderNumber");
            int OrderCustomerID = Order.GetOrderCustomerID(OrderNumber);

            Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer;// who is logged in now viewing this page:

            // currently viewing user must be logged in to view receipts:
            if (!ThisCustomer.IsRegistered)
            {
                Response.Redirect("signin.aspx?returnurl=receipt.aspx?" + Server.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING")));
            }

            // are we allowed to view?
            // if currently logged in user is not the one who owns the order, and this is not an admin user who is logged in, reject the view:
            if (ThisCustomer.CustomerID != OrderCustomerID && !ThisCustomer.IsAdminUser)
            {
                Response.Redirect(SE.MakeDriverLink("ordernotfound"));
            }

            //For multi store checking
            //Determine if customer is allowed to view orders from other store.
            if (!ThisCustomer.IsAdminUser && AppLogic.StoreID() != AppLogic.GetOrdersStoreID(OrderNumber) && AppLogic.GlobalConfigBool("AllowCustomerFiltering") == true)
            {
                Response.Redirect(SE.MakeDriverLink("ordernotfound"));
            }

            Order o = new Order(OrderNumber, ThisCustomer.LocaleSetting);

            if (o.PaymentMethod != null && o.PaymentMethod.ToLower() == GatewayCheckoutByAmazon.CheckoutByAmazon.CBA_Gateway_Identifier.ToLower())
            {
                GatewayCheckoutByAmazon.CheckoutByAmazon checkoutByAmazon = new GatewayCheckoutByAmazon.CheckoutByAmazon();
                Response.Write(checkoutByAmazon.RenderOrderDetailWidget(o.OrderNumber));
            }
            else
            {
                Response.Write(o.Receipt(ThisCustomer, false));
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");

            SkinBase.RequireSecurePage();

            OrderNumber = CommonLogic.QueryStringUSInt("ordernumber");
            int OrderCustomerID = Order.GetOrderCustomerID(OrderNumber);

            customerLevelId = Order.GetOrderCustomerLevelID(OrderNumber);

            // currently viewing user must be logged in to view receipts:
            if (!ThisCustomer.IsRegistered)
            {
                Response.Redirect("signin.aspx?returnurl=receipt.aspx?" +
                                  Server.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING")));
            }

            // are we allowed to view?
            // if currently logged in user is not the one who owns the order, and this is not an admin user who is logged in, reject the view:
            if (ThisCustomer.CustomerID != OrderCustomerID && !ThisCustomer.IsAdminUser)
            {
                Response.Redirect("OrderNotFound.aspx");
            }

            //For multi store checking
            //Determine if customer is allowed to view orders from other store.
            if (!ThisCustomer.IsAdminUser && AppLogic.StoreID() != AppLogic.GetOrdersStoreID(OrderNumber) &&
                AppLogic.GlobalConfigBool("AllowCustomerFiltering") == true)
            {
                Response.Redirect("OrderNotFound.aspx");
            }

            if (!Page.IsPostBack)
            {
                GetOrderInfo();
                GetOrderItemsDetail();
            }
        }
Ejemplo n.º 17
0
        protected override void OnInit(EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }

            // this may be overwridden by the XmlPackage below!
            SectionTitle = AppLogic.GetString("search.aspx.1", SkinID, ThisCustomer.LocaleSetting);

            string searchTermFromQueryString = CommonLogic.QueryStringCanBeDangerousContent("SearchTerm");

            if (!CommonLogic.IsStringNullOrEmpty(searchTermFromQueryString) &&
                AppLogic.AppConfigUSInt("MinSearchStringLength") <= searchTermFromQueryString.Length)
            {
                ctrlPageSearch.SearchText = searchTermFromQueryString;
                RunSearch(searchTermFromQueryString);
            }

            base.OnInit(e);
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }

            // this may be overwridden by the XmlPackage below!
            SectionTitle = AppLogic.GetString("requestcatalog.aspx.1", SkinID, ThisCustomer.LocaleSetting);

            reqFName.ErrorMessage = AppLogic.GetString("requestcatalog.aspx.9", SkinID, ThisCustomer.LocaleSetting);
            reqLName.ErrorMessage = AppLogic.GetString("requestcatalog.aspx.11", SkinID, ThisCustomer.LocaleSetting);
            reqAddr1.ErrorMessage = AppLogic.GetString("requestcatalog.aspx.14", SkinID, ThisCustomer.LocaleSetting);
            reqCity.ErrorMessage  = AppLogic.GetString("requestcatalog.aspx.18", SkinID, ThisCustomer.LocaleSetting);
            reqZip.ErrorMessage   = AppLogic.GetString("requestcatalog.aspx.22", SkinID, ThisCustomer.LocaleSetting);


            if (!IsPostBack)
            {
                InitializePageContent();
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public void Page_Load(object sender, EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }

            n = m_EntityHelper.m_TblMgr.SetContext(m_EntityInstanceID);
            //Determine if the entity is map to the current store.
            if (n == null)
            {
                HttpContext.Current.Response.Redirect("~/default.aspx");
            }
            //Checking for multi store.
            CachelessStore store = new CachelessStore();

            store.StoreID = AppLogic.StoreID();
            MappedObject map = store.GetMapping(m_EntitySpecs.m_EntityName, m_EntityInstanceID);

            if (AppLogic.GlobalConfigBool("AllowEntityFiltering") == true && !map.IsMapped)
            {
                HttpContext.Current.Response.Redirect("~/default.aspx");
            }
            m_ThisEntityNodeContext = n;

            String SENameINURL = CommonLogic.QueryStringCanBeDangerousContent("SEName");

            if (SENameINURL.Equals(XmlCommon.XmlField(GetActiveEntityNodeContext, "SEName"), StringComparison.InvariantCultureIgnoreCase) == false)
            {
                string QS     = BuildQueryString();
                String NewURL = string.Format("{0}{1}{2}", AppLogic.GetStoreHTTPLocation(false, false), SE.MakeEntityLink(m_EntityHelper.GetEntitySpecs.m_EntityName, m_EntityInstanceID, XmlCommon.XmlField(GetActiveEntityNodeContext, "SEName")), QS);
                HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>");
                HttpContext.Current.Response.Status = "301 Moved Permanently";
                HttpContext.Current.Response.AddHeader("Location", NewURL);
                m_URLValidated = false;
            }

            if (m_URLValidated)
            {
                m_CategoryFilterID     = CommonLogic.QueryStringUSInt("CategoryFilterID");
                m_SectionFilterID      = CommonLogic.QueryStringUSInt("SectionFilterID");
                m_ProductTypeFilterID  = CommonLogic.QueryStringUSInt("ProductTypeFilterID");
                m_ManufacturerFilterID = CommonLogic.QueryStringUSInt("ManufacturerFilterID");
                m_DistributorFilterID  = CommonLogic.QueryStringUSInt("DistributorFilterID");
                m_GenreFilterID        = CommonLogic.QueryStringUSInt("GenreFilterID");
                m_VectorFilterID       = CommonLogic.QueryStringUSInt("VectorFilterID");

                if (CommonLogic.QueryStringCanBeDangerousContent("CategoryFilterID").Length == 0)
                {
                    if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") && CommonLogic.CookieUSInt("CategoryFilterID") != 0)
                    {
                        m_CategoryFilterID = CommonLogic.CookieUSInt("CategoryFilterID");
                    }
                }

                if (CommonLogic.QueryStringCanBeDangerousContent("SectionFilterID").Length == 0)
                {
                    if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") && CommonLogic.CookieUSInt("SectionFilterID") != 0)
                    {
                        m_SectionFilterID = CommonLogic.CookieUSInt("SectionFilterID");
                    }
                }

                if (CommonLogic.QueryStringCanBeDangerousContent("ProductTypeFilterID").Length == 0)
                {
                    if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") && CommonLogic.CookieUSInt("ProductTypeFilterID") != 0)
                    {
                        m_ProductTypeFilterID = CommonLogic.CookieUSInt("ProductTypeFilterID");
                    }
                    if (m_ProductTypeFilterID != 0 &&
                        !AppLogic.ProductTypeHasVisibleProducts(m_ProductTypeFilterID))
                    {
                        m_ProductTypeFilterID = 0;
                    }
                }

                if (CommonLogic.QueryStringCanBeDangerousContent("ManufacturerFilterID").Length == 0)
                {
                    if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") &&
                        CommonLogic.CookieUSInt("ManufacturerFilterID") != 0)
                    {
                        m_ManufacturerFilterID = CommonLogic.CookieUSInt("ManufacturerFilterID");
                    }
                }

                if (CommonLogic.QueryStringCanBeDangerousContent("DistributorFilterID").Length == 0)
                {
                    if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") &&
                        CommonLogic.CookieUSInt("DistributorFilterID") != 0)
                    {
                        m_DistributorFilterID = CommonLogic.CookieUSInt("DistributorFilterID");
                    }
                }

                if (CommonLogic.QueryStringCanBeDangerousContent("GenreFilterID").Length == 0)
                {
                    if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") &&
                        CommonLogic.CookieUSInt("GenreFilterID") != 0)
                    {
                        m_GenreFilterID = CommonLogic.CookieUSInt("GenreFilterID");
                    }
                }

                if (CommonLogic.QueryStringCanBeDangerousContent("VectorFilterID").Length == 0)
                {
                    if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") &&
                        CommonLogic.CookieUSInt("VectorFilterID") != 0)
                    {
                        m_VectorFilterID = CommonLogic.CookieUSInt("VectorFilterID");
                    }
                }

                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length != 0)
                {
                    m_CategoryFilterID     = 0;
                    m_SectionFilterID      = 0;
                    m_ManufacturerFilterID = 0;
                    m_DistributorFilterID  = 0;
                    m_GenreFilterID        = 0;
                    m_VectorFilterID       = 0;
                    m_ProductTypeFilterID  = 0;
                }

                if (AppLogic.AppConfigBool("PersistFilters"))
                {
                    HttpContext.Current.Profile.SetPropertyValue("CategoryFilterID", m_CategoryFilterID.ToString());
                    HttpContext.Current.Profile.SetPropertyValue("SectionFilterID", m_SectionFilterID.ToString());
                    HttpContext.Current.Profile.SetPropertyValue("ManufacturerFilterID", m_ManufacturerFilterID.ToString());
                    HttpContext.Current.Profile.SetPropertyValue("DistributorFilterID", m_DistributorFilterID.ToString());
                    HttpContext.Current.Profile.SetPropertyValue("GenreFilterID", m_GenreFilterID.ToString());
                    HttpContext.Current.Profile.SetPropertyValue("VectorFilterID", m_VectorFilterID.ToString());
                    HttpContext.Current.Profile.SetPropertyValue("ProductTypeFilterID", m_ProductTypeFilterID.ToString());
                }

                m_EntityInstanceName = m_EntityHelper.m_TblMgr.CurrentName(n, m_SkinBase.ThisCustomer.LocaleSetting);

                HttpContext.Current.Profile.SetPropertyValue("LastViewedEntityName", m_EntitySpecs.m_EntityName);
                HttpContext.Current.Profile.SetPropertyValue("LastViewedEntityInstanceID", m_EntityInstanceID.ToString());
                HttpContext.Current.Profile.SetPropertyValue("LastViewedEntityInstanceName", m_EntityInstanceName);

                #region Vortx Mobile Xml Package Modification
                m_XmlPackage = Vortx.MobileFramework.MobileXmlPackageController.XmlPackageHook(m_EntityHelper.m_TblMgr.CurrentField(n, "XmlPackage").ToLowerInvariant(), m_SkinBase.ThisCustomer);
                #endregion
                if (m_XmlPackage.Length == 0)
                {
                    m_XmlPackage = AppLogic.ro_DefaultEntityXmlPackage; // provide a default for backwards compatibility
                }


                String RunTimeParms = String.Format("EntityName={0}&EntityID={1}", m_EntitySpecs.m_EntityName, m_EntityInstanceID.ToString());

                RunTimeParms += String.Format("&CatID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("CATEGORY", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_CategoryFilterID.ToString()));
                RunTimeParms += String.Format("&SecID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("SECTION", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_SectionFilterID.ToString()));
                RunTimeParms += String.Format("&ManID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("MANUFACTURER", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_ManufacturerFilterID.ToString()));
                RunTimeParms += String.Format("&DistID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("DISTRIBUTOR", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_DistributorFilterID.ToString()));
                RunTimeParms += String.Format("&GenreID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("GENRE", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_GenreFilterID.ToString()));
                RunTimeParms += String.Format("&VectorID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("VECTOR", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_VectorFilterID.ToString()));
                RunTimeParms += String.Format("&ProductTypeFilterID={0}", m_ProductTypeFilterID.ToString());

                // CacheEntityPageHTML is an UNSUPPORTED and UNDOCUMENTED AppConfig
                // caching does NOT honor cross entity filtering, or other filters. Use it only on high traffic sites
                // with entity pages that do NOT vary by params other than those used in the CacheName string below.
                // if you are showing prices, they will remain the same during the cache duration (AppLogic.CacheDurationMinutes setting, usually 1 hr)
                String CacheName = String.Empty;


                m_SkinBase.SETitle = m_EntityHelper.m_TblMgr.CurrentFieldByLocale(n, "SETitle", m_SkinBase.ThisCustomer.LocaleSetting);
                if (m_SkinBase.SETitle.Length == 0)
                {
                    m_SkinBase.SETitle = Security.HtmlEncode(AppLogic.AppConfig("StoreName") + " - " + m_EntityInstanceName);
                }
                m_SkinBase.SEDescription = m_EntityHelper.m_TblMgr.CurrentFieldByLocale(n, "SEDescription", m_SkinBase.ThisCustomer.LocaleSetting);
                if (m_SkinBase.SEDescription.Length == 0)
                {
                    m_SkinBase.SEDescription = Security.HtmlEncode(m_EntityInstanceName);
                }
                m_SkinBase.SEKeywords = m_EntityHelper.m_TblMgr.CurrentFieldByLocale(n, "SEKeywords", m_SkinBase.ThisCustomer.LocaleSetting);
                if (m_SkinBase.SEKeywords.Length == 0)
                {
                    m_SkinBase.SEKeywords = Security.HtmlEncode(m_EntityInstanceName);
                }
                m_SkinBase.SENoScript = m_EntityHelper.m_TblMgr.CurrentFieldByLocale(n, "SENoScript", m_SkinBase.ThisCustomer.LocaleSetting);

                m_SkinBase.SectionTitle = Breadcrumb.GetEntityBreadcrumb(m_EntityInstanceID, m_EntityInstanceName, m_EntitySpecs.m_EntityName, m_SkinBase.ThisCustomer);

                if (m_URLValidated)
                {
                    m_PageOutput = "<!-- XmlPackage: " + m_XmlPackage + " -->\n";
                    if (m_XmlPackage.Length == 0)
                    {
                        m_PageOutput += "<p><b><font color=red>XmlPackage format was chosen, but no XmlPackage was specified!</font></b></p>";
                    }
                    else
                    {
                        String s = null;
                        if (AppLogic.AppConfigBool("CacheEntityPageHTML"))
                        {
                            CacheName = String.Format("CacheEntityPageHTML|{0}|{1}|{2}|{3}|{4}",
                                                      m_EntitySpecs.m_EntityName,
                                                      m_EntityInstanceID.ToString(),
                                                      m_SkinBase.ThisCustomer.CustomerLevelID.ToString(),
                                                      m_SkinBase.ThisCustomer.LocaleSetting,
                                                      CommonLogic.QueryStringUSInt("PageNum").ToString(),
                                                      m_SkinBase.ThisCustomer.AffiliateID.ToString()
                                                      );
                            s = (String)HttpContext.Current.Cache.Get(CacheName);
                            if (s != null)
                            {
                                s = "<!-- CacheEntityPageHTML -->" + s;
                            }
                            m_SkinBase.SectionTitle  = (String)HttpContext.Current.Cache.Get(CacheName + "|SectionTitle");
                            m_SkinBase.SETitle       = (String)HttpContext.Current.Cache.Get(CacheName + "|SETitle");
                            m_SkinBase.SEDescription = (String)HttpContext.Current.Cache.Get(CacheName + "|SEDescription");
                            m_SkinBase.SEKeywords    = (String)HttpContext.Current.Cache.Get(CacheName + "|SEKeywords");
                            m_SkinBase.SENoScript    = (String)HttpContext.Current.Cache.Get(CacheName + "|SENoScript");
                            if (m_SkinBase.SectionTitle == null)
                            {
                                m_SkinBase.SectionTitle = String.Empty;
                            }
                            if (m_SkinBase.SETitle == null)
                            {
                                m_SkinBase.SETitle = String.Empty;
                            }
                            if (m_SkinBase.SEDescription == null)
                            {
                                m_SkinBase.SEDescription = String.Empty;
                            }
                            if (m_SkinBase.SEKeywords == null)
                            {
                                m_SkinBase.SEKeywords = String.Empty;
                            }
                            if (m_SkinBase.SENoScript == null)
                            {
                                m_SkinBase.SENoScript = String.Empty;
                            }
                        }
                        if (s == null || s.Length == 0)
                        {
                            using (XmlPackage2 p = new XmlPackage2(m_XmlPackage, m_SkinBase.ThisCustomer, m_SkinBase.SkinID, "", RunTimeParms, String.Empty, true))
                            {
                                s = AppLogic.RunXmlPackage(p, m_SkinBase.GetParser, m_SkinBase.ThisCustomer, m_SkinBase.SkinID, true, true);
                                if (p.SectionTitle != "")
                                {
                                    m_SkinBase.SectionTitle = p.SectionTitle;
                                }
                                if (p.SETitle != "")
                                {
                                    m_SkinBase.SETitle = p.SETitle;
                                }
                                if (p.SEDescription != "")
                                {
                                    m_SkinBase.SEDescription = p.SEDescription;
                                }
                                if (p.SEKeywords != "")
                                {
                                    m_SkinBase.SEKeywords = p.SEKeywords;
                                }
                                if (p.SENoScript != "")
                                {
                                    m_SkinBase.SENoScript = p.SENoScript;
                                }
                                if (AppLogic.AppConfigBool("CacheEntityPageHTML"))
                                {
                                    HttpContext.Current.Cache.Insert(CacheName, s, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero);
                                    HttpContext.Current.Cache.Insert(CacheName + "|SectionTitle", p.SectionTitle, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero);
                                    HttpContext.Current.Cache.Insert(CacheName + "|SETitle", p.SETitle, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero);
                                    HttpContext.Current.Cache.Insert(CacheName + "|SEDescription", p.SEDescription, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero);
                                    HttpContext.Current.Cache.Insert(CacheName + "|SEKeywords", p.SEKeywords, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero);
                                    HttpContext.Current.Cache.Insert(CacheName + "|SENoScript", p.SENoScript, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero);
                                }
                            }
                        }
                        m_PageOutput += s;
                    }
                }
            }
            AppLogic.eventHandler("ViewEntityPage").CallEvent("&ViewEntityPage=true");

            //check if the postback was caused by the TableOrderAddToCart button
            if (m_SkinBase.IsPostBack && isTableOrderAddToCartPostBack)
            {
                HandleTableOrderAddToCart();
            }
        }
Ejemplo n.º 20
0
        private SkinBase m_SkinBase = null; // if not null, this control will set the page metatags to the results from the Topic, IF those Topic results are not "empty strings"

        protected void Page_Load(object sender, EventArgs e)
        {
            m_DesignMode = (HttpContext.Current == null);
            if (m_DesignMode)
            {
                if (TopicName.Length != 0)
                {
                    Contents.Text = "Topic: " + TopicName;
                }
                else
                {
                    Contents.Text = "Topic";
                }
            }
            else
            {
                m_SkinBase = (SkinBase)this.Page;
                try
                {
                    if (m_SkinBase != null)
                    {
                        if (TopicID != 0)
                        {
                            m_T = new Topic(TopicID, m_SkinBase.ThisCustomer.LocaleSetting, m_SkinBase.ThisCustomer.SkinID, m_SkinBase.GetParser);
                        }
                        else
                        {
                            m_T = new Topic(TopicName, m_SkinBase.ThisCustomer.LocaleSetting, m_SkinBase.ThisCustomer.SkinID, m_SkinBase.GetParser);
                        }
                        m_SkinID        = m_SkinBase.ThisCustomer.SkinID;
                        m_LocaleSetting = m_SkinBase.ThisCustomer.LocaleSetting;
                    }
                    else
                    {
                        m_LocaleSetting = Localization.GetDefaultLocale();
                        if (TopicID != 0)
                        {
                            m_T = new Topic(TopicID, m_LocaleSetting, m_SkinID, null);
                        }
                        else
                        {
                            m_T = new Topic(TopicName, m_LocaleSetting, m_SkinID, null);
                        }
                    }
                    StringBuilder tmpS = new StringBuilder(4096);

                    String xpdd = m_SkinBase.ThisCustomer.ThisCustomerSession["Topic" + XmlCommon.GetLocaleEntry(m_T.TopicName, m_SkinBase.ThisCustomer.LocaleSetting, true)];
                    if (xpdd.Length != 0)
                    {
                        // don't let decrypt failure crash, just set xpdd to string.empty so it fails.
                        try
                        {
                            xpdd = Security.UnmungeString(xpdd);
                        }
                        catch
                        {
                            xpdd = String.Empty; // some kind of decrypt failure, deny access, not sure what else to do here.
                        }
                    }
                    if (EnforcePassword && m_T.Password.Length != 0 && xpdd != m_T.Password)
                    {
                        String Url = String.Empty;
                        if (CommonLogic.GetThisPageName(false).Equals("driver.aspx", StringComparison.InvariantCultureIgnoreCase))
                        {
                            Url = SE.MakeDriverLink(XmlCommon.GetLocaleEntry(m_T.TopicName, m_SkinBase.ThisCustomer.LocaleSetting, true));
                        }
                        else
                        {
                            Url = SE.MakeDriver2Link(XmlCommon.GetLocaleEntry(m_T.TopicName, m_SkinBase.ThisCustomer.LocaleSetting, true));
                        }
                        tmpS.Append("<form method=\"POST\" action=\"" + Url + "\">\n");
                        tmpS.Append("<p><b>");
                        tmpS.Append(AppLogic.GetString("driver.aspx.1", m_SkinID, m_LocaleSetting));
                        tmpS.Append("</b></p>\n");
                        tmpS.Append("<p>");
                        tmpS.Append(AppLogic.GetString("driver.aspx.2", m_SkinID, m_LocaleSetting));
                        tmpS.Append(" <input type=\"text\" name=\"Password\" size=\"20\" maxlength=\"100\"><input type=\"submit\" value=\"");
                        tmpS.Append(AppLogic.GetString("driver.aspx.5", m_SkinID, m_LocaleSetting));
                        tmpS.Append("\" name=\"B1\"></p>\n");
                        tmpS.Append("</form>\n");
                        m_SkinBase.ThisCustomer.RequireCustomerRecord();
                    }
                    else
                    {
                        if (EnforceDisclaimer && m_T.RequiresDisclaimer && CommonLogic.CookieCanBeDangerousContent("SiteDisclaimerAccepted", true).Length == 0)
                        {
                            String ThisPageURL = CommonLogic.GetThisPageName(true) + "?" + CommonLogic.ServerVariables("QUERY_STRING");
                            Response.Redirect("disclaimer.aspx?returnURL=" + HttpContext.Current.Server.UrlEncode(ThisPageURL));
                        }

                        if (EnforceSubscription && m_T.RequiresSubscription && m_SkinBase.ThisCustomer.SubscriptionExpiresOn.AddDays((double)AppLogic.AppConfigNativeInt("SubscriptionExpiredGracePeriod")) < System.DateTime.Now)
                        {
                            String Msg = AppLogic.AppConfig("Suscription.ExpiredMessageWhenViewingTopic");
                            if (Msg.Length == 0)
                            {
                                Msg = "<p><b>" + AppLogic.GetString("driver.aspx.3", m_SkinID, m_LocaleSetting) + "</b></p>";
                            }
                            tmpS.Append(Msg);
                        }
                        else
                        {
                            tmpS.Append("<!-- READ FROM ");
                            tmpS.Append(CommonLogic.IIF(m_T.FromDB, "DB", "FILE"));
                            tmpS.Append(" -->");
                            tmpS.Append(m_T.Contents);
                            tmpS.Append("<!-- END OF ");
                            tmpS.Append(CommonLogic.IIF(m_T.FromDB, "DB", "FILE"));
                            tmpS.Append(" -->");
                        }
                    }
                    Contents.Text = tmpS.ToString();
                }
                catch (Exception ex)
                {
                    Contents.Text = CommonLogic.GetExceptionDetail(ex, "<br/>");
                }
                if (m_SkinBase != null && m_AllowSEPropogation && m_T != null)
                {
                    if (m_T.SectionTitle.Length != 0)
                    {
                        m_SkinBase.SectionTitle = m_T.SectionTitle;
                    }
                    if (m_T.SETitle.Length != 0)
                    {
                        m_SkinBase.SETitle = m_T.SETitle;
                    }
                    if (m_T.SEKeywords.Length != 0)
                    {
                        m_SkinBase.SEKeywords = m_T.SEKeywords;
                    }
                    if (m_T.SEDescription.Length != 0)
                    {
                        m_SkinBase.SEDescription = m_T.SEDescription;
                    }
                    if (m_T.SENoScript.Length != 0)
                    {
                        m_SkinBase.SENoScript = m_T.SENoScript;
                    }
                }
            }
        }
Ejemplo n.º 21
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }

            ProductID      = CommonLogic.QueryStringUSInt("ProductID");
            CategoryID     = CommonLogic.QueryStringUSInt("CategoryID");
            SectionID      = CommonLogic.QueryStringUSInt("SectionID");
            ManufacturerID = CommonLogic.QueryStringUSInt("ManufacturerID");
            DistributorID  = CommonLogic.QueryStringUSInt("DistributorID");
            GenreID        = CommonLogic.QueryStringUSInt("GenreID");
            VectorID       = CommonLogic.QueryStringUSInt("VectorID");

            if (ProductID == 0)
            {
                if (IsAddToCartPostBack)
                {
                    int    PackID                 = 0;
                    int    packProductID          = 0;
                    int    packVariantID          = 0;
                    int    packQuantity           = 0;
                    int    packProductTypeID      = 0;
                    bool   FromCart               = false;
                    int    packCartRecID          = 0;
                    String ChosenColor            = String.Empty;
                    String ChosenColorSKUModifier = String.Empty;
                    String ChosenSize             = String.Empty;
                    String ChosenSizeSKUModifier  = String.Empty;
                    String color      = string.Empty;
                    String size       = string.Empty;
                    String TextOption = CommonLogic.FormCanBeDangerousContent("TextOption");


                    for (int i = 0; i <= HttpContext.Current.Request.Form.Count - 1; i++)
                    {
                        if (HttpContext.Current.Request.Form.Keys[i].StartsWith("ProductID", StringComparison.InvariantCultureIgnoreCase))
                        {
                            packProductID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent("__EVENTARGUMENT").Split('_')[1]);
                        }
                        if (HttpContext.Current.Request.Form.Keys[i].StartsWith("VariantID", StringComparison.InvariantCultureIgnoreCase))
                        {
                            packVariantID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent("__EVENTARGUMENT").Split('_')[2]);
                        }

                        if (HttpContext.Current.Request.Form.Keys[i].StartsWith("PackID", StringComparison.InvariantCultureIgnoreCase))
                        {
                            PackID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]));
                            if (CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]).Contains(",") && PackID == 0)
                            {
                                PackID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]).Split(',')[0]);
                            }
                        }

                        if (HttpContext.Current.Request.Form.Keys[i].StartsWith("Quantity", StringComparison.InvariantCultureIgnoreCase) && !HttpContext.Current.Request.Form.Keys[i].StartsWith("Quantity_vldt", StringComparison.InvariantCultureIgnoreCase))
                        {
                            if (Localization.ParseUSInt(HttpContext.Current.Request.Form.Keys[i].Split('_')[2]) == packVariantID)
                            {
                                packQuantity = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]));
                            }
                        }
                        if (HttpContext.Current.Request.Form.Keys[i].StartsWith("CartRecID", StringComparison.InvariantCultureIgnoreCase))
                        {
                            packCartRecID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]));
                        }
                        if (HttpContext.Current.Request.Form.Keys[i].StartsWith("Color", StringComparison.InvariantCultureIgnoreCase))
                        {
                            if (Localization.ParseUSInt(HttpContext.Current.Request.Form.Keys[i].Split('_')[2]) == packVariantID)
                            {
                                color = CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]).ToString();
                            }
                        }
                        if (HttpContext.Current.Request.Form.Keys[i].StartsWith("Size", StringComparison.InvariantCultureIgnoreCase))
                        {
                            if (Localization.ParseUSInt(HttpContext.Current.Request.Form.Keys[i].Split('_')[2]) == packVariantID)
                            {
                                size = CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]).ToString();
                            }
                        }
                        if (HttpContext.Current.Request.Form.Keys[i].StartsWith("ProductTypeID", StringComparison.InvariantCultureIgnoreCase))
                        {
                            if (Localization.ParseUSInt(HttpContext.Current.Request.Form.Keys[i].Split('_')[2]) == packVariantID)
                            {
                                packProductTypeID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]));
                            }
                        }
                    }


                    ThisCustomer.RequireCustomerRecord();
                    if (packQuantity == 0)
                    {
                        packQuantity = 1;
                    }
                    FromCart = (packCartRecID > 0);

                    if (color.Length != 0)
                    {
                        String[] ColorSel = color.Split(',');
                        try
                        {
                            ChosenColor = ColorSel[0];
                        }
                        catch { }
                        try
                        {
                            ChosenColorSKUModifier = ColorSel[1];
                        }
                        catch { }
                    }
                    if (ChosenColor.Length != 0)
                    {
                        ThisCustomer.ThisCustomerSession["ChosenColor"] = ChosenColor;
                    }


                    if (size.Length != 0)
                    {
                        String[] SizeSel = size.Split(',');
                        try
                        {
                            ChosenSize = SizeSel[0];
                        }
                        catch { }
                        try
                        {
                            ChosenSizeSKUModifier = SizeSel[1];
                        }
                        catch { }
                    }
                    if (ChosenSize.Length != 0)
                    {
                        ThisCustomer.ThisCustomerSession["ChosenSize"] = ChosenSize;
                    }

                    if (packQuantity > 0)
                    {
                        // add to custom cart:
                        if (FromCart)
                        {
                            CustomCart.AddItem(PackID, packProductID, packVariantID, packQuantity, ChosenColor, ChosenColorSKUModifier, ChosenSize, ChosenSizeSKUModifier, packCartRecID, ThisCustomer, CartTypeEnum.ShoppingCart);
                        }
                        else
                        {
                            CustomCart cart = new CustomCart(ThisCustomer, PackID, 1, CartTypeEnum.ShoppingCart);
                            cart.AddItem(packProductID, packVariantID, packQuantity, ChosenColor, ChosenColorSKUModifier, ChosenSize, ChosenSizeSKUModifier);
                        }
                    }

                    if (CommonLogic.QueryStringCanBeDangerousContent("UpdateCartPack") == "")
                    {
                        String url = "pb.aspx?type=" + packProductTypeID.ToString() + "&PackID=" + PackID.ToString() + "&ProductID=" + packProductID.ToString() + "&cartrecid=" + packCartRecID;

                        Response.Redirect(url + CommonLogic.IIF(FromCart, "?cartrecid=" + packCartRecID.ToString(), ""));
                        Response.Redirect(url);
                    }
                    else
                    {
                        Response.Redirect(ResolveClientUrl("~/shoppingcart.aspx"));
                    }
                }
            }
            String ActualSEName = string.Empty;

            using (SqlConnection dbconn = new SqlConnection(DB.GetDBConn()))
            {
                dbconn.Open();
                using (IDataReader rs = DB.GetRS(string.Format("select * from Product a with (NOLOCK) inner join (select a.ProductID, b.StoreID from Product a with (nolock) left join ProductStore b " +
                                                               "with (NOLOCK) on a.ProductID = b.ProductID) b on a.ProductID = b.ProductID where Deleted=0 and a.ProductID={0} and ({1}=0 or StoreID={2})", +
                                                               ProductID, CommonLogic.IIF(AppLogic.GlobalConfigBool("AllowProductFiltering") == true, 1, 0), AppLogic.StoreID()), dbconn))
                {
                    if (!rs.Read())
                    {
                        Response.Redirect(SE.MakeDriverLink("ProductNotFound"));
                    }
                    else
                    {
                        bool a = DB.RSFieldBool(rs, "Published");
                        if (!a)
                        {
                            Response.Redirect(SE.MakeDriverLink("ProductNotFound"));
                        }
                    }

                    String SENameINURL = CommonLogic.QueryStringCanBeDangerousContent("SEName");
                    ActualSEName = SE.MungeName(DB.RSField(rs, "SEName"));
                    if (ActualSEName != SENameINURL)
                    {
                        String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName);

                        string QStr  = "?";
                        bool   first = true;
                        for (int i = 0; i < Request.QueryString.Count; i++)
                        {
                            string key = Request.QueryString.GetKey(i);
                            if ((key.Equals("productid", StringComparison.InvariantCultureIgnoreCase)) == false && (key.Equals("sename", StringComparison.InvariantCultureIgnoreCase)) == false)
                            {
                                if (!first)
                                {
                                    QStr += "&";
                                }
                                QStr += key + "=" + Request.QueryString[i];
                                first = false;
                            }
                        }
                        if (QStr.Length > 1)
                        {
                            NewURL += QStr;
                        }

                        HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>");
                        Response.Status = "301 Moved Permanently";
                        Response.AddHeader("Location", NewURL);
                        HttpContext.Current.Response.End();
                    }


                    #region Vortx Mobile Xml Package Modification
                    m_XmlPackage = Vortx.MobileFramework.MobileXmlPackageController.XmlPackageHook(DB.RSField(rs, "XmlPackage").ToLowerInvariant(), ThisCustomer);
                    #endregion
                    IsAKit  = DB.RSFieldBool(rs, "IsAKit");
                    IsAPack = DB.RSFieldBool(rs, "IsAPack");
                    if (m_XmlPackage.Length == 0)
                    {
                        if (IsAKit)
                        {
                            m_XmlPackage = AppLogic.ro_DefaultProductKitXmlPackage; // provide a default
                        }
                        else if (IsAPack)
                        {
                            m_XmlPackage = AppLogic.ro_DefaultProductPackXmlPackage; // provide a default
                        }
                        else
                        {
                            m_XmlPackage = AppLogic.ro_DefaultProductXmlPackage; // provide a default
                        }
                    }
                    RequiresReg = DB.RSFieldBool(rs, "RequiresRegistration");
                    ProductName = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting);

                    CategoryHelper     = AppLogic.LookupHelper("Category", 0);
                    SectionHelper      = AppLogic.LookupHelper("Section", 0);
                    ManufacturerHelper = AppLogic.LookupHelper("Manufacturer", 0);
                    DistributorHelper  = AppLogic.LookupHelper("Distributor", 0);
                    GenreHelper        = AppLogic.LookupHelper("Genre", 0);
                    VectorHelper       = AppLogic.LookupHelper("Vector", 0);

                    String SEName = String.Empty;
                    if (DB.RSFieldByLocale(rs, "SETitle", ThisCustomer.LocaleSetting).Length == 0)
                    {
                        SETitle = Security.HtmlEncode(AppLogic.AppConfig("StoreName") + " - " + ProductName);
                    }
                    else
                    {
                        SETitle = DB.RSFieldByLocale(rs, "SETitle", ThisCustomer.LocaleSetting);
                    }
                    if (DB.RSFieldByLocale(rs, "SEDescription", ThisCustomer.LocaleSetting).Length == 0)
                    {
                        SEDescription = Security.HtmlEncode(ProductName);
                    }
                    else
                    {
                        SEDescription = DB.RSFieldByLocale(rs, "SEDescription", ThisCustomer.LocaleSetting);
                    }
                    if (DB.RSFieldByLocale(rs, "SEKeywords", ThisCustomer.LocaleSetting).Length == 0)
                    {
                        SEKeywords = Security.HtmlEncode(ProductName);
                    }
                    else
                    {
                        SEKeywords = DB.RSFieldByLocale(rs, "SEKeywords", ThisCustomer.LocaleSetting);
                    }
                    SENoScript = DB.RSFieldByLocale(rs, "SENoScript", ThisCustomer.LocaleSetting);
                }
            }

            //Log all views of unknown and registered customer
            if (!AppLogic.ProductIsMLExpress() && (AppLogic.AppConfigBool("DynamicRelatedProducts.Enabled") || AppLogic.AppConfigBool("RecentlyViewedProducts.Enabled")))
            {
                ThisCustomer.LogProductView(ProductID);
            }

            if (IsAKit && !Vortx.MobileFramework.MobileHelper.isMobile())
            {
                Server.Transfer(ResolveClientUrl("~/kitproduct.aspx"), true);
                return;
            }
            else if (IsAKit && Vortx.MobileFramework.MobileHelper.isMobile())
            {
                Server.Transfer(ResolveClientUrl("~/mobilekitproduct.aspx"), true);
                return;
            }

            CategoryName     = CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting);
            SectionName      = SectionHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting);
            ManufacturerName = ManufacturerHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting);
            DistributorName  = DistributorHelper.GetEntityName(DistributorID, ThisCustomer.LocaleSetting);
            GenreName        = GenreHelper.GetEntityName(GenreID, ThisCustomer.LocaleSetting);
            VectorName       = VectorHelper.GetEntityName(VectorID, ThisCustomer.LocaleSetting);

            String SourceEntityInstanceName = String.Empty;

            if (ManufacturerID != 0)
            {
                Profile.LastViewedEntityName         = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName;
                Profile.LastViewedEntityInstanceID   = ManufacturerID.ToString();
                Profile.LastViewedEntityInstanceName = ManufacturerName;

                String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName);
                HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>");
                Response.Status = "301 Moved Permanently";
                Response.AddHeader("Location", NewURL);
                HttpContext.Current.Response.End();
            }
            else if (DistributorID != 0)
            {
                Profile.LastViewedEntityName         = EntityDefinitions.readonly_DistributorEntitySpecs.m_EntityName;
                Profile.LastViewedEntityInstanceID   = DistributorID.ToString();
                Profile.LastViewedEntityInstanceName = DistributorName;

                String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName);
                HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>");
                Response.Status = "301 Moved Permanently";
                Response.AddHeader("Location", NewURL);
                HttpContext.Current.Response.End();
            }
            else if (GenreID != 0)
            {
                Profile.LastViewedEntityName         = EntityDefinitions.readonly_GenreEntitySpecs.m_EntityName;
                Profile.LastViewedEntityInstanceID   = GenreID.ToString();
                Profile.LastViewedEntityInstanceName = GenreName;

                String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName);
                HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>");
                Response.Status = "301 Moved Permanently";
                Response.AddHeader("Location", NewURL);
                HttpContext.Current.Response.End();
            }
            else if (VectorID != 0)
            {
                Profile.LastViewedEntityName         = EntityDefinitions.readonly_VectorEntitySpecs.m_EntityName;
                Profile.LastViewedEntityInstanceID   = VectorID.ToString();
                Profile.LastViewedEntityInstanceName = VectorName;

                String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName);
                HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>");
                Response.Status = "301 Moved Permanently";
                Response.AddHeader("Location", NewURL);
                HttpContext.Current.Response.End();
            }
            else if (CategoryID != 0)
            {
                Profile.LastViewedEntityName         = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName;
                Profile.LastViewedEntityInstanceID   = CategoryID.ToString();
                Profile.LastViewedEntityInstanceName = CategoryName;

                String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName);
                HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>");
                Response.Status = "301 Moved Permanently";
                Response.AddHeader("Location", NewURL);
                HttpContext.Current.Response.End();
            }
            else if (SectionID != 0)
            {
                Profile.LastViewedEntityName         = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName;
                Profile.LastViewedEntityInstanceID   = SectionID.ToString();
                Profile.LastViewedEntityInstanceName = SectionName;

                String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName);
                HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>");
                Response.Status = "301 Moved Permanently";
                Response.AddHeader("Location", NewURL);
                HttpContext.Current.Response.End();
            }

            SourceEntity             = Profile.LastViewedEntityName;
            SourceEntityInstanceName = Profile.LastViewedEntityInstanceName;
            SourceEntityID           = int.Parse(CommonLogic.IIF(CommonLogic.IsInteger(Profile.LastViewedEntityInstanceID), Profile.LastViewedEntityInstanceID, "0"));

            // validate that source entity id is actually valid for this product:
            if (SourceEntityID != 0)
            {
                String sqlx = string.Format("select count(*) as N from productentity a with (nolock) inner join (select distinct a.entityid, a.EntityType from productentity a with (nolock) left join EntityStore b with (nolock) " +
                                            "on a.EntityID = b.EntityID where ({0} = 0 or StoreID = {1})) b on a.EntityID = b.EntityID and a.EntityType=b.EntityType where ProductID = {2} and a.EntityID = {3} and a.EntityType = {4}"
                                            , CommonLogic.IIF(AppLogic.GlobalConfigBool("AllowEntityFiltering") == true, 1, 0), AppLogic.StoreID(), ProductID, SourceEntityID, DB.SQuote(SourceEntity));
                if (DB.GetSqlN(sqlx) == 0)
                {
                    SourceEntityID = 0;
                }
            }

            // we had no entity context coming in, try to find a category context for this product, so they have some context if possible:
            if (SourceEntityID == 0)
            {
                SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName);
                if (SourceEntityID > 0)
                {
                    CategoryID   = SourceEntityID;
                    CategoryName = CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting);

                    Profile.LastViewedEntityName         = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName;
                    Profile.LastViewedEntityInstanceID   = CategoryID.ToString();
                    Profile.LastViewedEntityInstanceName = CategoryName;

                    SourceEntity             = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName;
                    SourceEntityInstanceName = CategoryName;
                }
            }

            // we had no entity context coming in, try to find a section context for this product, so they have some context if possible:
            if (SourceEntityID == 0)
            {
                SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName);
                if (SourceEntityID > 0)
                {
                    SectionID   = SourceEntityID;
                    SectionName = CategoryHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting);

                    Profile.LastViewedEntityName         = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName;
                    Profile.LastViewedEntityInstanceID   = SectionID.ToString();
                    Profile.LastViewedEntityInstanceName = SectionName;

                    SourceEntity             = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName;
                    SourceEntityInstanceName = SectionName;
                }
            }

            // we had no entity context coming in, try to find a Manufacturer context for this product, so they have some context if possible:
            if (SourceEntityID == 0)
            {
                SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName);
                if (SourceEntityID > 0)
                {
                    ManufacturerID   = SourceEntityID;
                    ManufacturerName = CategoryHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting);

                    Profile.LastViewedEntityName         = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName;
                    Profile.LastViewedEntityInstanceID   = ManufacturerID.ToString();
                    Profile.LastViewedEntityInstanceName = ManufacturerName;

                    SourceEntity             = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName;
                    SourceEntityInstanceName = ManufacturerName;
                }
            }

            // build up breadcrumb if we need:
            SectionTitle = Breadcrumb.GetProductBreadcrumb(ProductID, ProductName, SourceEntity, SourceEntityID, ThisCustomer);
            //Reset LastViewedEntityInstanceID to zero if no entities are mapped to the product so the left nav will render properly.
            if (SourceEntityID <= 0)
            {
                HttpContext.Current.Profile.SetPropertyValue("LastViewedEntityInstanceID", "0");
            }

            if (RequiresReg && !ThisCustomer.IsRegistered)
            {
                m_PageOutput += "<br/><br/><br/><br/><b>" + AppLogic.GetString("showproduct.aspx.1", SkinID, ThisCustomer.LocaleSetting) + "</b><br/><br/><br/><a href=\"signin.aspx?returnurl=" + CommonLogic.GetThisPageName(false) + "?ProductID=" + ProductID.ToString() + CommonLogic.IIF(CommonLogic.ServerVariables("QUERY_STRING").Trim().Length > 0, "&" + Security.HtmlEncode(Security.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING"))), String.Empty) + "\">" + AppLogic.GetString("showproduct.aspx.2", SkinID, ThisCustomer.LocaleSetting) + "</a> " + AppLogic.GetString("showproduct.aspx.3", SkinID, ThisCustomer.LocaleSetting);
            }
            else
            {
                AppLogic.eventHandler("ViewProductPage").CallEvent("&ViewProductPage=true");

                // check if the postback was caused by an addtocart button
                if (this.IsPostBack && this.IsAddToCartPostBack)
                {
                    HandleAddToCart();
                    return;
                }

                DB.ExecuteSQL("update product set Looks=Looks+1 where ProductID=" + ProductID.ToString());

                m_PageOutput = "<!-- XmlPackage: " + m_XmlPackage + " -->\n";
                if (m_XmlPackage.Length == 0)
                {
                    m_PageOutput += "<p><b><font color=red>XmlPackage format was chosen, but no XmlPackage was specified!</font></b></p>";
                }
                else
                {
                    using (XmlPackage2 p = new XmlPackage2(m_XmlPackage, ThisCustomer, SkinID, "", "EntityName=" + SourceEntity + "&EntityID=" + SourceEntityID.ToString() + CommonLogic.IIF(CommonLogic.ServerVariables("QUERY_STRING").IndexOf("cartrecid") != -1, "&cartrecid=" + CommonLogic.QueryStringUSInt("cartrecid").ToString(), "&showproduct=1"), String.Empty, true))
                    {
                        m_PageOutput += AppLogic.RunXmlPackage(p, base.GetParser, ThisCustomer, SkinID, true, true);
                        if (p.SectionTitle != "")
                        {
                            SectionTitle = p.SectionTitle;
                        }
                        if (p.SETitle != "")
                        {
                            SETitle = p.SETitle;
                        }
                        if (p.SEDescription != "")
                        {
                            SEDescription = p.SEDescription;
                        }
                        if (p.SEKeywords != "")
                        {
                            SEKeywords = p.SEKeywords;
                        }
                        if (p.SENoScript != "")
                        {
                            SENoScript = p.SENoScript;
                        }
                    }
                }
            }
            litOutput.Text = m_PageOutput;
        }
Ejemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MobileHelper.RedirectPageWhenMobileIsDisabled("~/emailproduct.aspx", ThisCustomer);

            ProductID = CommonLogic.QueryStringUSInt("ProductID");

            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }
            // DOS attack prevention:
            if (AppLogic.OnLiveServer() && (Request.UrlReferrer == null || Request.UrlReferrer.Authority != Request.Url.Authority))
            {
                Response.Redirect(SE.MakeDriverLink("EmailError"));
            }
            if (ProductID == 0)
            {
                Response.Redirect("~/default.aspx");
            }
            if (AppLogic.ProductHasBeenDeleted(ProductID))
            {
                Response.Redirect(SE.MakeDriverLink("ProductNotFound"));
            }



            EntityHelper CategoryHelper = AppLogic.LookupHelper("Category", AppLogic.StoreID());

            baseSkinID = (Page as SkinBase).SkinID;

            using (SqlConnection conn = DB.dbConn())
            {
                conn.Open();
                using (IDataReader rs = DB.GetRS("select p.*, pv.name variantname from product p  with (NOLOCK)  join productvariant pv  with (NOLOCK)  on p.ProductID = pv.ProductID and pv.isdefault = 1 where p.ProductID=" + ProductID.ToString(), conn))
                {
                    if (!rs.Read())
                    {
                        Response.Redirect("default.aspx");
                    }
                    SEName      = DB.RSField(rs, "SEName");
                    ProductName = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting);
                    VariantName = DB.RSFieldByLocale(rs, "VariantName", ThisCustomer.LocaleSetting);

                    RequiresReg        = DB.RSFieldBool(rs, "RequiresRegistration");
                    ProductDescription = DB.RSFieldByLocale(rs, "Description", ThisCustomer.LocaleSetting);
                    if (AppLogic.ReplaceImageURLFromAssetMgr)
                    {
                        ProductDescription = ProductDescription.Replace("../images", "images");
                    }
                    String FileDescription = new ProductDescriptionFile(ProductID, ThisCustomer.LocaleSetting, baseSkinID).Contents;
                    if (FileDescription.Length != 0)
                    {
                        ProductDescription += "<div align=\"left\">" + FileDescription + "</div>";
                    }
                }
            }

            String SourceEntityInstanceName = String.Empty;

            SourceEntity             = Profile.LastViewedEntityName;
            SourceEntityInstanceName = Profile.LastViewedEntityInstanceName;
            SourceEntityID           = int.Parse(CommonLogic.IIF(CommonLogic.IsInteger(Profile.LastViewedEntityInstanceID), Profile.LastViewedEntityInstanceID, "0"));;

            // validate that source entity id is actually valid for this product:
            if (SourceEntityID != 0)
            {
                String sqlx = "select count(*) as N from dbo.productentity  with (NOLOCK)  where ProductID=" + ProductID.ToString() + " and EntityID=" + SourceEntityID.ToString() + " and EntityType = " + DB.SQuote(SourceEntity);
                if (DB.GetSqlN(sqlx) == 0)
                {
                    SourceEntityID = 0;
                }
            }

            // we had no entity context coming in, try to find a category context for this product, so they have some context if possible:
            if (SourceEntityID == 0)
            {
                SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName);
                if (SourceEntityID > 0)
                {
                    CategoryID   = SourceEntityID;
                    CategoryName = CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting);
                    Profile.LastViewedEntityName         = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName;
                    Profile.LastViewedEntityInstanceID   = CategoryID.ToString();
                    Profile.LastViewedEntityInstanceName = CategoryName;
                    SourceEntity             = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName;
                    SourceEntityInstanceName = CategoryName;
                }
            }

            // we had no entity context coming in, try to find a section context for this product, so they have some context if possible:
            if (SourceEntityID == 0)
            {
                SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName);
                if (SourceEntityID > 0)
                {
                    SectionID   = SourceEntityID;
                    SectionName = CategoryHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting);
                    Profile.LastViewedEntityName         = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName;
                    Profile.LastViewedEntityInstanceID   = SectionID.ToString();
                    Profile.LastViewedEntityInstanceName = SectionName;
                    SourceEntity             = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName;
                    SourceEntityInstanceName = SectionName;
                }
            }

            // we had no entity context coming in, try to find a Manufacturer context for this product, so they have some context if possible:
            if (SourceEntityID == 0)
            {
                SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName);
                if (SourceEntityID > 0)
                {
                    ManufacturerID                       = SourceEntityID;
                    ManufacturerName                     = CategoryHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting);
                    Profile.LastViewedEntityName         = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName;
                    Profile.LastViewedEntityInstanceID   = ManufacturerID.ToString();
                    Profile.LastViewedEntityInstanceName = ManufacturerName;
                    SourceEntity             = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName;
                    SourceEntityInstanceName = ManufacturerName;
                }
            }

            // build up breadcrumb if we need:
            (Page as SkinBase).SectionTitle = Breadcrumb.GetProductBreadcrumb(ProductID, ProductName, SourceEntity, SourceEntityID, ThisCustomer);

            reqToAddress.ErrorMessage     = AppLogic.GetString("emailproduct.aspx.13", baseSkinID, ThisCustomer.LocaleSetting);
            regexToAddress.ErrorMessage   = AppLogic.GetString("emailproduct.aspx.14", baseSkinID, ThisCustomer.LocaleSetting);
            reqFromAddress.ErrorMessage   = AppLogic.GetString("emailproduct.aspx.16", baseSkinID, ThisCustomer.LocaleSetting);
            regexFromAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.17", baseSkinID, ThisCustomer.LocaleSetting);

            if (!this.IsPostBack)
            {
                InitializePageContent();
            }
        }
Ejemplo n.º 23
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }

            PackID = CommonLogic.QueryStringUSInt("PackID");
            if (PackID == 0)
            {
                Response.Redirect("default.aspx");
            }
            if (AppLogic.ProductHasBeenDeleted(PackID))
            {
                Response.Redirect(SE.MakeDriverLink("ProductNotFound"));
            }
            m_CategoryHelper = AppLogic.LookupHelper(base.EntityHelpers, "Category");
            m_SectionHelper  = AppLogic.LookupHelper(base.EntityHelpers, "Section");

            CategoryID = CommonLogic.QueryStringUSInt("CategoryID");
            SectionID  = CommonLogic.QueryStringUSInt("SectionID");
            if (CategoryID == 0 && SectionID == 0)
            {
                // no category or section passed in, pick first one that this product is mapped to:
                String tmpS = m_CategoryHelper.GetObjectEntities(PackID, true);
                if (tmpS.Length != 0)
                {
                    String[] catIDs = tmpS.Split(',');
                    CategoryID = Localization.ParseUSInt(catIDs[0]);
                }
                else
                {
                    String tmpS2 = m_SectionHelper.GetObjectEntities(PackID, true);
                    if (tmpS2.Length != 0)
                    {
                        String[] secIDs = tmpS2.Split(',');
                        SectionID = Localization.ParseUSInt(secIDs[0]);
                    }
                }
            }
            CategoryName = m_CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting);
            SectionName  = m_SectionHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting);


            using (SqlConnection conn = DB.dbConn())
            {
                conn.Open();
                using (IDataReader rs = DB.GetRS("select product.*,productvariant.price,productvariant.points,productvariant.saleprice from product   with (NOLOCK)  left outer join productvariant  with (NOLOCK)  on product.productid=productvariant.productid where productvariant.deleted=0 and productvariant.published=1 and product.ProductID=" + PackID.ToString(), conn))
                {
                    if (!rs.Read())
                    {
                        Response.Redirect("default.aspx");
                    }

                    base.ContentsBGColor = DB.RSField(rs, "ContentsBGColor");
                    base.PageBGColor     = DB.RSField(rs, "PageBGColor");
                    base.GraphicsColor   = DB.RSField(rs, "GraphicsColor");
                    SpecsInline          = DB.RSFieldBool(rs, "SpecsInline");
                    SpecTitle            = DB.RSFieldByLocale(rs, "SpecTitle", ThisCustomer.LocaleSetting);
                    Points = DB.RSFieldInt(rs, "Points");

                    ProductName        = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting);
                    ProductDescription = DB.RSFieldByLocale(rs, "Description", ThisCustomer.LocaleSetting);
                    if (AppLogic.ReplaceImageURLFromAssetMgr)
                    {
                        ProductDescription = ProductDescription.Replace("../images", "images");
                    }
                    FileDescription = new ProductDescriptionFile(PackID, ThisCustomer.LocaleSetting, SkinID).Contents;
                    if (FileDescription.Length != 0)
                    {
                        ProductDescription += "<br/>" + FileDescription;
                    }
                    String ProductPicture      = String.Empty;
                    bool   m_WatermarksEnabled = AppLogic.AppConfigBool("Watermark.Enabled");
                    if (m_WatermarksEnabled)
                    {
                        ProductPicture = String.Format("watermark.axd?productid={0}&size=medium", PackID.ToString());
                    }
                    else
                    {
                        ProductPicture = AppLogic.LookupImage("Product", PackID, "medium", ThisCustomer.SkinID, ThisCustomer.LocaleSetting);
                    }
                    LargePic    = AppLogic.LookupImage("Product", PackID, "large", ThisCustomer.SkinID, ThisCustomer.LocaleSetting);
                    HasLargePic = (LargePic.Length != 0);
                    String LargePicWatermarked = String.Format("watermark.axd?productid={0}&size=large", PackID.ToString());
                    String LargePicForPopup    = LargePic;
                    if (m_WatermarksEnabled)
                    {
                        LargePicForPopup = Server.UrlEncode(LargePicWatermarked);
                    }

                    RequiresReg = DB.RSFieldBool(rs, "RequiresRegistration");

                    BasePrice = System.Decimal.Zero;
                    if (DB.RSFieldDecimal(rs, "SalePrice") != System.Decimal.Zero)
                    {
                        BasePrice = DB.RSFieldDecimal(rs, "SalePrice");
                    }
                    else
                    {
                        BasePrice = DB.RSFieldDecimal(rs, "Price");
                    }
                }
            }

            if (RequiresReg && !ThisCustomer.IsRegistered)
            {
                litOutput.Text = "<br/><br/><br/><br/><b>" + AppLogic.GetString("dyop.aspx.1", SkinID, ThisCustomer.LocaleSetting) + "</b><br/><br/><br/><a href=\"signin.aspx?returnurl=showproduct.aspx?" + Server.HtmlEncode(Server.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING"))) + "\">" + AppLogic.GetString("dyop.aspx.2", SkinID, ThisCustomer.LocaleSetting) + "</a> " + AppLogic.GetString("dyop.aspx.3", SkinID, ThisCustomer.LocaleSetting);
            }
            else
            {
                PresetPackPrice    = System.Decimal.Zero;
                PresetPackProducts = String.Empty;
                AppLogic.PresetPack(ThisCustomer, PackID, CartTypeEnum.ShoppingCart, out PresetPackPrice, out PresetPackProducts);

                m_XmlPackage = AppLogic.GetProductXmlPackage(PackID);
                using (XmlPackage2 p = new XmlPackage2(m_XmlPackage, ThisCustomer, SkinID, String.Empty, String.Empty, String.Empty, true))
                {
                    litOutput.Text     = AppLogic.RunXmlPackage(p, null, ThisCustomer, SkinID, false, false);
                    this.SETitle       = p.SETitle;
                    this.SEDescription = p.SEDescription;
                    this.SEKeywords    = p.SEKeywords;
                    this.SENoScript    = p.SENoScript;
                    this.SectionTitle  = p.SectionTitle;
                }
            }
        }