/// <summary> /// Update Page Custom Settings /// </summary> /// <param name="pageId"> /// The page ID. /// </param> /// <param name="key"> /// The setting key. /// </param> /// <param name="value"> /// The value. /// </param> public static void UpdatePageSettings(int pageId, string key, string value) { // Create Instance of Connection and Command Object using (var connection = Config.SqlConnectionString) using (var command = new SqlCommand("rb_UpdateTabCustomSettings", connection)) { // Mark the Command as a SPROC command.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC var parameterPageId = new SqlParameter("@TabID", SqlDbType.Int, 4) { Value = pageId }; command.Parameters.Add(parameterPageId); var parameterKey = new SqlParameter("@SettingName", SqlDbType.NVarChar, 50) { Value = key }; command.Parameters.Add(parameterKey); if ((key == "CustomLayout" || key == "CustomTheme" || key == "CustomThemeAlt") && (value == General.GetString("PAGESETTINGS_SITEDEFAULT"))) { value = string.Empty; } var parameterValue = new SqlParameter("@SettingValue", SqlDbType.NVarChar, 1500) { Value = value }; command.Parameters.Add(parameterValue); connection.Open(); try { command.ExecuteNonQuery(); } finally { connection.Close(); } } // Invalidate cache if (CurrentCache.Exists(Key.TabSettings(pageId))) { CurrentCache.Remove(Key.TabSettings(pageId)); } // Clear URL builder elements HttpUrlBuilder.Clear(pageId); }
/// <summary> /// Update Page Custom Settings /// </summary> /// <param name="pageID">The page ID.</param> /// <param name="key">The key.</param> /// <param name="value">The value.</param> public static void UpdatePageSettings(int pageID, string key, string value) { // Create Instance of Connection and Command Object using (SqlConnection myConnection = Config.SqlConnectionString) { using (SqlCommand myCommand = new SqlCommand("rb_UpdateTabCustomSettings", myConnection)) { // Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterPageID = new SqlParameter("@TabID", SqlDbType.Int, 4); parameterPageID.Value = pageID; myCommand.Parameters.Add(parameterPageID); SqlParameter parameterKey = new SqlParameter("@SettingName", SqlDbType.NVarChar, 50); parameterKey.Value = key; myCommand.Parameters.Add(parameterKey); SqlParameter parameterValue = new SqlParameter("@SettingValue", SqlDbType.NVarChar, 1500); parameterValue.Value = value; myCommand.Parameters.Add(parameterValue); myConnection.Open(); try { myCommand.ExecuteNonQuery(); } finally { myConnection.Close(); } } } //Invalidate cache if (CurrentCache.Exists(Key.TabSettings(pageID))) { CurrentCache.Remove(Key.TabSettings(pageID)); } // Clear url builder elements HttpUrlBuilder.Clear(pageID); }