/// <summary> /// Saves the specified site settings. /// </summary> /// <param name="siteSettings">The site settings.</param> public void Save(SiteSettings siteSettings) { try { DatabaseConfigurationProvider databaseConfigurationProvider = new DatabaseConfigurationProvider(); int id = databaseConfigurationProvider.SaveConfiguration(SiteSettings.SECTION_NAME, siteSettings, WebUtility.GetUserName()); SiteSettingCache.RemoveSiteSettingsFromCache(); if (id > 0) { MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblSiteSettingsSaved")); } else { MasterPage.MessageCenter.DisplayFailureMessage(LocalizationUtility.GetText("lblSiteSettingsNotSaved")); } } catch (Exception ex) { Logger.Error("Save", ex); MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message); } }
/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected void btnSave_Click(object sender, EventArgs e) { try { PaymentServiceSettings paymentServiceSettings = new PaymentServiceSettings(); ProviderSettings settings = new ProviderSettings(); settings.Name = typeof(PayPalProPaymentProvider).Name; settings.Type = typeof(PayPalProPaymentProvider).AssemblyQualifiedName; settings.Parameters.Add("ApiUserName", "username"); settings.Parameters.Add("ApiPassword", "password"); settings.Parameters.Add("Signature", "signature"); settings.Parameters.Add("IsLive", "false"); paymentServiceSettings.ProviderSettingsCollection.Add(settings); DatabaseConfigurationProvider config = new DatabaseConfigurationProvider(); config.SaveConfiguration(PaymentServiceSettings.SECTION_NAME, paymentServiceSettings, WebUtility.GetUserName()); SiteSettingCache.RemoveSiteSettingsFromCache(); } catch (Exception ex) { Logger.Error(typeof(paymentserviceconfiguration).Name + ".Page_Load", ex); Master.MessageCenter.DisplayCriticalMessage(ex.Message); } }
/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected void btnSave_Click(object sender, EventArgs e) { try { mailSettings.Contact = txtEmail.Text.Trim(); DatabaseConfigurationProvider databaseConfigurationProvider = new DatabaseConfigurationProvider(); int id = databaseConfigurationProvider.SaveConfiguration(MailSettings.SECTION_NAME, mailSettings, WebUtility.GetUserName()); SiteSettingCache.RemoveSiteSettingsFromCache(); if (id > 0) { Master.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblMailSettingsSaved")); } else { Master.MessageCenter.DisplayFailureMessage(LocalizationUtility.GetText("lblMailSettingsNotSaved")); } } catch (Exception ex) { Logger.Error(typeof(mailconfiguration).Name + ".btnSave_Click", ex); Master.MessageCenter.DisplayCriticalMessage(ex.Message); } }