Ejemplo n.º 1
0
    /// <summary>
    /// Gets and bulk updates layouts. Called when the "Get and bulk update layouts" button is pressed.
    /// Expects the CreateLayout method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateLayouts()
    {
        // Prepare the parameters
        string where = "LayoutCodeName LIKE N'MyNewLayout%'";

        // Get the data
        DataSet layouts = LayoutInfoProvider.GetLayouts(where, null);

        if (!DataHelper.DataSourceIsEmpty(layouts))
        {
            // Loop through the individual items
            foreach (DataRow layoutDr in layouts.Tables[0].Rows)
            {
                // Create object from DataRow
                LayoutInfo modifyLayout = new LayoutInfo(layoutDr);

                // Update the properties
                modifyLayout.LayoutDisplayName = modifyLayout.LayoutDisplayName.ToUpper();

                // Save the changes
                LayoutInfoProvider.SetLayoutInfo(modifyLayout);
            }

            return(true);
        }

        return(false);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Generates HTML text to be used in description area.
    /// </summary>
    ///<param name="selectedValue">Selected item for which generate description</param>
    private string ShowInDescriptionArea(string selectedValue)
    {
        string name        = String.Empty;
        string description = String.Empty;

        if (!String.IsNullOrEmpty(selectedValue))
        {
            int     layoutId = ValidationHelper.GetInteger(selectedValue, 0);
            DataSet ds       = LayoutInfoProvider.GetLayouts("LayoutID = " + layoutId, null, 0, "LayoutDisplayName, LayoutDescription");
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                name        = ValidationHelper.GetString(ds.Tables[0].Rows[0]["LayoutDisplayName"], "");
                description = ValidationHelper.GetString(ds.Tables[0].Rows[0]["LayoutDescription"], "");
            }
        }
        else
        {
            name = GetString("layouts.selectlayout");
        }

        string text = "<div class=\"ItemName\">" + HTMLHelper.HTMLEncode(name) + "</div>";

        if (description != null)
        {
            text += "<div class=\"Description\">" + HTMLHelper.HTMLEncode(description) + "</div>";
        }

        return(text);
    }
    /// <summary>
    /// Generates HTML text to be used in description area.
    /// </summary>
    ///<param name="selectedValue">Selected item for which generate description</param>
    private string ShowInDescriptionArea(string selectedValue)
    {
        string description = String.Empty;

        if (!String.IsNullOrEmpty(selectedValue))
        {
            int     layoutId = ValidationHelper.GetInteger(selectedValue, 0);
            DataSet ds       = LayoutInfoProvider.GetLayouts()
                               .WhereEquals("LayoutID", layoutId)
                               .Columns("LayoutDisplayName", "LayoutDescription");

            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                description = ResHelper.LocalizeString(ValidationHelper.GetString(ds.Tables[0].Rows[0]["LayoutDescription"], ""));
            }
        }

        if (!String.IsNullOrEmpty(description))
        {
            return("<div class=\"Description\">" + HTMLHelper.HTMLEncode(description) + "</div>");
        }

        return(String.Empty);
    }