コード例 #1
0
ファイル: SystemOptionsDAL.cs プロジェクト: mparsin/Elements
 /// <summary>
 /// Populates the command parameters.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="cmd">The command.</param>
 private static void PopulateCommandParameters(SystemOptionsDTO options, SqlCommand cmd)
 {
     cmd.Parameters.Add(new SqlParameter("@lastModifiedOn", DateTime.Now));
     cmd.Parameters.Add(new SqlParameter("@loginHtml", options.LoginHtml.AsNullableObj()));
     cmd.Parameters.Add(new SqlParameter("@auditLogin", options.AuditLogin));
     cmd.Parameters.Add(new SqlParameter("@auditLogout", options.AuditLogout));
     cmd.Parameters.Add(new SqlParameter("@animateWindows", options.AnimateWindows));
     cmd.Parameters.AddWithValue("@tempDocumentUNC", options.TempDocumentUNC.AsNullableObj());
     cmd.Parameters.AddWithValue("@tempDocumentURI", options.TempDocumentURI.AsNullableObj());
     cmd.Parameters.AddWithValue("@paperclipUNC", options.PaperclipUNC.AsNullableObj());
     cmd.Parameters.AddWithValue("@paperclipURI", options.PaperclipURI.AsNullableObj());
     cmd.Parameters.AddWithValue("@fileUploadURI", options.FileUploadURI.AsNullableObj());
     cmd.Parameters.AddWithValue("@fileProcessorURI", options.FileProcessorURI.AsNullableObj());
     cmd.Parameters.Add(new SqlParameter("@inactivitySetting", options.InactivitySetting));
     cmd.Parameters.Add(new SqlParameter("@inactivityMinutes", options.InactivityMinutes));
     cmd.Parameters.Add(new SqlParameter("@daysBeforeAccountDisabled", options.DaysBeforeAccountDisabled));
     cmd.Parameters.Add(new SqlParameter("@delayAfterInvalidLogin", options.DelayAfterInvalidLogin));
     cmd.Parameters.Add(new SqlParameter("@DelayAfterInvalidLoginTimeout", options.DelayAfterInvalidLoginTimeout));
     cmd.Parameters.Add(new SqlParameter("@invalidLoginAttemptCount", options.InvalidLoginAttemptCount));
     cmd.Parameters.Add(new SqlParameter("@invalidLoginAttemptTime", options.InvalidLoginAttemptTime));
     cmd.Parameters.Add(new SqlParameter("@disableAccountSetting", options.DisableAccountSetting));
     cmd.Parameters.Add(new SqlParameter("@invalidLoginTimeout", options.InvalidLoginTimeout));
     cmd.Parameters.Add(new SqlParameter("@sessionInactivityTimeoutAction", options.SessionInactivityTimeoutAction));
     cmd.Parameters.Add(new SqlParameter("@isMandatoryPasswordChange", options.IsMandatoryPasswordChange));
     cmd.Parameters.Add(new SqlParameter("@passwordExpirationAction", options.PasswordExpirationAction));
     cmd.Parameters.Add(new SqlParameter("@passwordExpirationDays", options.PasswordExpirationDays));
     cmd.Parameters.Add(new SqlParameter("@passwordHistoryCount", options.PasswordHistoryCount));
     cmd.Parameters.Add(new SqlParameter("@minimumPasswordLength", options.MinimumPasswordLength));
     cmd.Parameters.AddWithValue("@enableSpecialChar", options.EnableSpecialChar);
     cmd.Parameters.AddWithValue("@enableUpperLowerCase", options.EnableUpperLowerCase);
     cmd.Parameters.AddWithValue("@passwordStrengthExpression", options.PasswordStrengthExpression.AsNullableObj());
     cmd.Parameters.Add(new SqlParameter("@notifyLastSucccessfulLogin", options.NotifyUserLastSucccessfulLogin));
     cmd.Parameters.Add(new SqlParameter("@notifyLastUnsucccessfulLogin", options.NotifyUserLastUnsucccessfulLogin));
     cmd.Parameters.Add(new SqlParameter("@notifyUserLastLoginAttempts", options.NotifyUserLastLoginAttempts));
     cmd.Parameters.Add(new SqlParameter("@notifyLastLoginAttemptsDays", options.NotifyUserLastLoginAttemptsDays));
     cmd.Parameters.Add(new SqlParameter("@notifyUserSecurityChanges", options.NotifyUserSecurityChanges));
     cmd.Parameters.AddWithValue("@SMTPServer", options.SMTPServer.AsNullableObj());
     cmd.Parameters.Add(new SqlParameter("@SMTPPort", options.SMTPPort));
     cmd.Parameters.Add(new SqlParameter("@SMTPUseSsl", options.SMTPUseSsl));
     cmd.Parameters.Add(new SqlParameter("@SMTPUseAuth", options.SMTPUseAuth));
     cmd.Parameters.AddWithValue("@SMTPAuthName", options.SMTPAuthName.AsNullableObj());
     cmd.Parameters.AddWithValue("@SMTPAuthPass", options.SMTPAuthPass.AsNullableObj());
     cmd.Parameters.AddWithValue("@emailFromAddress", options.EmailFromAddress.AsNullableObj());
     cmd.Parameters.AddWithValue("@EmailFromCurrentUser", options.EmailFromCurrentUser);
     cmd.Parameters.AddWithValue("@reportsPath", options.ReportsPath.AsNullableObj());
     cmd.Parameters.AddWithValue("@isUnderMaintenance", options.IsUnderMaintenance);
     cmd.Parameters.AddWithValue("@theme", options.Theme.AsNullableObj());
     cmd.Parameters.AddWithValue("@allowRememberMe", options.AllowRememberMe);
     cmd.Parameters.Add(new SqlParameter("MaxFileSize", (long)options.MaxFileSize));
     cmd.Parameters.Add(new SqlParameter("@showWarningMessage", options.ShowWarning));
     cmd.Parameters.Add(new SqlParameter("@warningMessage", options.WarningMessage.AsNullableObj()));
     cmd.Parameters.Add(new SqlParameter("@warningCaption", options.WarningCaption.AsNullableObj())); 
     cmd.Parameters.Add(new SqlParameter("@showInfoMessage", options.ShowInfo));
     cmd.Parameters.Add(new SqlParameter("@infoMessage", options.InfoMessage.AsNullableObj()));
     cmd.Parameters.Add(new SqlParameter("@infoCaption", options.InfoCaption.AsNullableObj()));
     cmd.Parameters.Add(new SqlParameter("@showSuccessMessage", options.ShowSuccess));
     cmd.Parameters.Add(new SqlParameter("@successMessage", options.SuccessMessage.AsNullableObj()));
     cmd.Parameters.Add(new SqlParameter("@successCaption", options.SuccessCaption.AsNullableObj()));
     cmd.Parameters.Add(new SqlParameter("RestrictExportTo", options.RestrictExportTo));
     cmd.Parameters.Add(new SqlParameter("DisableSearchGrouping", options.DisableSearchGrouping));
     cmd.Parameters.Add(new SqlParameter("DisableSearchAll", options.DisableSearchAll));
 }
コード例 #2
0
ファイル: SystemOptionsDAL.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Inserts the system options.
        /// </summary>
        /// <param name="dto">The dto.</param>
        private static void InsertSystemOptions(SystemOptionsDTO dto)
        {
            const string Sql = @"
INSERT  INTO dbo.SystemOptions
        ( LastModifiedOn ,
          LoginHTML ,
          AuditLogin ,
          AuditLogout ,
          AnimateWindows ,
          TempDocumentUNC ,
          TempDocumentURI ,
          PaperclipUNC ,
          PaperclipURI ,
          FileUploadURI ,
          FileProcessorURI ,
          InactivitySetting ,
          InactivityMinutes ,
          DaysBeforeAccountDisabled ,
          DelayAfterInvalidLogin ,
          DelayAfterInvalidLoginTimeout ,
          InvalidLoginAttemptCount ,
          InvalidLoginAttemptTime ,
          DisableAccountSetting ,
          InvalidLoginTimeout ,
          SessionInactivityTimeoutAction ,
          IsMandatoryPasswordChange ,
          PasswordExpirationAction ,
          PasswordExpirationDays ,
          PasswordHistoryCount ,
          MinimumPasswordLength ,
          EnableSpecialChar ,
          EnableUpperLowerCase ,
          PasswordStrengthExpression ,
          NotifyLastSucccessfulLogin ,
          NotifyLastUnsucccessfulLogin ,
          NotifyUserLastLoginAttempts ,
          NotifyLastLoginAttemptsDays ,
          NotifyUserSecurityChanges ,
          SMTPServer ,
          SMTPPort ,
          SMTPUseSsl ,
          SMTPUseAuth ,
          SMTPAuthName ,
          SMTPAuthPass ,
          EmailFromAddress ,
          ReportsPath ,
          IsUnderMaintenance ,
          Theme,
          AllowRememberMe,
          MaxFileSize,
          ShowWarningMessage,
          WarningMessage,
          WarningCaption,
          ShowInfoMessage,
          InfoMessage,
          InfoCaption,
          ShowSuccessMessage,
          SuccessMessage,
          SuccessCaption,
          RestrictExportTo,
          DisableSearchGrouping,
          DisableSearchAll
        )
VALUES  ( @lastModifiedOn , -- LastModifiedOn - datetime
          @loginHtml , -- LoginHTML - nvarchar(max)
          @auditLogin , -- AuditLogin - bit
          @auditLogout , -- AuditLogout - bit
          @animateWindows , -- AnimateWindows - bit
          @tempDocumentUNC , -- TempDocumentUNC - nvarchar(max)
          @tempDocumentURI , -- TempDocumentURI - nvarchar(max)
          @paperclipUNC , -- PaperclipUNC - nvarchar(max)
          @paperclipURI , -- PaperclipURI - nvarchar(max)
          @fileUploadURI , -- FileUploadURI - nvarchar(max)
          @fileProcessorURI , -- FileProcessorURI - nvarchar(max)
          @inactivitySetting , -- InactivitySetting - nvarchar(255)
          @inactivityMinutes , -- InactivityMinutes - int
          @daysBeforeAccountDisabled , -- DaysBeforeAccountDisabled - int
          @delayAfterInvalidLogin , -- DelayAfterInvalidLogin - bit
          @delayAfterInvalidLoginTimeout , -- DelayAfterInvalidLoginTimeout - int
          @invalidLoginAttemptCount , -- InvalidLoginAttemptCount - int
          @invalidLoginAttemptTime , -- InvalidLoginAttemptTime - int
          @disableAccountSetting , -- DisableAccountSetting - nvarchar(255)
          @invalidLoginTimeout , -- InvalidLoginTimeout - int
          @sessionInactivityTimeoutAction , -- SessionInactivityTimeoutAction - nvarchar(255)
          @isMandatoryPasswordChange , -- IsMandatoryPasswordChange - bit
          @passwordExpirationAction , -- PasswordExpirationAction - nvarchar(255)
          @passwordExpirationDays , -- PasswordExpirationDays - int
          @passwordHistoryCount , -- PasswordHistoryCount - int
          @minimumPasswordLength , -- MinimumPasswordLength - int
          @enableSpecialChar , -- EnableSpecialChar - bit
          @enableUpperLowerCase , -- EnableUpperLowerCase - bit
          @passwordStrengthExpression , -- PasswordStrengthExpression - nvarchar(255)
          @notifyLastSucccessfulLogin , -- NotifyLastSucccessfulLogin - bit
          @notifyLastUnsucccessfulLogin , -- NotifyLastUnsucccessfulLogin - bit
          @notifyUserLastLoginAttempts , -- NotifyUserLastLoginAttempts - bit
          @notifyLastLoginAttemptsDays , -- NotifyLastLoginAttemptsDays - int
          @notifyUserSecurityChanges , -- NotifyUserSecurityChanges - bit
          @SMTPServer , -- SMTPServer - nvarchar(50)
          @SMTPPort , -- SMTPPort - int
          @SMTPUseSsl , -- SMTPUseSsl - bit
          @SMTPUseAuth , -- SMTPUseAuth - bit
          @SMTPAuthName , -- SMTPAuthName - nvarchar(50)
          @SMTPAuthPass , -- SMTPAuthPass - nvarchar(50)
          @emailFromAddress , -- EmailFromAddress - nvarchar(50)
          @reportsPath , -- ReportsPath - nvarchar(max)
          @isUnderMaintenance ,  -- IsUnderMaintenance - bit
          @theme, -- Theme - navarchar(50),
          @allowRememberMe, -- AllowRememberMe - bit
          @MaxFileSize, -- MaxFileSize - bigint
          @ShowWarningMessage,
          @warningMessage,
          @warningCaption,
          @ShowInfoMessage,
          @InfoMessage,
          @InfoCaption,
          @ShowSuccessMessage,
          @SuccessMessage,
          @successCaption,
          @RestrictExportTo, -- RestrictExportTo - int
          @DisableSearchGrouping, -- DisableSearchGrouping - bit
          @DisableSearchAll -- DisableSearchAll - bit
        );
SELECT CAST(SCOPE_IDENTITY() AS int);";

            using (var cmd = new SqlCommand(Sql))
            {
                PopulateCommandParameters(dto, cmd);

                Database.GetDataReader(
                    cmd,
                    r =>
                    {
                        if (r == null || !r.Read()) throw new DataAccessException(Resources.FailedToInsertSystemOptions);

                        dto.SystemOptionsId = r.GetInt32(0);
                    });
            }
        }
コード例 #3
0
ファイル: SystemOptionsDAL.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Fetches the system options.
        /// </summary>
        /// <returns>SystemOptionsDTO.</returns>
        public SystemOptionsDTO FetchSystemOptions()
        {
            const string Sql = @"
SELECT TOP 1 [SystemOptionsID]
	  ,[LastModifiedOn]
	  ,[LoginHTML]
	  ,[AuditLogin]
	  ,[AuditLogout]
	  ,[AnimateWindows]
	  ,[TempDocumentUNC]
	  ,[TempDocumentURI]
	  ,[PaperclipUNC]
	  ,[PaperclipURI]
	  ,[FileUploadURI]
	  ,[FileProcessorURI]
	  ,[InactivitySetting]
	  ,[InactivityMinutes]
	  ,[DaysBeforeAccountDisabled]
	  ,[DelayAfterInvalidLogin]
	  ,[DelayAfterInvalidLoginTimeout]
	  ,[InvalidLoginAttemptCount]
	  ,[InvalidLoginAttemptTime]
	  ,[DisableAccountSetting]
	  ,[InvalidLoginTimeout]
	  ,[SessionInactivityTimeoutAction]
	  ,[IsMandatoryPasswordChange]
	  ,[PasswordExpirationAction]
	  ,[PasswordExpirationDays]
	  ,[MinimumPasswordLength]
      ,[EnableSpecialChar]
      ,[EnableUpperLowerCase]
	  ,[PasswordHistoryCount]
	  ,[PasswordStrengthExpression]
	  ,[NotifyLastSucccessfulLogin]
	  ,[NotifyLastUnsucccessfulLogin]
	  ,[NotifyUserLastLoginAttempts]
	  ,[NotifyLastLoginAttemptsDays]
	  ,[NotifyUserSecurityChanges]
	  ,[SMTPServer]
	  ,[SMTPPort]
      ,[SMTPUseSsl]
	  ,[SMTPUseAuth]
	  ,[SMTPAuthName]
	  ,[SMTPAuthPass]
	  ,[EmailFromAddress]
      ,[EmailFromCurrentUser]
      ,[ReportsPath]
      ,[IsUnderMaintenance]
      ,[Theme]
      ,[AllowRememberMe]
      ,[MaxFileSize]
      ,[ShowWarningMessage]
      ,[WarningMessage]
      ,[WarningCaption]
      ,[ShowInfoMessage]
      ,[InfoMessage]
      ,[InfoCaption]
      ,[ShowSuccessMessage]
      ,[SuccessMessage]
      ,[SuccessCaption]
      ,[RestrictExportTo]
      ,[DisableSearchGrouping]
      ,[DisableSearchAll]
  FROM [dbo].[SystemOptions]

SELECT TOP 1
	   sso.[IsEnabled] AS SSOEnabled
      ,sso.[AllowSSOApproval]
      ,sso.[SAMLVersion]
      ,sso.[Issuer] AS SSOIssuer
      ,sso.[IdPTargetUrl]
      ,sso.[IdPLogoutUrl]
      ,CASE LEN(sso.IDPCertificate) WHEN 0 THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT) END AS HasNoSSOCertificate
FROM  [dbo].[SSOOptions] sso

SELECT 
    ldap.[Id]
   ,ldap.[Name]
   ,ldap.[ServerType]
   ,ldap.[UseForLogin]
   ,ldap.[ServerPath]
   ,ldap.[Username]
   ,ldap.[Password]
   ,ldap.[RootPath]
   ,ldap.[SearchFilter]
   ,ldap.[UseSSL]
FROM [dbo].[LdapProfiles] ldap
";
/*
   SELECT  id ,
           Body ,
           Header ,
           Date
   FROM    dbo.news
   ORDER BY Date DESC
*/


            SystemOptionsDTO dto = null;

            Database.GetDataReader(
                Sql,
                reader =>
                    {
                        if (reader == null)
                        throw new DataAccessException(Resources.FailedToRetrieveSystemOptions);

                if (!reader.Read())
                {
                    dto = new SystemOptionsDTO { InactivityMinutes = 1, MinimumPasswordLength = 1};
                    InsertSystemOptions(dto);
                }
                else
                {
                    using (var sr = new SafeDataReader(reader))
                    {
                        dto = new SystemOptionsDTO
                            {
                                SystemOptionsId = sr.GetInt("SystemOptionsID"),
                                LoginHtml = sr.GetString("LoginHTML"),
                                AuditLogin = sr.GetBool("AuditLogin"),
                                AuditLogout = sr.GetBool("AuditLogout"),
                                AnimateWindows = sr.GetBool("AnimateWindows", true),
                                TempDocumentUNC = sr.GetString("TempDocumentUNC"),
                                TempDocumentURI = sr.GetString("TempDocumentURI"),
                                PaperclipUNC = sr.GetString("PaperclipUNC"),
                                PaperclipURI = sr.GetString("PaperclipURI"),
                                FileUploadURI = sr.GetString("FileUploadURI"),
                                FileProcessorURI = sr.GetString("FileProcessorURI"),                                
                                InactivitySetting = sr.GetEnum("InactivitySetting", InactivityTypesEnum.None),
                                InactivityMinutes = sr.GetInt("InactivityMinutes"),
                                DaysBeforeAccountDisabled = sr.GetInt("DaysBeforeAccountDisabled"),
                                DelayAfterInvalidLogin = sr.GetBool("DelayAfterInvalidLogin"),
                                DelayAfterInvalidLoginTimeout = sr.GetInt("DelayAfterInvalidLoginTimeout"),
                                InvalidLoginAttemptCount = sr.GetInt("InvalidLoginAttemptCount"),
                                InvalidLoginAttemptTime = sr.GetInt("InvalidLoginAttemptTime"),
                                DisableAccountSetting = sr.GetEnum("DisableAccountSetting", DisableAccountActionsType.DisableAdmin),
                                InvalidLoginTimeout = sr.GetInt("InvalidLoginTimeout"),
                                SessionInactivityTimeoutAction = sr.GetEnum("SessionInactivityTimeoutAction", InactivityTimoutActionEnum.None),
                                IsMandatoryPasswordChange = sr.GetBool("IsMandatoryPasswordChange"),
                                PasswordExpirationAction = sr.GetEnum("PasswordExpirationAction", PasswordExpirationActions.NoAction),
                                PasswordExpirationDays = sr.GetInt("PasswordExpirationDays"),
                                MinimumPasswordLength = sr.GetInt("MinimumPasswordLength"),
                                EnableSpecialChar = sr.GetBool("EnableSpecialChar"),
                                EnableUpperLowerCase = sr.GetBool("EnableUpperLowerCase"),
                                PasswordHistoryCount = sr.GetInt("PasswordHistoryCount"),
                                PasswordStrengthExpression = sr.GetString("PasswordStrengthExpression"),
                                NotifyUserLastSucccessfulLogin = sr.GetBool("NotifyLastSucccessfulLogin"),
                                NotifyUserLastUnsucccessfulLogin = sr.GetBool("NotifyLastUnsucccessfulLogin"),
                                NotifyUserLastLoginAttempts = sr.GetBool("NotifyUserLastLoginAttempts"),
                                NotifyUserLastLoginAttemptsDays = sr.GetInt("NotifyLastLoginAttemptsDays"),
                                NotifyUserSecurityChanges = sr.GetBool("NotifyUserSecurityChanges"),
                                SMTPServer = sr.GetString("SMTPServer"),
                                SMTPPort = sr.GetInt("SMTPPort", 25),
                                SMTPUseSsl = sr.GetBool("SMTPUseSsl"),
                                SMTPUseAuth = sr.GetBool("SMTPUseAuth"),
                                SMTPAuthName = sr.GetString("SMTPAuthName"),
                                SMTPAuthPass = sr.GetString("SMTPAuthPass"),
                                EmailFromAddress = sr.GetString("EmailFromAddress"),
                                EmailFromCurrentUser = sr.GetBoolean("EmailFromCurrentUser"),
                                ReportsPath = sr.GetString("ReportsPath"),
                                IsUnderMaintenance = sr.GetBool("IsUnderMaintenance"),
                                Theme = sr.GetString("Theme"),
                                AllowRememberMe = sr.GetBool("AllowRememberMe"),
                                MaxFileSize = (ulong)sr.GetInt64("MaxFileSize"),
                                LdapProfiles = new List<LdapProfileDTO>(),
                                SSOOptions = new SSOOptionsDTO(),
                                ShowWarning = sr.GetBool("ShowWarningMessage"),
                                WarningMessage = sr.GetString("WarningMessage"),
                                WarningCaption = sr.GetString("WarningCaption"),
                                ShowInfo = sr.GetBool("ShowInfoMessage"),
                                InfoMessage = sr.GetString("InfoMessage"),
                                InfoCaption = sr.GetString("InfoCaption"),
                                ShowSuccess = sr.GetBool("ShowSuccessMessage"),
                                SuccessMessage = sr.GetString("SuccessMessage"),
                                SuccessCaption = sr.GetString("SuccessCaption"),
                                RestrictExportTo = sr.GetInt("RestrictExportTo"),
                                DisableSearchGrouping = sr.GetBool("DisableSearchGrouping"),
                                DisableSearchAll = sr.GetBool("DisableSearchAll"),
                           };

                        sr.NextResult();
                        while (sr.Read())
                        {
                            dto.SSOOptions.IsEnabled = sr.GetBool("SSOEnabled");
                            dto.SSOOptions.AllowSSOApproval = sr.GetBool("AllowSSOApproval");
                            dto.SSOOptions.SAMLVersion = sr.GetString("SAMLVersion");
                            dto.SSOOptions.Issuer = sr.GetString("SSOIssuer");
                            dto.SSOOptions.IdPTargetUrl = sr.GetString("IdPTargetUrl");
                            dto.SSOOptions.IdPLogoutUrl = sr.GetString("IdPLogoutUrl");
                            dto.SSOOptions.HasNoCertificate = sr.GetBoolean("HasNoSSOCertificate");
                        }

                        sr.NextResult();
                        while (sr.Read())
                        {
                            dto.LdapProfiles.Add(
                                new LdapProfileDTO
                                {
                                    Id = sr.GetInt32("Id"),
                                    Name = sr.GetString("Name"),
                                    ServerType = (LdapServerTypes) sr.GetInt32("ServerType"),
                                    UseForLogin = sr.GetBool("UseForLogin"),
                                    ServerPath = sr.GetString("ServerPath"),
                                    Username = TryDecrypt(sr.GetString("Username")),
                                    Password = TryDecrypt(sr.GetString("Password")),
                                    RootPath = sr.GetString("RootPath"),
                                    SearchFilter = sr.GetString("SearchFilter"),
                                    UseSSL = sr.GetBoolean("UseSSL")
                                });
                        }
                    }
                }

                //reader.NextResult();

                //while (reader.Read())
                //{
                //    dto.NewsList.Add(new NewsDto
                //                         {
                //                             Id = reader.GetInt32(0),
                //                             Body = reader.GetString(1),
                //                             Header = reader.GetString(2),
                //                             Date = reader.GetDateTime(3)
                //                         });
                //}
            });

            return dto;
        }
コード例 #4
0
ファイル: SystemOptionsDAL.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Updates the system options.
        /// </summary>
        /// <param name="options">The options.</param>
        public void UpdateSystemOptions(SystemOptionsDTO options)
        {
            const string Sql = @"
UPDATE SystemOptions
SET
	LastModifiedOn = @LastModifiedOn,
	LoginHTML = @LoginHTML,
	AuditLogin = @AuditLogin,
	AuditLogout = @AuditLogout,
	AnimateWindows = @AnimateWindows,
	TempDocumentUNC = @TempDocumentUNC,
	TempDocumentURI = @TempDocumentURI,
	PaperclipUNC = @PaperclipUNC,
	PaperclipURI = @PaperclipURI,
	FileUploadURI = @FileUploadURI,
	FileProcessorURI = @FileProcessorURI,
	InactivitySetting = @InactivitySetting,
	InactivityMinutes = @InactivityMinutes,
	DaysBeforeAccountDisabled = @DaysBeforeAccountDisabled,
	DelayAfterInvalidLogin = @DelayAfterInvalidLogin,
	DelayAfterInvalidLoginTimeout = @DelayAfterInvalidLoginTimeout,
	InvalidLoginAttemptCount = @InvalidLoginAttemptCount,
	InvalidLoginAttemptTime = @InvalidLoginAttemptTime,
	DisableAccountSetting = @DisableAccountSetting,
	InvalidLoginTimeout = @InvalidLoginTimeout,
	SessionInactivityTimeoutAction = @SessionInactivityTimeoutAction,
	IsMandatoryPasswordChange = @IsMandatoryPasswordChange,
	PasswordExpirationAction = @PasswordExpirationAction,
	PasswordExpirationDays = @PasswordExpirationDays,
	PasswordHistoryCount = @PasswordHistoryCount,
	MinimumPasswordLength = @MinimumPasswordLength,
    EnableSpecialChar = @EnableSpecialChar,
    EnableUpperLowerCase = @EnableUpperLowerCase,
	PasswordStrengthExpression = @PasswordStrengthExpression,
	NotifyLastSucccessfulLogin = @NotifyLastSucccessfulLogin,
	NotifyLastUnsucccessfulLogin = @NotifyLastUnsucccessfulLogin,
	NotifyUserLastLoginAttempts = @NotifyUserLastLoginAttempts,
	NotifyLastLoginAttemptsDays = @NotifyLastLoginAttemptsDays,
	NotifyUserSecurityChanges = @NotifyUserSecurityChanges,
	SMTPServer = @SMTPServer,
	SMTPPort = @SMTPPort,
    SMTPUseSsl = @SMTPUseSsl,
	SMTPUseAuth = @SMTPUseAuth,
	SMTPAuthName = @SMTPAuthName,
	SMTPAuthPass = @SMTPAuthPass,
	EmailFromAddress = @EmailFromAddress,
    EmailFromCurrentUser = @EmailFromCurrentUser,
    ReportsPath = @ReportsPath,
    IsUnderMaintenance = @IsUnderMaintenance,
    Theme = @theme,
    MaxFileSize = @MaxFileSize,
    AllowRememberMe = @allowRememberMe,
    ShowWarningMessage = @showWarningMessage,
    WarningMessage = @warningMessage,
    WarningCaption = @warningCaption,
    ShowInfoMessage = @showInfoMessage,
    InfoMessage = @infoMessage,
    InfoCaption = @infoCaption,
    ShowSuccessMessage = @showSuccessMessage,
    SuccessMessage = @successMessage,
    SuccessCaption = @successCaption,
    RestrictExportTo = @restrictExportTo,
    DisableSearchGrouping = @disableSearchGrouping,
    DisableSearchAll = @disableSearchAll";

            using (var cmd = new SqlCommand(Sql))
            {
                //cmd.Parameters.Add(new SqlParameter("SystemOptionsID", options.SystemOptionsId));

                PopulateCommandParameters(options, cmd);

                Database.Execute(cmd);
            }
        }