예제 #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            EntityId    = CommonLogic.QueryStringUSInt("EntityID");
            EntityName  = CommonLogic.QueryStringCanBeDangerousContent("EntityName");
            EntitySpecs = EntityDefinitions.LookupSpecs(EntityName);
            Helper      = new EntityHelper(EntitySpecs, 0);

            if (EntityId == 0 || EntityName.Length == 0)
            {
                RenderContainer.Text = "Invalid Parameters";
                return;
            }

            SelectedLocale = LocaleSource.GetDefaultLocale();

            Render(SelectedLocale.Name);
            DataBind();
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            EntityId    = CommonLogic.QueryStringUSInt("EntityID");;
            EntityName  = CommonLogic.QueryStringCanBeDangerousContent("EntityName");
            EntitySpecs = EntityDefinitions.LookupSpecs(EntityName);
            Helper      = new EntityHelper(EntitySpecs, 0);

            if (EntityId == 0 || EntityName.Length == 0)
            {
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                MainBody.Visible = false;
                return;
            }

            SelectedLocale = LocaleSource.GetDefaultLocale();

            LoadBody(SelectedLocale.Name);
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            EntityId    = CommonLogic.QueryStringUSInt("EntityID");
            EntityName  = CommonLogic.QueryStringCanBeDangerousContent("EntityName");
            EntitySpecs = EntityDefinitions.LookupSpecs(EntityName);
            Helper      = new EntityHelper(EntitySpecs, 0);

            if (EntityId == 0 || EntityName.Length == 0)
            {
                ltBody.Text = AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting);
                return;
            }

            if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase))
            {
                for (var i = 0; i <= Request.Form.Count - 1; i++)
                {
                    var fieldName = Request.Form.Keys[i];
                    if (fieldName.StartsWith("shippingcost", StringComparison.InvariantCultureIgnoreCase) && !fieldName.EndsWith("_vldt", StringComparison.InvariantCultureIgnoreCase))
                    {
                        var fieldNameSplit   = fieldName.Split('_');
                        var variantId        = Localization.ParseUSInt(fieldNameSplit[1]);
                        var shippingMethodId = Localization.ParseUSInt(fieldNameSplit[2]);
                        var shippingCost     = CommonLogic.FormUSDecimal(fieldName);
                        DB.ExecuteSQL("delete from ShippingByProduct where VariantID=" + variantId.ToString() + " and ShippingMethodID=" + shippingMethodId.ToString());
                        DB.ExecuteSQL("insert ShippingByProduct(VariantID,ShippingMethodID,ShippingCost) values(" + variantId.ToString() + "," + shippingMethodId.ToString() + "," + Localization.CurrencyStringForDBWithoutExchangeRate(shippingCost) + ")");
                    }
                }

                AlertMessageDisplay.PushAlertMessage("The shipping costs have been saved.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
            }

            SelectedLocale = LocaleSource.GetDefaultLocale();

            LoadBody(SelectedLocale.Name);
        }
예제 #4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            EntityID      = CommonLogic.QueryStringUSInt("EntityID");;
            EntityName    = CommonLogic.QueryStringCanBeDangerousContent("EntityName");
            m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName);
            Helper        = new EntityHelper(m_EntitySpecs, 0);

            if (EntityID == 0 || EntityName.Length == 0)
            {
                Response.Redirect(AppLogic.AdminLinkUrl("default.aspx"));
            }

            SelectedLocale = LocaleSource.GetDefaultLocale();

            if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase))
            {
                for (var i = 0; i <= Request.Form.Count - 1; i++)
                {
                    var FieldName = Request.Form.Keys[i];
                    if (FieldName.StartsWith("setitle", StringComparison.InvariantCultureIgnoreCase))
                    {
                        var FieldNameSplit = FieldName.Split('_');
                        var TheProductID   = Localization.ParseUSInt(FieldNameSplit[1]);
                        var TheVariantID   = Localization.ParseUSInt(FieldNameSplit[2]);
                        var inputVal       = AppLogic.FormLocaleXml("SETitle", CommonLogic.FormCanBeDangerousContent(FieldName), SelectedLocale.Name, "Product", TheProductID);
                        if (inputVal.Length == 0)
                        {
                            DB.ExecuteSQL("update Product set SETitle=NULL where ProductID=" + TheProductID.ToString());
                        }
                        else
                        {
                            DB.ExecuteSQL("update Product set SETitle=" + DB.SQuote(inputVal) + " where ProductID=" + TheProductID.ToString());
                        }
                    }

                    if (FieldName.StartsWith("sekeywords", StringComparison.InvariantCultureIgnoreCase))
                    {
                        var FieldNameSplit = FieldName.Split('_');
                        var TheProductID   = Localization.ParseUSInt(FieldNameSplit[1]);
                        var TheVariantID   = Localization.ParseUSInt(FieldNameSplit[2]);
                        var inputVal       = AppLogic.FormLocaleXml("SEKeywords", CommonLogic.FormCanBeDangerousContent(FieldName), SelectedLocale.Name, "Product", TheProductID);
                        if (inputVal.Length == 0)
                        {
                            DB.ExecuteSQL("update Product set SEKeywords=NULL where ProductID=" + TheProductID.ToString());
                        }
                        else
                        {
                            DB.ExecuteSQL("update Product set SEKeywords=" + DB.SQuote(inputVal) + " where ProductID=" + TheProductID.ToString());
                        }
                    }

                    if (FieldName.StartsWith("sedescription", StringComparison.InvariantCultureIgnoreCase))
                    {
                        var FieldNameSplit = FieldName.Split('_');
                        var TheProductID   = Localization.ParseUSInt(FieldNameSplit[1]);
                        var TheVariantID   = Localization.ParseUSInt(FieldNameSplit[2]);
                        var inputVal       = AppLogic.FormLocaleXml("SEDescription", CommonLogic.FormCanBeDangerousContent(FieldName), SelectedLocale.Name, "Product", TheProductID);
                        if (inputVal.Length == 0)
                        {
                            DB.ExecuteSQL("update Product set SEDescription=NULL where ProductID=" + TheProductID.ToString());
                        }
                        else
                        {
                            DB.ExecuteSQL("update Product set SEDescription=" + DB.SQuote(inputVal) + " where ProductID=" + TheProductID.ToString());
                        }
                    }
                }

                AlertMessageDisplay.PushAlertMessage("The search engine fields have been saved.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
            }

            LoadBody(SelectedLocale.Name);
        }
예제 #5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            EntityID      = CommonLogic.QueryStringUSInt("EntityID");;
            EntityName    = CommonLogic.QueryStringCanBeDangerousContent("EntityName");
            m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName);
            Helper        = new EntityHelper(m_EntitySpecs, 0);

            if (EntityID == 0 || EntityName.Length == 0)
            {
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                return;
            }

            if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase))
            {
                var products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID);
                products.PageSize          = 0;
                products.PageNum           = 1;
                products.PublishedOnly     = false;
                products.ReturnAllVariants = true;

                var dsProducts  = products.LoadFromDB();
                var NumProducts = products.NumProducts;
                foreach (DataRow row in dsProducts.Tables[0].Rows)
                {
                    var ThisProductID = DB.RowFieldInt(row, "ProductID");
                    var ThisVariantID = DB.RowFieldInt(row, "VariantID");
                    var Price         = System.Decimal.Zero;
                    var SalePrice     = System.Decimal.Zero;
                    var MSRP          = System.Decimal.Zero;
                    var Cost          = System.Decimal.Zero;

                    if (CommonLogic.FormCanBeDangerousContent("Price_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()).Length != 0)
                    {
                        Price = CommonLogic.FormUSDecimal("Price_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString());
                    }

                    if (CommonLogic.FormCanBeDangerousContent("SalePrice_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()).Length != 0)
                    {
                        SalePrice = CommonLogic.FormUSDecimal("SalePrice_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString());
                    }

                    if (CommonLogic.FormCanBeDangerousContent("MSRP_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()).Length != 0)
                    {
                        MSRP = CommonLogic.FormUSDecimal("MSRP_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString());
                    }

                    if (CommonLogic.FormCanBeDangerousContent("Cost_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()).Length != 0)
                    {
                        Cost = CommonLogic.FormUSDecimal("Cost_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString());
                    }

                    var sql = new StringBuilder(1024);
                    sql.Append("update productvariant set ");
                    sql.Append("Price=" + Localization.DecimalStringForDB(Price) + ",");
                    sql.Append("SalePrice=" + CommonLogic.IIF(SalePrice != System.Decimal.Zero, Localization.DecimalStringForDB(SalePrice), "NULL") + ",");
                    sql.Append("MSRP=" + CommonLogic.IIF(MSRP != System.Decimal.Zero, Localization.DecimalStringForDB(MSRP), "NULL") + ",");
                    sql.Append("Cost=" + CommonLogic.IIF(Cost != System.Decimal.Zero, Localization.DecimalStringForDB(Cost), "NULL"));
                    sql.Append(" where VariantID=" + ThisVariantID.ToString());

                    DB.ExecuteSQL(sql.ToString());
                }
                dsProducts.Dispose();

                AlertMessageDisplay.PushAlertMessage("The prices have been updated.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
            }

            SelectedLocale = LocaleSource.GetDefaultLocale();
            LoadBody(SelectedLocale.Name);
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            EntityID = CommonLogic.QueryStringUSInt("EntityID");
            if (EntityID < 1)
            {
                EntityID = CommonLogic.FormNativeInt("EntityID");
            }

            EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName");
            if (String.IsNullOrEmpty(EntityName))
            {
                EntityName = CommonLogic.FormCanBeDangerousContent("EntityName");
            }

            m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName);
            Helper        = new EntityHelper(m_EntitySpecs, 0);

            if (EntityID == 0 || EntityName.Length == 0)
            {
                ltBody.Text = AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting);
                return;
            }

            if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase))
            {
                var products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID);
                products.PageSize          = 0;
                products.PageNum           = 1;
                products.PublishedOnly     = false;
                products.ReturnAllVariants = true;

                using (var dsProducts = products.LoadFromDB())
                {
                    var NumProducts = products.NumProducts;
                    foreach (DataRow row in dsProducts.Tables[0].Rows)
                    {
                        if (DB.RowFieldBool(row, "IsDownload"))
                        {
                            var ThisProductID = DB.RowFieldInt(row, "ProductID");
                            var ThisVariantID = DB.RowFieldInt(row, "VariantID");
                            var sql           = new StringBuilder(1024);
                            sql.Append("update productvariant set ");

                            var DLoc = CommonLogic.FormCanBeDangerousContent("DownloadLocation_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString());
                            if (DLoc.StartsWith("/"))
                            {
                                DLoc = DLoc.Substring(1, DLoc.Length - 1);                                 // remove leading / char!
                            }
                            sql.Append("DownloadLocation=" + DB.SQuote(DLoc));
                            sql.Append(" where VariantID=" + ThisVariantID.ToString());
                            DB.ExecuteSQL(sql.ToString());
                        }
                    }
                }
                AlertMessage.PushAlertMessage("Download Files Saved", AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
            }

            SelectedLocale = LocaleSource.GetDefaultLocale();

            LoadBody(SelectedLocale.Name);
        }