コード例 #1
0
    /// <summary>
    /// Actions handler - saves the changes.
    /// </summary>
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        // Update the class object
        if ((ClassInfo != null) && (mapControl != null))
        {
            ClassInfo.ClassContactOverwriteEnabled = ValidationHelper.GetBoolean(mapControl.GetValue("allowoverwrite"), false);
            ClassInfo.ClassContactMapping          = ValidationHelper.GetString(mapControl.GetValue("mappingdefinition"), string.Empty);
            DataClassInfoProvider.SetDataClassInfo(ClassInfo);

            // Show save information
            ShowChangesSaved();
        }
    }
コード例 #2
0
    /// <summary>
    /// Actions handler - saves the changes.
    /// </summary>
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        // Update the class object
        DataClassInfo classInfo = (DataClassInfo)EditedObject;

        if ((classInfo != null) && (mapControl != null))
        {
            classInfo.ClassContactOverwriteEnabled = ValidationHelper.GetBoolean(mapControl.GetValue("allowoverwrite"), false);
            classInfo.ClassContactMapping          = ValidationHelper.GetString(mapControl.GetValue("mappingdefinition"), string.Empty);
            DataClassInfoProvider.SetDataClass(classInfo);

            // Show save information
            ShowInformation(GetString("general.changessaved"));
        }
    }
コード例 #3
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;
        forumGroupSelector.UniSelector.ReturnColumnName      = "GroupID";
        forumGroupSelector.UniSelector.OnSelectionChanged   += new EventHandler(UniSelector_OnSelectionChanged);
        forumGroupSelector.DropDownSingleSelect.AutoPostBack = true;

        // Set group selector dropdow to show only forumgroups of the site
        int siteId = ValidationHelper.GetInteger(filteredControl.GetValue("SiteID"), 0);

        forumGroupSelector.SiteId = siteId;

        // Get first forum group to be able to filter uni selector
        if (!RequestHelper.IsPostBack())
        {
            if (siteId > 0)
            {
                DataSet defaultGroup = ForumGroupInfoProvider.GetGroups("GroupGroupID IS NULL AND GroupName NOT LIKE 'AdHoc%' AND  GroupSiteID=" + siteId, "GroupDisplayName", 1, "GroupID");
                if (!DataHelper.DataSourceIsEmpty(defaultGroup))
                {
                    int defaultGroupId = ValidationHelper.GetInteger(defaultGroup.Tables[0].Rows[0]["GroupID"], 0);
                    if (defaultGroupId > 0)
                    {
                        forumGroupSelector.UniSelector.Value = defaultGroupId;
                        WhereCondition = GenerateWhereCondition(defaultGroupId);
                    }
                }
                ;
            }
        }
    }
コード例 #4
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;
        forumGroupSelector.UniSelector.ReturnColumnName = "GroupID";
        forumGroupSelector.UniSelector.OnSelectionChanged += new EventHandler(UniSelector_OnSelectionChanged);
        forumGroupSelector.DropDownSingleSelect.AutoPostBack = true;

        // Set group selector dropdow to show only forumgroups of the site
        int siteId = ValidationHelper.GetInteger(filteredControl.GetValue("SiteID"), 0);
        forumGroupSelector.SiteId = siteId;

        // Get first forum group to be able to filter uni selector
        if (!RequestHelper.IsPostBack())
        {
            if (siteId > 0)
            {
                DataSet defaultGroup = ForumGroupInfoProvider.GetGroups("GroupGroupID IS NULL AND GroupName NOT LIKE 'AdHoc%' AND  GroupSiteID=" + siteId, "GroupDisplayName", 1, "GroupID");
                if (!DataHelper.DataSourceIsEmpty(defaultGroup))
                {
                    int defaultGroupId = ValidationHelper.GetInteger(defaultGroup.Tables[0].Rows[0]["GroupID"], 0);
                    if (defaultGroupId > 0)
                    {
                        forumGroupSelector.UniSelector.Value = defaultGroupId;
                        WhereCondition = GenerateWhereCondition(defaultGroupId);
                    }
                }
                ;
            }
        }
    }
コード例 #5
0
 /// <summary>
 /// Resets filter to default state.
 /// </summary>
 public override void ResetFilter()
 {
     if (filteredControl != null)
     {
         int defaultValue = ValidationHelper.GetInteger(filteredControl.GetValue("DefaultFilterValue"), 0);
         siteSelector.SiteID = defaultValue;
         siteSelector.Reload(true);
         WhereCondition = GenerateWhereCondition(defaultValue);
     }
 }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;
        forumGroupSelector.UniSelector.ReturnColumnName      = "GroupID";
        forumGroupSelector.UniSelector.OnSelectionChanged   += new EventHandler(UniSelector_OnSelectionChanged);
        forumGroupSelector.DropDownSingleSelect.AutoPostBack = true;

        // Set group selector dropdow to show only forumgroups of the site
        int siteId = ValidationHelper.GetInteger(filteredControl.GetValue("SiteID"), 0);

        forumGroupSelector.SiteId = siteId;

        // Get first forum group to be able to filter uni selector
        if (!RequestHelper.IsPostBack())
        {
            if (siteId > 0)
            {
                var groupIds = ForumGroupInfoProvider.GetForumGroups()
                               .WhereNull("GroupGroupID")
                               .WhereNotStartsWith("GroupName", "AdHoc")
                               .WhereEquals("GroupSiteID", siteId)
                               .OrderBy("GroupDisplayName")
                               .TopN(1)
                               .Column("GroupID")
                               .GetListResult <int>();

                if (groupIds.Any())
                {
                    int defaultGroupId = ValidationHelper.GetInteger(groupIds.First(), 0);
                    if (defaultGroupId > 0)
                    {
                        forumGroupSelector.UniSelector.Value = defaultGroupId;
                        WhereCondition = GenerateWhereCondition(defaultGroupId);
                    }
                }
            }
        }
    }
コード例 #7
0
    /// <summary>
    /// Generates where condition.
    /// </summary>
    private string GenerateWhereCondition()
    {
        if (!uniSelector.HasData)
        {
            return(SqlHelper.NO_DATA_WHERE);
        }

        var classId = ValidationHelper.GetInteger(uniSelector.Value, 0);

        if (classId <= 0)
        {
            return(SqlHelper.NO_DATA_WHERE);
        }

        // Only results for specific class
        var mode = string.Empty;

        if (mFilteredUserControl != null)
        {
            mode = ValidationHelper.GetString(mFilteredUserControl.GetValue("FilterMode"), "");
            // Set the prefix for the item
            var className = DataClassInfoProvider.GetClassName(classId);
            mFilteredUserControl.SetValue("ItemPrefix", className + ".");
        }

        var id = ValidationHelper.GetInteger(uniSelector.Value, 0);

        switch (mode.ToLowerInvariant())
        {
        case TransformationInfo.OBJECT_TYPE:
            return($"(TransformationClassID = {id})");

        default:
            return($"(ClassID = {id})");
        }
    }
コード例 #8
0
    /// <summary>
    /// Generates where condition.
    /// </summary>
    private string GenerateWhereCondition()
    {
        if (!uniSelector.HasData)
        {
            return("0=1");
        }

        // Get the class ID
        int classId = ValidationHelper.GetInteger(uniSelector.Value, 0);

        if (classId <= 0)
        {
            // No results
            return("0=1");
        }

        // Only results for specific class
        string mode = string.Empty;

        if (filteredControl != null)
        {
            mode = ValidationHelper.GetString(filteredControl.GetValue("FilterMode"), "");
            // Set the prefix for the item
            var className = DataClassInfoProvider.GetClassName(classId);
            filteredControl.SetValue("ItemPrefix", className + ".");
        }

        switch (mode.ToLowerCSafe())
        {
        case TransformationInfo.OBJECT_TYPE:
            return(string.Concat("(TransformationClassID = ", ValidationHelper.GetInteger(uniSelector.Value, 0), ")"));

        default:
            return(string.Concat("(ClassID = ", ValidationHelper.GetInteger(uniSelector.Value, 0), ")"));
        }
    }
コード例 #9
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;

        siteSelector.DropDownSingleSelect.AutoPostBack = true;
        siteSelector.UniSelector.OnSelectionChanged   += Site_Changed;
        siteSelector.UniSelector.DialogWindowName      = "SiteSelectionDialog";

        // All cultures field in cultures mode
        switch (FilterMode)
        {
        case "cultures":
        {
            siteSelector.AllowEmpty = false;
            siteSelector.AllowAll   = false;
            siteSelector.UniSelector.SpecialFields.Add(new SpecialField {
                    Text = GetString("general.allcultures"), Value = String.Empty
                });
        }
        break;

        case "role":
        {
            siteSelector.AllowEmpty  = false;
            siteSelector.AllowAll    = false;
            siteSelector.AllowGlobal = true;
        }
        break;

        case "user":
        {
            siteSelector.AllowAll   = true;
            siteSelector.AllowEmpty = false;
        }
        break;

        case "notificationtemplate":
        {
            siteSelector.AllowEmpty = false;
            siteSelector.AllowAll   = false;
        }
        break;

        case "notificationtemplateglobal":
        {
            siteSelector.AllowEmpty = false;
            siteSelector.AllowAll   = false;
            siteSelector.UniSelector.SpecialFields.Add(new SpecialField {
                    Text = GetString("general.global"), Value = String.Empty
                });
        }
        break;

        case "department":
        {
            siteSelector.AllowEmpty  = false;
            siteSelector.AllowAll    = false;
            siteSelector.AllowGlobal = true;
        }
        break;

        default:
        {
            if ((Parameters != null) && (Parameters["ObjectType"] != null))
            {
                // Get object type
                GeneralizedInfo currentObject = ModuleManager.GetObject(ValidationHelper.GetString(Parameters["ObjectType"], String.Empty));
                if (currentObject != null)
                {
                    // Show global value if supports global objects
                    if (currentObject.TypeInfo.SupportsGlobalObjects)
                    {
                        siteSelector.AllowGlobal = true;
                    }
                    siteSelector.AllowAll   = false;
                    siteSelector.AllowEmpty = false;
                    siteSelector.Value      = SiteContext.CurrentSiteID;
                }
            }
            else
            {
                // Use default settings
                siteSelector.AllowAll   = true;
                siteSelector.AllowEmpty = false;
                plcLabel.Visible        = false;
                RemoveFormFilterStyles();
            }
        }
        break;
        }

        // Set initial filter value
        if (!RequestHelper.IsPostBack())
        {
            if (filteredControl != null)
            {
                int defaultValue = ValidationHelper.GetInteger(filteredControl.GetValue("DefaultFilterValue"), 0);

                if (defaultValue > 0)
                {
                    siteSelector.Value = defaultValue;
                }
            }
        }
    }
コード例 #10
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;

        siteSelector.DropDownSingleSelect.AutoPostBack = true;
        siteSelector.UniSelector.OnSelectionChanged += Site_Changed;
        siteSelector.UniSelector.DialogWindowName = "SiteSelectionDialog";
        siteSelector.IsLiveSite = this.IsLiveSite;

        // All cultures field in cultures mode
        switch (this.FilterMode)
        {
            case "cultures":
                siteSelector.AllowEmpty = false;
                siteSelector.AllowAll = false;
                siteSelector.UniSelector.SpecialFields = new string[1, 2] { { ResHelper.GetString("general.allcultures"), "" } };
                break;

            case "role":
                siteSelector.AllowEmpty = false;
                siteSelector.AllowAll = false;
                siteSelector.AllowGlobal = true;
                break;

            case "user":
                siteSelector.AllowAll = true;
                siteSelector.AllowEmpty = false;
                break;

            case "notificationtemplate":
                siteSelector.AllowEmpty = false;
                siteSelector.AllowAll = false;
                break;

            case "notificationtemplateglobal":
                siteSelector.AllowEmpty = false;
                siteSelector.AllowAll = false;
                siteSelector.UniSelector.SpecialFields = new string[1, 2] { { ResHelper.GetString("general.global"), "" } };
                break;

            case "department":
                siteSelector.AllowEmpty = false;
                siteSelector.AllowAll = false;
                siteSelector.AllowGlobal = true;
                break;
        }

        // Set initial filter value
        if (!RequestHelper.IsPostBack())
        {
            if (filteredControl != null)
            {
                int defaultValue = ValidationHelper.GetInteger(filteredControl.GetValue("DefaultFilterValue"), 0);

                if (defaultValue > 0)
                {
                    siteSelector.UniSelector.Value = defaultValue;
                    WhereCondition = GenerateWhereCondition(defaultValue);
                }
            }
        }
    }
コード例 #11
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;

        siteSelector.DropDownSingleSelect.AutoPostBack = true;
        siteSelector.UniSelector.OnSelectionChanged += Site_Changed;
        siteSelector.UniSelector.DialogWindowName = "SiteSelectionDialog";

        // All cultures field in cultures mode
        switch (FilterMode)
        {
            case "cultures":
                {
                    siteSelector.AllowEmpty = false;
                    siteSelector.AllowAll = false;
                    siteSelector.UniSelector.SpecialFields.Add(new SpecialField { Text = GetString("general.allcultures"), Value = String.Empty });
                }
                break;

            case "role":
                {
                    siteSelector.AllowEmpty = false;
                    siteSelector.AllowAll = false;
                    siteSelector.AllowGlobal = true;
                }
                break;

            case "user":
                {
                    siteSelector.AllowAll = true;
                    siteSelector.AllowEmpty = false;
                }
                break;

            case "notificationtemplate":
                {
                    siteSelector.AllowEmpty = false;
                    siteSelector.AllowAll = false;
                }
                break;

            case "notificationtemplateglobal":
                {
                    siteSelector.AllowEmpty = false;
                    siteSelector.AllowAll = false;
                    siteSelector.UniSelector.SpecialFields.Add(new SpecialField { Text = GetString("general.global"), Value = String.Empty });
                }
                break;

            case "department":
                {
                    siteSelector.AllowEmpty = false;
                    siteSelector.AllowAll = false;
                    siteSelector.AllowGlobal = true;
                }
                break;

            default:
                {
                    if ((Parameters != null) && (Parameters["ObjectType"] != null))
                    {
                        // Get object type
                        GeneralizedInfo currentObject = ModuleManager.GetObject(ValidationHelper.GetString(Parameters["ObjectType"], String.Empty));
                        if (currentObject != null)
                        {
                            // Show global value if supports global objects
                            if (currentObject.TypeInfo.SupportsGlobalObjects)
                            {
                                siteSelector.AllowGlobal = true;
                            }
                            siteSelector.AllowAll = false;
                            siteSelector.AllowEmpty = false;
                            siteSelector.Value = SiteContext.CurrentSiteID;
                        }
                    }
                    else
                    {
                        // Use default settings
                        siteSelector.AllowAll = true;
                        siteSelector.AllowEmpty = false;
                        plcLabel.Visible = false;
                        RemoveFormFilterStyles();
                    }
                }
                break;
        }

        // Set initial filter value
        if (!RequestHelper.IsPostBack())
        {
            if (filteredControl != null)
            {
                int defaultValue = ValidationHelper.GetInteger(filteredControl.GetValue("DefaultFilterValue"), 0);

                if (defaultValue > 0)
                {
                    siteSelector.UniSelector.Value = defaultValue;
                    WhereCondition = GenerateWhereCondition(defaultValue);
                }
            }
        }
    }
コード例 #12
0
    /// <summary>
    /// Actions handler - saves the changes.
    /// </summary>
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        // Update the form object and its class
        BizFormInfo form = EditedObject as BizFormInfo;

        if ((form != null) && (mapControl != null))
        {
            if (plcMapping.Visible)
            {
                // Update mapping of the form class only if mapping dialog is visible
                DataClassInfo classInfo = DataClassInfoProvider.GetDataClassInfo(form.FormClassID);
                if (classInfo != null)
                {
                    classInfo.ClassContactOverwriteEnabled = ValidationHelper.GetBoolean(mapControl.GetValue("allowoverwrite"), false);
                    classInfo.ClassContactMapping          = ValidationHelper.GetString(mapControl.GetValue("mappingdefinition"), string.Empty);
                    DataClassInfoProvider.SetDataClassInfo(classInfo);
                }
            }

            // Update the form
            form.FormLogActivity = chkLogActivity.Checked;
            BizFormInfoProvider.SetBizFormInfo(form);

            // Show save information
            ShowChangesSaved();
        }
    }
コード例 #13
0
ファイル: SiteFilter.ascx.cs プロジェクト: kudutest2/Kentico
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;

        siteSelector.DropDownSingleSelect.AutoPostBack = true;
        siteSelector.UniSelector.OnSelectionChanged   += Site_Changed;
        siteSelector.UniSelector.DialogWindowName      = "SiteSelectionDialog";
        siteSelector.IsLiveSite = this.IsLiveSite;

        // All cultures field in cultures mode
        switch (this.FilterMode)
        {
        case "cultures":
            siteSelector.AllowEmpty = false;
            siteSelector.AllowAll   = false;
            siteSelector.UniSelector.SpecialFields = new string[1, 2] {
                { ResHelper.GetString("general.allcultures"), "" }
            };
            break;

        case "role":
            siteSelector.AllowEmpty  = false;
            siteSelector.AllowAll    = false;
            siteSelector.AllowGlobal = true;
            break;

        case "user":
            siteSelector.AllowAll   = true;
            siteSelector.AllowEmpty = false;
            break;

        case "notificationtemplate":
            siteSelector.AllowEmpty = false;
            siteSelector.AllowAll   = false;
            break;

        case "notificationtemplateglobal":
            siteSelector.AllowEmpty = false;
            siteSelector.AllowAll   = false;
            siteSelector.UniSelector.SpecialFields = new string[1, 2] {
                { ResHelper.GetString("general.global"), "" }
            };
            break;

        case "department":
            siteSelector.AllowEmpty  = false;
            siteSelector.AllowAll    = false;
            siteSelector.AllowGlobal = true;
            break;
        }

        // Set initial filter value
        if (!RequestHelper.IsPostBack())
        {
            if (filteredControl != null)
            {
                int defaultValue = ValidationHelper.GetInteger(filteredControl.GetValue("DefaultFilterValue"), 0);

                if (defaultValue > 0)
                {
                    siteSelector.UniSelector.Value = defaultValue;
                    WhereCondition = GenerateWhereCondition(defaultValue);
                }
            }
        }
    }