コード例 #1
0
        /// <summary>
        /// Handles the Click event of the SaveCustomizeSettings control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void SaveCustomSettings_Click(object sender, EventArgs e)
        {
            WebProfile.Current.IssuesPageSize            = Convert.ToInt32(IssueListItems.SelectedValue);
            WebProfile.Current.PreferredLocale           = ddlPreferredLocale.SelectedValue;
            WebProfile.Current.ReceiveEmailNotifications = AllowNotifications.Checked;

            try
            {
                WebProfile.Current.Save();
                Message3.ShowSuccessMessage(GetLocalResourceObject("CustomSettingsSaved").ToString());

                if (Log.IsInfoEnabled)
                {
                    if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)
                    {
                        MDC.Set("user", HttpContext.Current.User.Identity.Name);
                    }
                    Log.Info("Profile updated");
                }
            }
            catch (Exception ex)
            {
                if (Log.IsErrorEnabled)
                {
                    if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)
                    {
                        MDC.Set("user", HttpContext.Current.User.Identity.Name);
                    }
                    Log.Error("Profile update error", ex);
                }
                Message3.ShowErrorMessage(GetLocalResourceObject("CustomSettingsUpdateError").ToString());
            }
        }