private void cmdUpdate_Click(object sender, EventArgs e) { try { if (Page.IsValid) { if (cboSource.SelectedIndex != 0 || !String.IsNullOrEmpty(txtSource.Text)) { //check whether have a same control key in the module definition var controlKey = !String.IsNullOrEmpty(txtKey.Text) ? txtKey.Text : Null.NullString; var moduleControls = ModuleControlController.GetModuleControlsByModuleDefinitionID(ModuleDefId).Values; var keyExists = moduleControls.Any(c => c.ControlKey.Equals(controlKey, StringComparison.InvariantCultureIgnoreCase) && c.ModuleControlID != ModuleControlId); if (keyExists) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DuplicateKey.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } var moduleControl = new ModuleControlInfo { ModuleControlID = ModuleControlId, ModuleDefID = ModuleDefId, ControlKey = controlKey, ControlTitle = !String.IsNullOrEmpty(txtTitle.Text) ? txtTitle.Text : Null.NullString, ControlSrc = !String.IsNullOrEmpty(txtSource.Text) ? txtSource.Text : cboSource.SelectedItem.Text, ControlType = (SecurityAccessLevel)Enum.Parse(typeof(SecurityAccessLevel), cboType.SelectedItem.Value), ViewOrder = !String.IsNullOrEmpty(txtViewOrder.Text) ? int.Parse(txtViewOrder.Text) : Null.NullInteger, IconFile = cboIcon.SelectedIndex > 0 ? cboIcon.SelectedItem.Text : Null.NullString, HelpURL = !String.IsNullOrEmpty(txtHelpURL.Text) ? txtHelpURL.Text : Null.NullString, SupportsPartialRendering = chkSupportsPartialRendering.Checked, SupportsPopUps = supportsModalPopUpsCheckBox.Checked }; try { ModuleControlController.SaveModuleControl(moduleControl, true); } catch { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("AddControl.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } Response.Redirect(ReturnURL, true); } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("MissingSource.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
public void LoadControls() { if (ModuleDefID > Null.NullInteger) { _ModuleControls = ModuleControlController.GetModuleControlsByModuleDefinitionID(ModuleDefID); } else { _ModuleControls = new Dictionary <string, ModuleControlInfo>(); } }
private void BindData() { BindConfiguration(); BindHostDetails(); chkCopyright.Checked = Entities.Host.Host.DisplayCopyright; chkUseCustomErrorMessages.Checked = Entities.Host.Host.UseCustomErrorMessages; chkUseCustomModuleCssClass.Checked = Entities.Host.Host.EnableCustomModuleCssClass; BindSkins(); BindPaymentProcessor(); BindFriendlyUrlsRequestFilters(); BindProxyServer(); BindSmtpServer(); BindPerformance(); BindJQuery(); BindCdnSettings(); BindClientResourceManagement(); BindLogList(); ManageMinificationUi(); foreach (KeyValuePair <string, ModuleControlInfo> kvp in ModuleControlController.GetModuleControlsByModuleDefinitionID(Null.NullInteger)) { if (kvp.Value.ControlType == SecurityAccessLevel.ControlPanel) { cboControlPanel.AddItem(kvp.Value.ControlKey.Replace("CONTROLPANEL:", ""), kvp.Value.ControlSrc); } } if (string.IsNullOrEmpty(Entities.Host.Host.ControlPanel)) { if (cboControlPanel.FindItemByValue(Globals.glbDefaultControlPanel) != null) { cboControlPanel.FindItemByValue(Globals.glbDefaultControlPanel).Selected = true; } } else { if (cboControlPanel.FindItemByValue(Entities.Host.Host.ControlPanel) != null) { cboControlPanel.FindItemByValue(Entities.Host.Host.ControlPanel).Selected = true; } } if (String.IsNullOrEmpty(Entities.Host.Host.SiteLogStorage)) { optSiteLogStorage.Items.FindByValue("D").Selected = true; } else { optSiteLogStorage.Items.FindByValue(Entities.Host.Host.SiteLogStorage).Selected = true; } txtSiteLogBuffer.Text = Entities.Host.Host.SiteLogBuffer.ToString(); txtSiteLogHistory.Text = Entities.Host.Host.SiteLogHistory.ToString(); chkUsersOnline.Checked = Entities.Host.Host.EnableUsersOnline; txtUsersOnlineTime.Text = Entities.Host.Host.UsersOnlineTimeWindow.ToString(); txtAutoAccountUnlock.Text = Entities.Host.Host.AutoAccountUnlockDuration.ToString(); txtFileExtensions.Text = Entities.Host.Host.AllowedExtensionWhitelist.ToStorageString(); if (cboSchedulerMode.FindItemByValue(((int)Entities.Host.Host.SchedulerMode).ToString()) != null) { cboSchedulerMode.FindItemByValue(((int)Entities.Host.Host.SchedulerMode).ToString()).Selected = true; } else { cboSchedulerMode.FindItemByValue("1").Selected = true; } chkLogBuffer.Checked = Entities.Host.Host.EventLogBuffer; txtHelpURL.Text = Entities.Host.Host.HelpURL; chkEnableHelp.Checked = Entities.Host.Host.EnableModuleOnLineHelp; chkAutoSync.Checked = Entities.Host.Host.EnableFileAutoSync; chkEnableContentLocalization.Checked = Entities.Host.Host.EnableContentLocalization; txtBatch.Text = Entities.Host.Host.MessageSchedulerBatchSize.ToString(); txtAsyncTimeout.Text = Entities.Host.Host.AsyncTimeout.ToString(); ViewState["SelectedSchedulerMode"] = cboSchedulerMode.SelectedItem.Value; ViewState["SelectedLogBufferEnabled"] = chkLogBuffer.Checked; ViewState["SelectedUsersOnlineEnabled"] = chkUsersOnline.Checked; BindUpgradeLogs(); }
public void LoadControls() { this._ModuleControls = this.ModuleDefID > Null.NullInteger ? ModuleControlController.GetModuleControlsByModuleDefinitionID(this.ModuleDefID) : new Dictionary <string, ModuleControlInfo>(); }