/// <summary> /// Returns correct WHERE condition. /// </summary> private string GetWhere() { UniGrid parent = ControlsHelper.GetParentControl(this, typeof(UniGrid)) as UniGrid; if (parent != null) { string resourceName = ValidationHelper.GetString(parent.GetValue("ResourceName"), ""); if (resourceName == String.Empty) { // Check special parameter first resourceName = ValidationHelper.GetString(UIContext["MacroRuleResourceName"], String.Empty); if (resourceName == String.Empty) { // If not set, use element's resource name resourceName = ValidationHelper.GetString(UIContext["resourcename"], String.Empty); } } if (!string.IsNullOrEmpty(resourceName)) { string where = "MacroRuleResourceName = N'" + SqlHelper.GetSafeQueryString(resourceName, false) + "'"; // Show also global rules for global administrator if requested if (drpOptions.SelectedIndex == 1) { where = SqlHelper.AddWhereCondition(where, "MacroRuleResourceName = '' OR MacroRuleResourceName IS NULL", "OR"); } return(where); } } // Only global rules should be displayed return("MacroRuleResourceName = '' OR MacroRuleResourceName IS NULL"); }
public void Page_Init(object sender, EventArgs e) { // When user selects item in the first dropdown (hourly, daily, weekly), display correct second drop down ddlMainFrequency.SelectedIndexChanged += (s, ea) => DisplayCorrectExtendedDropDownList(); // Bind to the event when settings page is being saved and perform a Strands setup call after page is saved SettingsGroupViewerControl settingsGroupViewer = ControlsHelper.GetParentControl <SettingsGroupViewerControl>(this); // Do nothing if this form control is not placed under SettingsGroupViewerControl control (can happen in form control preview for example) if (settingsGroupViewer != null) { settingsGroupViewer.SettingsSave.After += (s, ea) => { if (StrandsSettings.IsStrandsEnabled(SiteContext.CurrentSiteName)) { try { var setupCall = new StrandsSetupCall(); setupCall.DoWithDefaults(); } catch (Exception ex) { EventLogProvider.LogException("Strands Recommender", "SETUPCALL", ex); } } }; } }
/// <summary> /// Page LoadComplete event handler. /// </summary> protected void Page_LoadComplete(object sender, EventArgs e) { if (Editor != null) { // Setup the editor syntax highlighting language Editor.Language = LanguageCode.GetLanguageEnumFromString("css"); } BaseEditMenu editMenu = ControlsHelper.GetParentControl(Control.ObjectManager.HeaderActions, typeof(BaseEditMenu)) as BaseEditMenu; if (editMenu != null) { editMenu.OnGetClientActionScript += editMenu_OnGetClientActionScript; } }