public static string GetCheckoutHeader(string currentstep)
        {
            string ret = "";

            Customer ThisCustomer = null;

            try
            {
                ThisCustomer = ((AspDotNetStorefrontPrincipal)HttpContext.Current.User).ThisCustomer;
            }
            catch
            {
            }
            if (ThisCustomer == null)
            {
                ThisCustomer = new Customer(true);
            }

            if (ThisCustomer != null)
            {
                using (XmlPackage2 m_P = new XmlPackage2("mobile.checkoutheader.xml.config", ThisCustomer, Data.Config.MobilePlatform.SkinId, String.Empty, "active=" + currentstep, String.Empty, true))
                {
                    try
                    {
                        ret = AppLogic.RunXmlPackage(m_P, null, ThisCustomer, Data.Config.MobilePlatform.SkinId, true, false);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            return(ret);
        }
Esempio n. 2
0
 private void RenderXmlPackageHeader()
 {
     using (XmlPackage2 p = new XmlPackage2("mobile.kitheader.xml.config", 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))
     {
         litKitHeader.Text = AppLogic.RunXmlPackage(p, base.GetParser, ThisCustomer, SkinID, true, true);
     }
 }
Esempio n. 3
0
        private String SendTestNewOrderNotification(Int32 storeId)
        {
            if (AppLogic.AppConfigBool("TurnOffStoreAdminEMailNotifications"))
            {
                return(AppLogic.GetString("mailingtest.aspx.5", SkinID, LocaleSetting));
            }
            try
            {
                String newOrderSubject = String.Format(AppLogic.GetString("common.cs.5", SkinID, LocaleSetting), AppLogic.AppConfig("StoreName", storeId, true));

                String PackageName = AppLogic.AppConfig("XmlPackage.NewOrderAdminNotification");

                XmlPackage2 p = new XmlPackage2(PackageName, null, SkinID, String.Empty, "ordernumber=999999");
                String      newOrderNotification = p.TransformString();

                String SendToList = AppLogic.AppConfig("GotOrderEMailTo").ToString().Replace(",", ";");
                if (SendToList.IndexOf(';') != -1)
                {
                    foreach (String s in SendToList.Split(';'))
                    {
                        AppLogic.SendMail(newOrderSubject, newOrderNotification + AppLogic.AppConfig("MailFooter", storeId, true), true, AppLogic.AppConfig("GotOrderEMailFrom", storeId, true), AppLogic.AppConfig("GotOrderEMailFromName", storeId, true), s.Trim(), s.Trim(), String.Empty, AppLogic.MailServer());
                    }
                }
                else
                {
                    AppLogic.SendMail(newOrderSubject, newOrderNotification + AppLogic.AppConfig("MailFooter", storeId, true), true, AppLogic.AppConfig("GotOrderEMailFrom", storeId, true), AppLogic.AppConfig("GotOrderEMailFromName", storeId, true), SendToList, SendToList, String.Empty, AppLogic.MailServer());
                }
            }
            catch (Exception exception)
            {
                return(GenerateExceptionMessage(exception, storeId));
            }
            return(AppLogic.GetString("mailingtest.aspx.2", SkinID, LocaleSetting));
        }
        private void SendNow()
        {
            bool   isSendCopy = ctrlGiftRegistryShareForm.IsSendMeCopy;
            var    emails     = ctrlGiftRegistryShareForm.GetEmailAddresses();
            string subject    = ctrlGiftRegistryShareForm.Subject;

            if (emails.Count() == 0)
            {
                DisplayError(new List <string>()
                {
                    AppLogic.GetString("editgiftregistry.error.20", ThisCustomer.SkinID, ThisCustomer.LocaleSetting)
                });
                return;
            }

            //decode since we will not going to save it to the database.
            string htmlMessage = ctrlGiftRegistryShareForm.HtmlMessage.ToHtmlDecode();

            var param = new XElement(DomainConstants.XML_ROOT_NAME);

            param.Add(new XElement("MAIL_SUBJECT", subject));
            param.Add(new XElement("MAIL_BODY", htmlMessage));

            //param.Add(new XElement("REGISTRY_LINK", ));
            var    package = new XmlPackage2("notification.emailgiftregistry.xml.config", param);
            string html    = package.TransformString();

            string[] emailacctinfo = InterpriseHelper.GetStoreEmailAccountInfo();

            try
            {
                foreach (var email in emails)
                {
                    AppLogic.SendMailRequest(subject, htmlMessage, true, emailacctinfo[0], emailacctinfo[1], email, email, string.Empty);
                }

                //MailSerder.SendMail(subject, "*****@*****.**", html, SkinID);
                if (isSendCopy)
                {
                    AppLogic.SendMailRequest(subject, htmlMessage, true, emailacctinfo[0], emailacctinfo[1], ThisCustomer.EMail, ThisCustomer.FullName, string.Empty);
                    //MailSerder.SendMail(subject, ThisCustomer.EMail, html, SkinID);
                }

                ctrlGiftRegistryShareForm.ClearTextBox();

                DisplayError(new List <string>()
                {
                    AppLogic.GetString("editgiftregistry.aspx.45", ThisCustomer.SkinID, ThisCustomer.LocaleSetting)
                });
            }
            catch (Exception)
            {
                DisplayError(new List <string>()
                {
                    AppLogic.GetString("editgiftregistry.error.19", ThisCustomer.SkinID, ThisCustomer.LocaleSetting)
                });
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            MobileHelper.RedirectPageWhenMobileIsDisabled("~/", ThisCustomer);

            int         productid = CommonLogic.QueryStringNativeInt("productid");
            XmlPackage2 xp        = new XmlPackage2("mobile.vortxmultiimage", ThisCustomer, ThisCustomer.SkinID, "", "productid=" + productid);

            XMLPackagePlaceHolder.Text = AppLogic.RunXmlPackage(xp, null, ThisCustomer, ThisCustomer.SkinID, true, false);
        }
Esempio n. 6
0
    public void ProcessRequest(HttpContext context)
    {
        string   pn           = XMLPackage;
        Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)context.User).ThisCustomer;

        try
        {
            using (XmlPackage2 p = new XmlPackage2(pn, ThisCustomer, ThisCustomer.SkinID, "", "", "", true))
            {
                if (!p.AllowEngine)
                {
                    context.Response.Write("This XmlPackage is not allowed to be run from the engine.  Set the package element's allowengine attribute to true to enable this package to run.");
                }
                else
                {
                    if (p.HttpHeaders != null)
                    {
                        foreach (XmlNode xn in p.HttpHeaders)
                        {
                            string headername  = xn.Attributes["headername"].InnerText;
                            string headervalue = xn.Attributes["headervalue"].InnerText;
                            context.Response.AddHeader(headername, headervalue);
                        }
                    }

                    StringBuilder output = new StringBuilder(10000);
                    if (p.RequiresParser)
                    {
                        Parser ps = new Parser(ThisCustomer.SkinID, ThisCustomer);
                        output.Append(ps.ReplaceTokens(p.TransformString()));
                    }
                    else
                    {
                        output.Append(p.TransformString());
                    }

                    context.Response.AddHeader("Content-Length", output.Length.ToString());
                    context.Response.Write(output);
                }
            }
        }
        catch (Exception ex)
        {
            context.Response.Write(context.Server.HtmlEncode(ex.Message) + "");
            Exception iex = ex.InnerException;
            while (iex != null)
            {
                context.Response.Write(context.Server.HtmlEncode(ex.Message) + "");
                iex = iex.InnerException;
            }
        }
    }
Esempio n. 7
0
        private static string RunXmlPackage(Customer ThisCustomer, string xmlPackageName, string additionalRuntimeParams)
        {
            Parser p = new Parser(ThisCustomer.SkinID, ThisCustomer);

            string output = string.Empty;

            using (XmlPackage2 xp = new XmlPackage2(xmlPackageName, ThisCustomer, ThisCustomer.SkinID, "", additionalRuntimeParams, String.Empty, true))
            {
                output = AppLogic.RunXmlPackage(xp, p, ThisCustomer, ThisCustomer.SkinID, true, true);
            }

            return(output);
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                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;
                }
            }

            //Make sure the engine can even render this package
            XmlPackage2 engineCheck = new XmlPackage2(Package1.PackageName, ThisCustomer.SkinID);

            if (!engineCheck.AllowEngine)
            {
                throw new Exception("This XmlPackage is not allowed to be run from the engine.  Set the package element's allowengine attribute to true to enable this package to run.");
            }

            if (Package1.ContentType.Length != 0)
            {
                Page.Response.ContentType = Package1.ContentType;
            }
        }
Esempio n. 9
0
        private void InitPatchInformation()
        {
            //Load version xmlpackages
            ArrayList     xmlPackages      = LocalReadAdminXmlPackages("versioninfo");
            StringBuilder sb               = new StringBuilder();
            bool          VersionFileFound = false;

            foreach (String s in xmlPackages)
            {
                VersionFileFound = true;
                XmlPackage2 p = new XmlPackage2(s, null, SkinID);
                sb.Append(p.TransformString());
            }
            if (VersionFileFound)
            {
                litPatchInfo.Text    = sb.ToString();
                pnlPatchInfo.Visible = true;
            }
        }
Esempio n. 10
0
 private String SendTestShippedEmail(Int32 storeId)
 {
     if (!AppLogic.AppConfigBool("SendShippedEMailToCustomer"))
     {
         return(AppLogic.GetString("mailingtest.aspx.11", SkinID, LocaleSetting));
     }
     try
     {
         String      SubjectReceipt = String.Format(AppLogic.GetString("common.cs.2", SkinID, LocaleSetting), AppLogic.AppConfig("StoreName", storeId, true));
         String      PackageName    = AppLogic.AppConfig("XmlPackage.OrderShipped");
         XmlPackage2 p           = new XmlPackage2(PackageName, null, SkinID, String.Empty, "ordernumber=999999");
         String      receiptBody = p.TransformString();
         AppLogic.SendMail(SubjectReceipt, receiptBody + AppLogic.AppConfig("MailFooter"), true, AppLogic.AppConfig("ReceiptEMailFrom", storeId, true), AppLogic.AppConfig("ReceiptEMailFromName", storeId, true), ThisCustomer.EMail, String.Empty, String.Empty, AppLogic.MailServer());
     }
     catch (Exception exception)
     {
         return(GenerateExceptionMessage(exception, storeId));
     }
     return(AppLogic.GetString("mailingtest.aspx.10", SkinID, LocaleSetting));
 }
Esempio n. 11
0
    public void ProcessRequest(HttpContext context)
    {
        string   pn           = CommonLogic.QueryStringCanBeDangerousContent("xmlpackage");
        Customer ThisCustomer = ((InterpriseSuiteEcommercePrincipal)context.User).ThisCustomer;

        try
        {
            using (XmlPackage2 p = new XmlPackage2(pn, ThisCustomer, ThisCustomer.SkinID, "", XmlPackageParam.FromString(""), "", true))
            {
                if (!p.AllowEngine)
                {
                    context.Response.Write("This XmlPackage is not allowed to be run from the engine.  Set the package element's allowengine attribute to true to enable this package to run.");
                }
                else
                {
                    if (p.HttpHeaders != null)
                    {
                        foreach (XmlNode xn in p.HttpHeaders)
                        {
                            string headername  = xn.Attributes["headername"].InnerText;
                            string headervalue = xn.Attributes["headervalue"].InnerText;
                            context.Response.AddHeader(headername, headervalue);
                        }
                    }
                    string output = p.TransformString();
                    context.Response.AddHeader("Content-Length", output.Length.ToString());
                    context.Response.Write(output);
                }
            }
        }
        catch (Exception ex)
        {
            context.Response.Write(ex.Message + "<br/><br/>");
            Exception iex = ex.InnerException;
            while (iex != null)
            {
                context.Response.Write(ex.Message + "<br/><br/>");
                iex = iex.InnerException;
            }
        }
    }
Esempio n. 12
0
        public HierarchicalTableMgr(String TableName, String NodeName, String IDColumnName, String GUIDColumnName, String NameColumnName, String XmlPackageName, int CacheMinutes, int SetInitialContextToNodeID, bool OnlyPublishedEntitiesAndObjects, int StoreID)
        {
            m_TableName      = TableName;
            m_NodeName       = NodeName;
            m_IDColumnName   = IDColumnName;
            m_GUIDColumnName = GUIDColumnName;
            m_NameColumnName = NameColumnName;
            m_CacheName      = String.Format("HTM_{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}", TableName, NodeName, IDColumnName, GUIDColumnName, NameColumnName, XmlPackageName, OnlyPublishedEntitiesAndObjects.ToString(), AppLogic.IsAdminSite.ToString(), StoreID.ToString());
            m_XmlPackageName = XmlPackageName;
            m_OnlyPublishedEntitiesAndObjects = OnlyPublishedEntitiesAndObjects;

            if (m_XmlDoc == null)
            {
                String RTParams = "EntityName=" + TableName + "&PublishedOnly=" + CommonLogic.IIF(m_OnlyPublishedEntitiesAndObjects, "1", "0");
                if (StoreID > 0)
                {
                    RTParams += "&FilterByStore=true&CurrentStoreID=" + StoreID.ToString();
                }
                using (XmlPackage2 p = new XmlPackage2(m_XmlPackageName, null, 1, String.Empty, RTParams, String.Empty, false))
                {
                    m_FinalXml   = p.TransformString();
                    m_DataSetXml = XmlCommon.XmlDecode(p.XmlSystemData);
                    m_XmlDoc     = new XmlDocument();
                    if (m_FinalXml.Length != 0)
                    {
                        using (StringReader sr = new StringReader(m_FinalXml))
                        {
                            using (XmlReader xr = XmlReader.Create(sr))
                            {
                                m_XmlDoc.Load(xr);
                            }
                        }
                    }
                }
            }
            m_NumRootLevelNodes = m_XmlDoc.SelectSingleNode("/root").ChildNodes.Count;
        }
Esempio n. 13
0
        static public void GetLiveRates()
        {
            String PN = AppLogic.AppConfig("Localization.CurrencyFeedXmlPackage");

            if (PN.Length != 0)
            {
                try
                {
                    using (XmlPackage2 p = new XmlPackage2(PN))
                    {
                        m_LastRatesResponseXml    = p.XmlDataDocument.InnerXml;
                        m_LastRatesTransformedXml = p.TransformString();
                        if (m_LastRatesTransformedXml.Length != 0)
                        {
                            // update master db table:
                            XmlDocument d = new XmlDocument();
                            d.LoadXml(m_LastRatesTransformedXml);
                            foreach (XmlNode n in d.SelectNodes("//currency"))
                            {
                                String CurrencyCode = XmlCommon.XmlAttribute(n, "code");
                                String rate         = XmlCommon.XmlAttribute(n, "rate");
                                DB.ExecuteSQL("update Currency set ExchangeRate=" + rate + ", WasLiveRate=1, LastUpdated=getdate() where CurrencyCode=" + DB.SQuote(CurrencyCode));
                            }
                        }
                    }
                    FlushCache(); // flush anyway for safety
                }
                catch (Exception ex)
                {
                    try
                    {
                        AppLogic.SendMail(AppLogic.AppConfig("StoreName") + " Currency.GetLiveRates Failure", "Occurred at: " + Localization.ToNativeDateTimeString(System.DateTime.Now) + CommonLogic.GetExceptionDetail(ex, ""), false, AppLogic.AppConfig("MailMe_FromAddress"), AppLogic.AppConfig("MailMe_FromName"), AppLogic.AppConfig("MailMe_ToAddress"), AppLogic.AppConfig("MailMe_ToName"), String.Empty, AppLogic.MailServer());
                    }
                    catch { }
                }
            }
        }
Esempio n. 14
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                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");

            int IsProductExist = 0;


            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())
                    {
                        HttpContext.Current.Server.Transfer("pagenotfound.aspx");
                    }
                    else
                    {
                        bool published = DB.RSFieldBool(rs, "Published");

                        if (!published)
                        {
                            HttpContext.Current.Server.Transfer("pagenotfound.aspx");
                        }

                        if (AppLogic.AppConfigBool("ProductPageOutOfStockRedirect"))
                        {
                            bool trackInventoryBySizeAndColor = AppLogic.ProductTracksInventoryBySizeAndColor(ProductID);
                            bool outOfStock = AppLogic.ProbablyOutOfStock(ProductID, AppLogic.GetProductsDefaultVariantID(ProductID), trackInventoryBySizeAndColor, "Product");

                            if (outOfStock)
                            {
                                HttpContext.Current.Server.Transfer("pagenotfound.aspx");
                            }
                        }
                    }

                    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");
                    //this part of code is written for kit products. there is no xml package which supports them.
                    if (IsAKit)
                    {
                        IsAKit = false;
                    }
                    //end
                    if (m_XmlPackage.Length == 0)
                    {
                        if (IsAKit)
                        {
                            m_XmlPackage = AppLogic.ro_DefaultProductKitXmlPackage; // provide a default
                        }
                        else
                        {
                            m_XmlPackage = AppLogic.ro_DefaultProductXmlPackage; // provide a default
                        }
                    }
                    RequiresReg = DB.RSFieldBool(rs, "RequiresRegistration");
                    ProductName = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting);
                    //Get Customer Funds/Blue BuksPoint and Set BluBuks Point on popup.1 is id for BluBuks


                    int pvariantid = AppLogic.GetProductsDefaultVariantID(ProductID);
                    //Check if product already exist in shopping cart
                    SqlParameter[] spa = { DB.CreateSQLParameter("@CustomerID", SqlDbType.Int, 4, ThisCustomer.CustomerID, ParameterDirection.Input),
                                           DB.CreateSQLParameter("@ProductID",  SqlDbType.Int, 4, ProductID,               ParameterDirection.Input),
                                           DB.CreateSQLParameter("@VariantID",  SqlDbType.Int, 4, pvariantid,              ParameterDirection.Input),
                                           DB.CreateSQLParameter("@StoreID",    SqlDbType.Int, 4, ThisCustomer.StoreID,    ParameterDirection.Input),
                                           DB.CreateSQLParameter("@IsExist",    SqlDbType.Int, 4, null,                    ParameterDirection.Output) };
                    IsProductExist         = DB.ExecuteStoredProcInt("dbo.aspdnsf_IsProductExistsinShoppingCart", spa);
                    hdnIsProductExist.Text = IsProductExist.ToString();
                    hdnProductID.Text      = ProductID.ToString();
                    hdnVariantID.Text      = pvariantid.ToString();
                    hdnCustomerID.Text     = ThisCustomer.CustomerID.ToString();

                    //end check if product already exist in shopping cart

                    //Apply fund
                    decimal pvprice = AppLogic.GetVariantPrice(pvariantid);
                    hdnButtonName.Text    = "AddToCartButton_" + ProductID + "_" + pvariantid;
                    hdncustomerlevel.Text = Convert.ToString(ThisCustomer.CustomerLevelID);
                    Decimal productcategoryfund = Convert.ToDecimal(hdnProductFundAmount.Text);
                    Decimal productprice        = Convert.ToDecimal(pvprice);
                    CustomerFunds = AuthenticationSSO.GetCustomerFund(ThisCustomer.CustomerID);
                    if (CustomerFunds.Count > 0)
                    {
                        //BluBucks
                        CustomerFund tempBluBucksfund = CustomerFunds.Find(x => x.FundID == Convert.ToInt32(FundType.BLUBucks));
                        if (tempBluBucksfund != null)
                        {
                            BluBuksPoints           = CustomerFunds.Find(x => x.FundID == 1).AmountAvailable.ToString();
                            hdnBluBucktsPoints.Text = Math.Round(Convert.ToDecimal(BluBuksPoints), 2).ToString();
                            ppointscount.InnerText  = "You have " + Math.Round(Convert.ToDecimal(BluBuksPoints), 2) + " BLU™ Bucks you can use to purchase items.";
                        }
                        else
                        {
                            BluBuksPoints           = "0".ToString();
                            hdnBluBucktsPoints.Text = Math.Round(Convert.ToDecimal(BluBuksPoints), 2).ToString();
                            ppointscount.InnerText  = "You have " + Math.Round(Convert.ToDecimal(BluBuksPoints), 2) + " BLU™ Bucks you can use to purchase items.";
                        }

                        //Category Fund
                        hdnProductFundID.Text = Convert.ToString(DB.RSFieldInt(rs, "FundID"));
                        if (hdnProductFundID.Text.Trim() != "" && hdnProductFundID.Text != "0")
                        {
                            CustomerFund tempfund = CustomerFunds.Find(x => x.FundID == Convert.ToInt32(hdnProductFundID.Text));
                            if (tempfund != null)
                            {
                                hdnProductFundAmount.Text = tempfund.AmountAvailable.ToString();
                                hdnFundName.Text          = tempfund.FundName;
                                productcategoryfund       = Convert.ToDecimal(hdnProductFundAmount.Text);
                            }
                            else
                            {
                                tempfund = CustomerFunds.Find(x => x.FundID == Convert.ToInt32(FundType.SOFFunds));//for sales rep
                                if (tempfund != null)
                                {
                                    hdnProductFundAmount.Text = tempfund.AmountAvailable.ToString();
                                    hdnFundName.Text          = tempfund.FundName;
                                    productcategoryfund       = Convert.ToDecimal(hdnProductFundAmount.Text);
                                }
                                else
                                {
                                    hdnProductFundAmount.Text = "0";
                                    productcategoryfund       = Convert.ToDecimal("0.00");
                                }
                                hdnProductFundID.Text = "2";
                            }
                        }
                        else
                        {
                            CustomerFund tempfund = CustomerFunds.Find(x => x.FundID == Convert.ToInt32(FundType.SOFFunds));//for sales rep
                            if (tempfund != null)
                            {
                                hdnProductFundAmount.Text = tempfund.AmountAvailable.ToString();
                                hdnFundName.Text          = tempfund.FundName;
                                productcategoryfund       = Convert.ToDecimal(hdnProductFundAmount.Text);
                                hdnProductFundID.Text     = "2";
                            }
                            else
                            {
                                hdnProductFundAmount.Text = "0";
                                productcategoryfund       = Convert.ToDecimal("0.00");
                            }
                        }

                        hdnproductprice.Text = productprice.ToString().Replace("$", "").Replace(",", "").Replace(" ", "");
                        if (this.IsPostBack)
                        {
                            hdnquantity.Text = Request.Form["Quantity_1_1"];
                        }
                        else
                        {
                            hdnquantity.Text = "1";
                        }

                        if (String.IsNullOrEmpty(hdnquantity.Text) || String.IsNullOrWhiteSpace(hdnquantity.Text))
                        {
                            hdnquantity.Text = "0";
                        }
                        productprice = productprice * Convert.ToInt32(hdnquantity.Text);
                        if (productcategoryfund < productprice)
                        {
                            productprice = productprice - productcategoryfund;
                            hdnProductFundAmountUsed.Text = (Convert.ToDecimal(productcategoryfund)).ToString();
                        }
                        else
                        {
                            productcategoryfund           = productcategoryfund - productprice;
                            hdnProductFundAmountUsed.Text = (Convert.ToDecimal(productprice)).ToString();
                            productprice        = 0;
                            txtBluBuksUsed.Text = productprice.ToString();
                        }
                        hdnpricewithfund.Text = productprice.ToString();
                        //End apply fund
                        //End
                    }
                    else
                    {
                        hdnpricewithfund.Text   = productprice.ToString();
                        hdnBluBucktsPoints.Text = "0";
                        ppointscount.InnerText  = "You have " + Math.Round(Convert.ToDecimal(0.00), 2) + " BLU™ Bucks you can use to purchase your items.";
                    }

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

            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       += "<b>" + AppLogic.GetString("showproduct.aspx.1", SkinID, ThisCustomer.LocaleSetting) + "</b><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);
                m_PageOutputCustom += "<b>" + AppLogic.GetString("showproduct.aspx.1", SkinID, ThisCustomer.LocaleSetting) + "</b><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";
                m_PageOutputCustom = "<!-- 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>";
                    m_PageOutputCustom += "<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;
                        }
                    }
                    //Get add to cart button for popup
                    using (XmlPackage2 p = new XmlPackage2("product.SimpleProductCustom.xml.config", 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_PageOutputCustom = AppLogic.RunXmlPackage(p, base.GetParser, ThisCustomer, SkinID, true, true);
                        LiteralCustom.Text = m_PageOutputCustom;
                    }
                }
            }
            if (!this.IsPostBack)
            {
                litOutput.Text = m_PageOutput;
            }

            GetParentCategory();
            if (!string.IsNullOrEmpty(SourceEntityInstanceName) && !string.IsNullOrEmpty(parentCategoryID))
            {
                parentCategoryName = CategoryHelper.GetEntityName(Convert.ToInt32(parentCategoryID), ThisCustomer.LocaleSetting);

                ((System.Web.UI.WebControls.HyperLink)Master.FindControl("lnkCategory")).Text        = parentCategoryName;
                ((System.Web.UI.WebControls.HyperLink)Master.FindControl("lnkCategory")).NavigateUrl = "~/c-" + parentCategoryID + "-" + parentCategoryName.Replace(" ", "-") + ".aspx";

                ((System.Web.UI.WebControls.Label)Master.FindControl("lblSperator")).Text = ">>";

                ((System.Web.UI.WebControls.HyperLink)Master.FindControl("lnkSubCategory")).Text        = SourceEntityInstanceName;
                ((System.Web.UI.WebControls.HyperLink)Master.FindControl("lnkSubCategory")).NavigateUrl = "~/c-" + SourceEntityID + "-" + SourceEntityInstanceName.Replace(" ", "-") + ".aspx";
            }

            //get fund BluBucks Percentage
            BudgetPercentageRatio FundPercentage = AuthenticationSSO.GetBudgetPercentageRatio(ThisCustomer.CustomerLevelID, Convert.ToInt32(parentCategoryID));
            hdnBudgetPercentValue.Text = FundPercentage.BudgetPercentageValue.ToString();
            ppercentage.InnerText      = "You can pay for up to " + hdnBudgetPercentValue.Text + "% of this item's cost with BLU™ Bucks.";
            hdnProductCategoryID.Text  = parentCategoryID.ToString();
            LstInventories             = JsonConvert.SerializeObject(AppLogic.LstInventory);
            hdnInventory.Text          = JsonConvert.SerializeObject(AppLogic.LstInventory);
        }
Esempio n. 15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     m_DesignMode = (HttpContext.Current == null);
     if (m_DesignMode)
     {
         if (PackageName.Length != 0)
         {
             Contents.Text = "XmlPackage: " + PackageName;
         }
         else
         {
             Contents.Text = "XmlPackage";
         }
     }
     else
     {
         try
         {
             int SkinID = 1;
             if (ThisCustomer != null)
             {
                 SkinID = ThisCustomer.SkinID;
             }
             m_P             = new XmlPackage2(PackageName, ThisCustomer, SkinID, String.Empty, RuntimeParams, String.Empty, true);
             Contents.Text   = m_P.TransformString();
             m_SectionTitle  = m_P.SectionTitle;
             m_SETitle       = m_P.SETitle;
             m_SEKeywords    = m_P.SEKeywords;
             m_SEDescription = m_P.SEDescription;
             m_SENoScript    = m_P.SENoScript;
         }
         catch (Exception ex)
         {
             Contents.Text = CommonLogic.GetExceptionDetail(ex, "<br/>");
         }
         if (Page != null)
         {
             if (m_SectionTitle.Length != 0)
             {
                 Page.SectionTitle = m_SectionTitle;
             }
             if (m_SETitle.Length != 0)
             {
                 Page.SETitle = m_SETitle;
             }
             if (m_SEKeywords.Length != 0)
             {
                 Page.SEKeywords = m_SEKeywords;
             }
             if (m_SEDescription.Length != 0)
             {
                 Page.SEDescription = m_SEDescription;
             }
             if (m_SENoScript.Length != 0)
             {
                 Page.SENoScript = m_SENoScript;
             }
         }
         if (m_P != null && (AppLogic.AppConfigBool("XmlPackage.DumpTransform") || m_P.IsDebug))
         {
             Panel1.Visible = true;
             Debug1.Text    = "<br/><div><b>" + m_P.URL + "</b><br/><textarea READONLY style=\"width: 100%\" rows=\"50\">" + XmlCommon.PrettyPrintXml(m_P.PackageDocument.InnerXml) + "</textarea></div>";
             Debug2.Text    = "<div><b>" + PackageName + "_store.runtime.xml</b><br/><textarea READONLY cols=\"80\" rows=\"50\">" + CommonLogic.ReadFile(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "images/" + PackageName + "_" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin", "store") + ".runtime.xml", true) + "</textarea></div>";
             Debug3.Text    = "<div><b>" + PackageName + "_store.xfrm.xml</b><br/><textarea READONLY cols=\"80\" rows=\"50\">" + CommonLogic.ReadFile(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "images/" + PackageName + "_" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin", "store") + ".xfrm.xml", true) + "</textarea></div>";
         }
         else
         {
             Panel1.Visible = false;
         }
     }
 }
    private String SendTestNewOrderNotification()
    {
        try
        {
            String newOrderSubject = String.Format(AppLogic.GetString("common.cs.5", 1, thisUserAccount.LocaleSetting), AppLogic.AppConfig("StoreName"));

            String PackageName = AppLogic.AppConfig("XmlPackage.NewOrderAdminNotification");

            using (XmlPackage2 p = new XmlPackage2(PackageName, null, 1, String.Empty, XmlPackageParam.FromString("ordernumber=" + _testSalesOrderCode)))
            {
                String newOrderNotification = p.TransformString();

                String SendToList = AppLogic.AppConfig("GotOrderEMailTo").ToString().Replace(",", ";");
                if (SendToList.IndexOf(';') != -1)
                {
                    foreach (String s in SendToList.Split(';'))
                    {
                        AppLogic.SendMail(newOrderSubject, newOrderNotification + AppLogic.AppConfig("MailFooter"), true, AppLogic.AppConfig("GotOrderEMailFrom"), AppLogic.AppConfig("GotOrderEMailFromName"), s.Trim(), s.Trim(), String.Empty, AppLogic.MailServer(), true);
                    }
                }
                else
                {
                    AppLogic.SendMail(newOrderSubject, newOrderNotification + AppLogic.AppConfig("MailFooter"), true, AppLogic.AppConfig("GotOrderEMailFrom"), AppLogic.AppConfig("GotOrderEMailFromName"), SendToList, SendToList, String.Empty, AppLogic.MailServer(), true);
                }
            }
        }
        catch (Exception e)
        {
            int    MailMe_PwdLen  = AppLogic.AppConfig("MailMe_Pwd").ToString().Length;
            int    MailMe_UserLen = AppLogic.AppConfig("MailMe_User").ToString().Length;
            String errMsg         = String.Empty;

            if (e.Message.ToString().IndexOf("AUTHENTICATION", StringComparison.InvariantCultureIgnoreCase) != -1 ||
                e.Message.ToString().IndexOf("OBJECT REFERENCE", StringComparison.InvariantCultureIgnoreCase) != -1 ||
                e.Message.ToString().IndexOf("NO SUCH USER HERE", StringComparison.InvariantCultureIgnoreCase) != -1)
            {
                if (MailMe_UserLen == 0 && MailMe_PwdLen == 0)
                {
                    errMsg = AppLogic.GetString("mailingtest.aspx.4", 1, thisUserAccount.LocaleSetting) + "<br/>&nbsp;�" + AppLogic.GetString("mailingtest.aspx.7", 1, thisUserAccount.LocaleSetting) + "<br/>&nbsp;�" + AppLogic.GetString("mailingtest.aspx.6", 1, thisUserAccount.LocaleSetting);
                }
                else if (MailMe_UserLen == 0)
                {
                    errMsg = AppLogic.GetString("mailingtest.aspx.4", 1, thisUserAccount.LocaleSetting) + "<br/>&nbsp;�" + AppLogic.GetString("mailingtest.aspx.7", 1, thisUserAccount.LocaleSetting);
                }
                else if (MailMe_PwdLen == 0)
                {
                    errMsg = AppLogic.GetString("mailingtest.aspx.4", 1, thisUserAccount.LocaleSetting) + "<br/>&nbsp;�" + AppLogic.GetString("mailingtest.aspx.6", 1, thisUserAccount.LocaleSetting);
                }
                else
                {
                    errMsg = AppLogic.GetString("mailingtest.aspx.4", 1, thisUserAccount.LocaleSetting) + "<br/>&nbsp;�" + AppLogic.GetString("mailingtest.aspx.9", 1, thisUserAccount.LocaleSetting);
                }

                if (errMsg.Length != 0)
                {
                    return(errMsg);
                }
            }
            return(AppLogic.GetString("mailingtest.aspx.4", 1, thisUserAccount.LocaleSetting) + "<br/>&nbsp;�" + e.Message.ToString());
        }
        return(AppLogic.GetString("mailingtest.aspx.2", 1, thisUserAccount.LocaleSetting));
    }
        private SkinBase m_SkinBase = null; // if not null, this control will set the page metatags to the results from the XmlPackage, IF those xmlpackage results are not "empty strings"

        protected void Page_Load(object sender, EventArgs e)
        {
            m_DesignMode = (HttpContext.Current == null);
            if (m_DesignMode)
            {
                if (PackageName.Length != 0)
                {
                    Contents.Text = "XmlPackage: " + PackageName;
                }
                else
                {
                    Contents.Text = "XmlPackage";
                }
            }
            else
            {
                try
                {
                    List <XmlPackageParam> runtimeParams = AppLogic.MakeXmlPackageParamsFromString(RuntimeParams);

                    m_P = new XmlPackage2(PackageName, ThisCustomer, ThisCustomer.SkinID, String.Empty, runtimeParams, String.Empty, true);

                    if (!m_P.AllowEngine && this.Page.Request.Url.AbsoluteUri.IndexOf("engine.aspx") != -1)
                    {
                        throw new Exception("This XmlPackage is not allowed to be run from the engine.  Set the package element's allowengine attribute to true to enable this package to run.");
                    }

                    Contents.Text   = m_P.TransformString();
                    m_SectionTitle  = m_P.SectionTitle;
                    m_SETitle       = m_P.SETitle;
                    m_SEKeywords    = m_P.SEKeywords;
                    m_SEDescription = m_P.SEDescription;
                    m_SENoScript    = m_P.SENoScript;
                }
                catch (Exception ex)
                {
                    Contents.Text = CommonLogic.GetExceptionDetail(ex, "<br/>");
                }
                if (Page != null && m_AllowSEPropogation)
                {
                    if (m_SectionTitle.Length != 0)
                    {
                        Page.SectionTitle = m_SectionTitle;
                    }
                    if (m_SETitle.Length != 0)
                    {
                        Page.SETitle = m_SETitle;
                    }
                    if (m_SEKeywords.Length != 0)
                    {
                        Page.SEKeywords = m_SEKeywords;
                    }
                    if (m_SEDescription.Length != 0)
                    {
                        Page.SEDescription = m_SEDescription;
                    }
                    if (m_SENoScript.Length != 0)
                    {
                        Page.SENoScript = m_SENoScript;
                    }
                }
                if (m_P != null && (AppLogic.AppConfigBool("XmlPackage.DumpTransform") || m_P.IsDebug))
                {
                    Panel1.Visible = true;
                    Debug1.Text    = "<br/><div><b>" + m_P.URL + "</b><br/><textarea READONLY style=\"width: 100%\" rows=\"50\">" + XmlCommon.PrettyPrintXml(m_P.PackageDocument.InnerXml) + "</textarea></div>";
                    Debug2.Text    = "<div><b>" + PackageName + "_store.runtime.xml</b><br/><textarea READONLY cols=\"80\" rows=\"50\">images/" + PackageName + "_store.runtime.xml" + "</textarea></div>";
                    Debug3.Text    = "<div><b>" + PackageName + "_store.xfrm.xml</b><br/><textarea READONLY cols=\"80\" rows=\"50\">images/" + PackageName + "_store.xfrm.xml" + "</textarea></div>";
                }
                else
                {
                    Panel1.Visible = false;
                }
            }
        }
Esempio n. 18
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;
                }
            }
        }
Esempio n. 19
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;
        }
Esempio n. 20
0
        private SkinBase m_SkinBase = null; // if not null, this control will set the page metatags to the results from the XmlPackage, IF those xmlpackage results are not "empty strings"

        protected void Page_Load(object sender, EventArgs e)
        {
            m_ThisCustomer = Customer.Current;

            // Load Child Controls
            Literal Contents = new Literal();

            Contents.ID = "Contents";
            Contents.EnableViewState = false;
            Contents.Mode            = LiteralMode.PassThrough;
            Contents.Text            = "<b>XmlPackage</b>";

            this.Controls.Add(Contents);

            Panel Panel1 = new Panel();

            Panel1.Style.Add(HtmlTextWriterStyle.Width, "100%");

            Literal Debug1 = new Literal();

            Debug1.EnableViewState = false;
            Debug1.Mode            = LiteralMode.PassThrough;

            Literal Debug2 = new Literal();

            Debug2.EnableViewState = false;
            Debug2.Mode            = LiteralMode.PassThrough;

            Literal Debug3 = new Literal();

            Debug3.EnableViewState = false;
            Debug3.Mode            = LiteralMode.PassThrough;

            Panel1.Controls.Add(Debug1);
            Panel1.Controls.Add(Debug2);
            Panel1.Controls.Add(Debug3);

            this.Controls.Add(Panel1);

            m_DesignMode = (HttpContext.Current == null);
            if (m_DesignMode)
            {
                if (PackageName.Length != 0)
                {
                    Contents.Text = "XmlPackage: " + PackageName;
                }
                else
                {
                    Contents.Text = "XmlPackage";
                }
            }
            else
            {
                using (XmlPackage2 m_P = new XmlPackage2(PackageName, ThisCustomer, ThisCustomer.SkinID, String.Empty, RuntimeParams, String.Empty, true))
                {
                    try
                    {
                        if (Page == null)
                        {
                            Page = HttpContext.Current.CurrentHandler as SkinBase;
                        }

                        String s = AppLogic.RunXmlPackage(m_P, Page.GetParser, Page.ThisCustomer, Page.ThisCustomer.SkinID, m_ReplaceTokens, true);
                        Contents.Text = s;

                        m_SectionTitle  = m_P.SectionTitle;
                        m_SETitle       = m_P.SETitle;
                        m_SEKeywords    = m_P.SEKeywords;
                        m_SEDescription = m_P.SEDescription;
                        m_SENoScript    = m_P.SENoScript;
                    }
                    catch (Exception ex)
                    {
                        Contents.Text = CommonLogic.GetExceptionDetail(ex, "");
                    }
                    if (Page != null && m_AllowSEPropogation)
                    {
                        if (m_SectionTitle.Length != 0)
                        {
                            Page.SectionTitle = m_SectionTitle;
                        }
                        if (m_SETitle.Length != 0)
                        {
                            Page.SETitle = m_SETitle;
                        }
                        if (m_SEKeywords.Length != 0)
                        {
                            Page.SEKeywords = m_SEKeywords;
                        }
                        if (m_SEDescription.Length != 0)
                        {
                            Page.SEDescription = m_SEDescription;
                        }
                        if (m_SENoScript.Length != 0)
                        {
                            Page.SENoScript = m_SENoScript;
                        }
                    }
                    if (m_P != null && (AppLogic.AppConfigBool("XmlPackage.DumpTransform") || m_P.IsDebug))
                    {
                        Panel1.Visible = true;
                        Debug1.Text    = "<div><b>" + m_P.URL + "</b><textarea READONLY style=\"width: 100%\" rows=\"50\">" + XmlCommon.PrettyPrintXml(m_P.PackageDocument.InnerXml) + "</textarea></div>";
                        Debug2.Text    = "<div><b>" + PackageName + "_store.runtime.xml</b><textarea READONLY cols=\"80\" rows=\"50\">" + CommonLogic.ReadFile(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "images/" + PackageName + "_" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin", "store") + ".runtime.xml", true) + "</textarea></div>";
                        Debug3.Text    = "<div><b>" + PackageName + "_store.xfrm.xml</b><textarea READONLY cols=\"80\" rows=\"50\">" + CommonLogic.ReadFile(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "images/" + PackageName + "_" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin", "store") + ".xfrm.xml", true) + "</textarea></div>";
                    }
                    else
                    {
                        Panel1.Visible = false;
                    }
                }
            }
        }
Esempio n. 21
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"))
            {
                m_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.Server.Transfer("pagenotfound.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.Server.Transfer("pagenotfound.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}|{5}|{6}",
                                                      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(),
                                                      Vortx.MobileFramework.MobileHelper.isMobile() ? "Mobile" : "Desktop"
                                                      );

                            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();
            }
        }
Esempio n. 22
0
    protected void btnRequestNewPassword_Click(object sender, EventArgs e)
    {
        string FromEMail = AppLogic.AppConfig("MailMe_FromAddress");
        string EMail     = CommonLogic.IIF(CommonLogic.FormCanBeDangerousContent("txtEMailRemind").Length > 0, CommonLogic.FormCanBeDangerousContent("txtEMailRemind"), CommonLogic.FormCanBeDangerousContent("txtEMail"));

        ltError.Text = "Email: " + EMail;

        Customer c = new Customer(null, EMail, false, false, true);

        if (!c.IsRegistered)
        {
            ltError.Text = "<font color=\"#FF0000\"><b>" + AppLogic.GetString("signin.aspx.admin.1", c.SkinID, c.LocaleSetting) + "</b></font>";
        }
        else if (AppLogic.MailServer().Length == 0 || AppLogic.MailServer() == AppLogic.ro_TBD)
        {
            ltError.Text = "<font color=\"#FF0000\"><b>" + AppLogic.GetString("signin.aspx.admin.2", c.SkinID, c.LocaleSetting) + "</b></font>";
        }
        else
        {
            Password p         = new Password();
            bool     SendWasOk = false;
            try
            {
                String      PackageName = AppLogic.AppConfig("XmlPackage.LostPassword");
                XmlPackage2 pkg         = new XmlPackage2(PackageName, c, c.SkinID, String.Empty, "newpwd=" + p.ClearPassword.Replace("&", "*") + "&thiscustomerid=" + c.CustomerID.ToString());
                String      MsgBody     = pkg.TransformString();
                AppLogic.SendMail(AppLogic.AppConfig("StoreName") + " " + AppLogic.GetString("lostpassword.aspx.6", c.SkinID, c.LocaleSetting), MsgBody, true, FromEMail, FromEMail, EMail, EMail, "", AppLogic.MailServer());
                SendWasOk = true;
                object lockeduntil = DateTime.Now.AddMinutes(-1);

                c.UpdateCustomer(
                    /*CustomerLevelID*/ null,
                    /*EMail*/ null,
                    /*SaltedAndHashedPassword*/ p.SaltedPassword,
                    /*SaltKey*/ p.Salt,
                    /*DateOfBirth*/ null,
                    /*Gender*/ null,
                    /*FirstName*/ null,
                    /*LastName*/ null,
                    /*Notes*/ null,
                    /*SkinID*/ null,
                    /*Phone*/ null,
                    /*AffiliateID*/ null,
                    /*Referrer*/ null,
                    /*CouponCode*/ null,
                    /*OkToEmail*/ null,
                    /*IsAdmin*/ null,
                    /*BillingEqualsShipping*/ null,
                    /*LastIPAddress*/ null,
                    /*OrderNotes*/ null,
                    /*SubscriptionExpiresOn*/ null,
                    /*RTShipRequest*/ null,
                    /*RTShipResponse*/ null,
                    /*OrderOptions*/ null,
                    /*LocaleSetting*/ null,
                    /*MicroPayBalance*/ null,
                    /*RecurringShippingMethodID*/ null,
                    /*RecurringShippingMethod*/ null,
                    /*BillingAddressID*/ null,
                    /*ShippingAddressID*/ null,
                    /*GiftRegistryGUID*/ null,
                    /*GiftRegistryIsAnonymous*/ null,
                    /*GiftRegistryAllowSearchByOthers*/ null,
                    /*GiftRegistryNickName*/ null,
                    /*GiftRegistryHideShippingAddresses*/ null,
                    /*CODCompanyCheckAllowed*/ null,
                    /*CODNet30Allowed*/ null,
                    /*ExtensionData*/ null,
                    /*FinalizationData*/ null,
                    /*Deleted*/ null,
                    /*Over13Checked*/ null,
                    /*CurrencySetting*/ null,
                    /*VATSetting*/ null,
                    /*VATRegistrationID*/ null,
                    /*StoreCCInDB*/ null,
                    /*IsRegistered*/ null,
                    /*LockedUntil*/ lockeduntil,
                    /*AdminCanViewCC*/ null,
                    /*BadLogin*/ -1,
                    /*Active*/ null,
                    /*PwdChangeRequired*/ 1,
                    /*RegisterDate*/ null,
                    /*StoreId*/ null
                    );
            }
            catch { }
            if (!SendWasOk)
            {
                ltError.Text = "<font color=\"#FF0000\"><b>" + AppLogic.GetString("lostpassword.aspx.3", c.SkinID, c.LocaleSetting) + "</b></font>";
            }
            else
            {
                ltError.Text = "<font color=\"#F0FA9F\"><b>" + AppLogic.GetString("lostpassword.aspx.2", c.SkinID, c.LocaleSetting) + "</b></font>";
            }
        }
    }
Esempio n. 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");

            cust                 = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer;
            GiftCardID           = CommonLogic.QueryStringNativeInt("iden");
            lnkUsage.NavigateUrl = "" + AppLogic.AdminLinkUrl("giftcardusage.aspx") + "?iden=" + GiftCardID;

            if (GiftCardID == 0)
            {
                OrderNumberRow.Visible                  = false;
                RemainingBalanceRow.Visible             = false;
                ltAmount.Visible                        = false;
                PurchasedByCustomerIDLiteralRow.Visible = false;
                GiftCardTypeDisplayRow.Visible          = false;
                InitialAmountLiteralRow.Visible         = false;
                PurchasedByCustomerIDTextRow.Visible    = true;
                reqCustEmail.Enabled                    = true;
            }
            else
            {
                txtAmount.Visible = false; // cannot change after first created
                PurchasedByCustomerIDTextRow.Visible = false;
                reqCustEmail.Enabled          = false;
                GiftCardTypeSelectRow.Visible = false;
                InitialAmountTextRow.Visible  = false;
            }

            if (!IsPostBack)
            {
                ltScript.Text  = ("\n<script type=\"text/javascript\">\n");
                ltScript.Text += ("    Calendar.setup({\n");
                ltScript.Text += ("        inputField     :    \"" + txtDate.ClientID + "\",      // id of the input field\n");
                ltScript.Text += ("        ifFormat       :    \"" + Localization.JSCalendarDateFormatSpec() + "\",       // format of the input field\n");
                ltScript.Text += ("        showsTime      :    false,            // will display a time selector\n");
                ltScript.Text += ("        button         :    \"f_trigger_s\",   // trigger for the calendar (button ID)\n");
                ltScript.Text += ("        singleClick    :    true            // double-click mode\n");
                ltScript.Text += ("    });\n");
                ltScript.Text += ("</script>\n");

                ltDate.Text = "<img class=\"actionelement\" src=\"" + AppLogic.LocateImageURL("~/App_Themes/Admin_Default/images/calendar.gif") + "\" align=\"absmiddle\" id=\"f_trigger_s\">&nbsp;<small>(" + Localization.ShortDateFormat() + ")</small>";

                ltStyles.Text  = ("  <!-- calendar stylesheet -->\n");
                ltStyles.Text += ("  <link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"jscalendar/calendar-win2k-cold-1.css\" title=\"win2k-cold-1\" />\n");
                ltStyles.Text += ("\n");
                ltStyles.Text += ("  <!-- main calendar program -->\n");
                ltStyles.Text += ("  <script type=\"text/javascript\" src=\"jscalendar/calendar.js\"></script>\n");
                ltStyles.Text += ("\n");
                ltStyles.Text += ("  <!-- language for the calendar -->\n");
                ltStyles.Text += ("  <script type=\"text/javascript\" src=\"jscalendar/lang/" + Localization.JSCalendarLanguageFile() + "\"></script>\n");
                ltStyles.Text += ("\n");
                ltStyles.Text += ("  <!-- the following script defines the Calendar.setup helper function, which makes\n");
                ltStyles.Text += ("       adding a calendar a matter of 1 or 2 lines of code. -->\n");
                ltStyles.Text += ("  <script type=\"text/javascript\" src=\"jscalendar/calendar-setup.js\"></script>\n");

                if (GiftCardID > 0)
                {
                    trEmail.Visible = false;
                    ltCard.Text     = DB.GetSqlS("SELECT SerialNumber AS S FROM GiftCard with (NOLOCK) WHERE GiftCardID=" + CommonLogic.QueryStringCanBeDangerousContent("iden"));
                    btnSubmit.Text  = AppLogic.GetString("admin.editgiftcard.UpdateGiftCard", SkinID, LocaleSetting);

                    loadData();

                    if (CommonLogic.QueryStringNativeInt("added") == 1)
                    {
                        resetError(AppLogic.GetString("admin.editgiftcard.GiftCardAdded", SkinID, LocaleSetting), false);
                    }
                    else if (CommonLogic.QueryStringNativeInt("added") == 2)
                    {
                        resetError(AppLogic.GetString("admin.editgiftcard.GiftCardUpdated", SkinID, LocaleSetting), false);
                    }
                    else if (CommonLogic.QueryStringNativeInt("added") == 3)
                    {
                        resetError(AppLogic.GetString("giftcard.email.error.1", cust.SkinID, cust.LocaleSetting), true);
                    }
                    if (etsMapper.ObjectID != GiftCardID)
                    {
                        etsMapper.ObjectID = GiftCardID;
                        etsMapper.DataBind();
                    }
                }
                else
                {
                    lblAction.Visible       = false;
                    rblAction.Visible       = false;
                    ltCurrentBalance.Text   = "NA";
                    trEmail.Visible         = true;
                    ltCard.Text             = AppLogic.GetString("admin.editgiftcard.NewGiftCard", SkinID, LocaleSetting);
                    btnSubmit.Text          = AppLogic.GetString("admin.editgiftcard.AddGiftCard", SkinID, LocaleSetting);
                    rblAction.SelectedIndex = 0;

                    XmlPackage2            iData = new XmlPackage2("giftcardassignment.xml.config");
                    System.Xml.XmlDocument xd    = iData.XmlDataDocument;
                    txtSerial.Text = xd.SelectSingleNode("/root/GiftCardAssignment/row/CardNumber").InnerText;
                    txtDate.Text   = DateTime.Now.AddYears(1).ToShortDateString();
                }
            }

            litStoreMapper.Visible    = etsMapper.StoreCount > 1;
            litStoreMapperHdr.Visible = etsMapper.StoreCount > 1;
        }