コード例 #1
0
ファイル: ProcessDAL.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Retrieves checklist step.
        /// </summary>
        /// <param name="processName">The process name.</param>
        /// <param name="fieldName">The field name.</param>
        /// <param name="isPublishedCopy">The is published copy.</param>
        /// <returns>The <see cref="ChecklistStepDto" />.</returns>
        public ChecklistStepDto FetchChecklistStep(string processName, string fieldName, bool isPublishedCopy = false)
        {
            const string CommandText = @"
DECLARE @fieldId AS INT

SELECT @fieldId = f.Id
FROM
    [dbo].[Processes] p
    INNER JOIN [dbo].[Sections] s ON s.ProcessId = p.Id
    INNER JOIN [dbo].[Fields] f ON f.SectionId = s.Id
WHERE p.[SystemName] = @processName AND p.IsRemoved = 0 AND p.IsPublishedCopy = @isPublishedCopy AND f.SystemName = @fieldName;

EXEC [dbo].[GetChecklistStep] @FieldId = @fieldId;";

            using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
            using (var cmd = new SqlCommand(CommandText, ctx.Connection))
            {
                cmd.Parameters.AddWithValue("@processName", processName);
                cmd.Parameters.AddWithValue("@fieldName", fieldName);
                cmd.Parameters.AddWithValue("@isPublishedCopy", isPublishedCopy);

                using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                {
                    if (reader.Read())
                    {
                        var dto = new ChecklistStepDto
                                      {
                                          QuestionProcessSystemName = reader.GetString(0),
                                          AnswerProcessSystemName = reader.GetString(1),
                                          AnswerProcessDefaultStateGuid = reader.GetGuid(2),
                                          CommentsFieldSystemName = reader.GetString(3),
                                          IsSingleQuestionView = reader.GetBool(4),
                                          ListDisplayFieldSystemName = reader.GetString(5),
                                          AllowAdhocQuestions = reader.GetBool(6),
                                          FilterDefinition = reader.GetString(7),
                                          FilterGuid = reader.IsDBNull(8) ? null : (Guid?)reader.GetGuid(8),
                                          CanChangeItemState = reader.GetBool(9),
                                          ShowLinkedItems = reader.GetBool(10),
                                          SortFieldSystemName = reader.GetString(11),
                                          SortDirection = reader.GetEnum(12, SortDirection.Ascending),
                                          HideValidationIcon = reader.GetBool(13)
                                      };

                        return dto;
                    }
                }
            }

            return null;
        }
コード例 #2
0
ファイル: ProcessDAL.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Fetches reverse cross ref list.
        /// </summary>
        /// <param name="processGuid">The process GUID.</param>
        /// <returns>The <see cref="IList" />.</returns>
        public IList<PublishedProcessInfoDTO> FetchReverseCrossRefList(Guid processGuid)
        {
            var result = new List<PublishedProcessInfoDTO>();
            const string CmdText =
                @"
-- Select processes with cross reference fields
DECLARE @pp_id INT
SELECT @pp_id = pp.[Id] FROM [dbo].[PublishedProcesses] pp WHERE pp.[ProcessGuid] = @processGuid

SELECT pp.[Id]
      ,p.[Name]
      ,p.[SystemName]
      ,p.[Id]
      ,p.[IsStateEnabled]
      ,p.[ProcessOption]
FROM [dbo].[PublishedProcesses] pp
INNER JOIN [dbo].[Processes] p ON p.[Id] = pp.[ProcessId]
INNER JOIN (SELECT DISTINCT s.[ProcessId] AS [Id]
FROM [dbo].[Sections] s
INNER JOIN [dbo].[Fields] f on f.[SectionId] = s.[Id]
INNER JOIN [dbo].[CrossRefRequredFieldStep] x on x.[FieldId] = f.[Id]
WHERE x.[CrossRefProcessId] = @pp_id) pu ON p.[Id] = pu.[Id]
WHERE pp.Id <> @pp_id

-- Select processes with checklist fields
DECLARE @pp_systemName AS NVARCHAR(200)
SELECT @pp_systemName = p.[SystemName] FROM [dbo].[Processes] p WHERE p.[Guid] = @processGuid AND p.[IsPublishedCopy] = 1 AND p.[IsRemoved] = 0

SELECT pp.[Id]
    ,p.[Name]
    ,p.[SystemName]
    ,p.[Id]
    ,p.[IsStateEnabled]
    ,p.[ProcessOption]
FROM [dbo].[PublishedProcesses] pp
INNER JOIN [dbo].[Processes] p ON p.[Id] = pp.[ProcessId]
INNER JOIN (SELECT DISTINCT s.[ProcessId] AS [Id]
FROM [dbo].[Sections] s
INNER JOIN [dbo].[Fields] f on f.[SectionId] = s.[Id]
INNER JOIN [dbo].[stepChecklist] x on x.[FieldId] = f.[Id]
WHERE x.[AnswerProcessSystemName] = @pp_systemName) pu ON p.[Id] = pu.[Id]
WHERE pp.Id <> @pp_id";

            using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
            {
                var cn = ctx.Connection;

                using (var cmd = new SqlCommand(CmdText, cn))
                {
                    cmd.Parameters.AddWithValue("@processGuid", processGuid);

                    using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                    {
                        do
                        {
                            while (reader.Read())
                            {
                                var dto = new PublishedProcessInfoDTO
                                              {
                                                  Id = reader.GetInt(0),
                                                  Name = reader.GetString(1),
                                                  SystemName = reader.GetString(2),
                                                  ProcessId = reader.GetInt(3),
                                                  IsStateEnabled = reader.GetBool(4),
                                                  ProcessOption = reader.GetEnum(5, ProcessOption.None)
                                              };

                                if (result.All(x => x.Id != dto.Id))
                                {
                                    result.Add(dto);
                                }
                            }
                        }
                        while (reader.NextResult());
                    }
                }
            }

            return result;
        }
コード例 #3
0
ファイル: ProcessDAL.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Retrieves the process.
        /// </summary>
        /// <param name="id">The process id.</param>
        /// <param name="fetchHistory">The fetch history.</param>
        /// <param name="locId">The localization/language id.</param>
        /// <returns>The processEdit DTO object <see cref="ProcessEditDto" />.</returns>
        public ProcessEditDto FetchProcess(int id, IProcessFetchHistory fetchHistory = null, int locId = 0)
        {
            var process = new ProcessEditDto();
            const string commandText = "GetProcessWithLoc";

            if (fetchHistory != null)
                fetchHistory.BeginLogExecuteSP();

            Database.GetDataReader(
                commandText,
                600,
                r =>
                {
                    if (r == null || !r.Read())
                    {
                        return;
                    }

                    var sr = new SafeDataReader(r);

                    process.Id = sr.GetInt("Id");
                    process.Name = sr.GetString("Name").Trim();
                    process.Description = sr.GetString("Description");
                    process.Documentation = sr.GetString("Documentation");
                    process.SystemName = sr.GetString("SystemName");
                    process.IconId = sr.GetNullableInt("IconId");
                    process.Guid = sr.GetGuid("Guid");
                    process.IsPublishedCopy = sr.GetBool("IsPublishedCopy");
                    process.BaseProcessId = sr.GetNullableInt("BaseProcessId");
                    process.BaseProcessProcessId = sr.GetNullableInt("BaseProcessProcessId");
                    process.ProcessOption = sr.GetString("ProcessOption");
                    process.IsStateEnabled = sr.GetBool("IsStateEnabled", true);
                    process.DefaultStateId = sr.GetInt32("DefaultStateId");
                    process.AllowPaperclips = sr.GetBool("AllowPaperclips", true);
                    process.ColorId = sr.GetNullableInt("ColorId");
                    process.InheritanceContext = sr.GetString("InheritanceContext");
                    process.ShowDerivedProcess = sr.GetBool(Constants.ShowDerivedProcess);
                    process.PublishedProcessId = sr.GetInt("PublishedProcessId");
                    process.PublishedId = sr.GetInt("PublishedId");
                    process.IsSystem = sr.GetBool("IsSystem");
                    process.SimpleProcess = sr.GetBool("SimpleProcess");
                    process.IsInactive = sr.GetBool("IsInactive");
                    process.IsTabbedUI = sr.GetBool("IsTabbedUI");
                    process.IsTrackable = sr.GetBool("IsTrackable");
                    process.ShowSummaryPage = sr.GetBool("ShowSummaryPage");
                    process.AllowBatchProcessing = sr.GetBool("AllowBatchProcessing");
                    process.LastUpdated = sr.GetDateTime("LastUpdated");
                    process.IdentifierField = sr.GetString("IdentifierField");
                    var processVersionId = sr.GetInt("ProcessVersionId");

                    if (fetchHistory != null)
                        fetchHistory.LogExecuteSP();

                    if (processVersionId > 0)
                    {
                        process.Version = new VersionDto
                        {
                            ProcessId = processVersionId,
                            VersioningStyle = sr.GetEnum("VersioningStyle", VersioningStyles.Char),
                            StartingVersion = sr.GetString("StartingVersion"),
                            NextVersionStateGuid = sr.GetGuid("NextVersionStateGuid"),
                            PreviousVersionStateGuid = sr.GetGuid("PreviousVersionStateGuid"),
                            IncludeVersionNumberInList = sr.GetBool("IncludeVersionNumberInList"),
                            IncludeVersionDateInList = sr.GetBool("IncludeVersionDateInList"),
                            StateFilterGuid = sr.GetGuid("StateFilterGuid")
                        };
                    }

                    if (fetchHistory != null)
                        fetchHistory.ProcessHistoryDTO.FetchSectionsTime = Profiler.Profile(() => ReadSections(process, sr));
                    else
                        ReadSections(process, sr);

                    ReadRequiredRuleConfigs(process, sr);

                    if (fetchHistory != null)
                        fetchHistory.ProcessHistoryDTO.FetchSecurityConfigurationsTime = fetchHistory.Profile(
                            () =>
                            {
                                ReadProcessSecurityConfigurations(process, sr);
                                ReadProcessSecurityConfigs(process, sr);
                            });
                    else
                    {
                        ReadProcessSecurityConfigurations(process, sr);
                        ReadProcessSecurityConfigs(process, sr);
                    }

                    ReadStates(process, sr);
                    ReadEscalationActionOptions(process, sr);
                    ReadAssignmentActionOptions(process, sr);
                    ReadApprovalActionOptions(process, sr);
                    ReadActionRules(process, sr);
                    ReadFilters(process, sr);
                    ReadMetrics(process, sr);
                    ReadKpis(process, sr);
                    ReadCommands(process, sr);
                    ReadESyncProcesses(process, sr);
                    ReadReports(process, sr);
                    ReadProcessViews(process, sr);
                    ReadDataTriggers(process, sr);
                    ReadIntegrationServices(process, sr);
                    ReadSearchDisplayFields(process, sr);
                    ReadLayouts(process, sr);
                    ReadProcessDataIndexes(process, sr);
                    ReadExternalData(process, sr);
                },
                    CommandType.StoredProcedure,
                    new SqlParameter("p_id", id),
                    new SqlParameter("localizationId", locId));

            // run after GetProcessNew
            this.ReadDependencies(process);

            return process;
        }
コード例 #4
0
ファイル: ApproverRetriever.cs プロジェクト: mparsin/Elements
        public Collection<PersonInfo> GetPersons(IEditableRoot item)
        {
            if (item == null)
                throw new ArgumentNullException("item");

            using (var ctx = ConnectionManager<SqlConnection>.GetManager(ServerSettings.ConnectionString, false))
            {
                using (var cmd = new SqlCommand(QueryDefinition.CommandText, ctx.Connection))
                {
                    foreach (var parameterBuilder in QueryDefinition.ParameterBuilders)
                    {
                        cmd.Parameters.Add(parameterBuilder.CreateParameter(item));
                    }

                    using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                    {
                        var result = new Collection<PersonInfo>();

                        while (reader.Read())
                        {
                            result.Add(
                                new PersonInfo
                                {
                                    Id = reader.GetInt32(0),
                                    FirstName = reader.GetString(1),
                                    LastName = reader.GetString(2),
                                    Email = reader.GetString(3),
                                    OutOfOffice = reader.GetNullableBool(4),
                                    DelegateApproverId = reader.GetNullableInt(5),
                                    AccountId = reader.GetNullableInt(6),
                                    UserName = reader.GetString(7),
                                    Locale = reader.GetString(8),
                                    AuthenticationType = reader.GetEnum(9, AuthenticationTypes.MQ1)
                                });
                        }

                        return result;
                    }
                }
            }
        }
コード例 #5
0
ファイル: ProcessDAL.cs プロジェクト: mparsin/Elements
        public IList<PublishedProcessInfoDTO> FetchPublishedProcesses(string culture)
        {
            var result = new List<PublishedProcessInfoDTO>();
            using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
            {
                var connection = ctx.Connection;

                var commandText = string.Format(CultureInfo.InvariantCulture, @"
SELECT pp.Id
      ,ISNULL(pl.ProcessName, p.[Name])
      ,p.[SystemName]
      ,p.Id AS ProcessId
      ,p.[BaseProcessId]
      ,p2.[IconId]
      ,p.[Guid]
      ,p.[ProcessOption]
      ,p.[IsStateEnabled]
FROM   [dbo].[PublishedProcesses] pp
       INNER JOIN Processes p ON  pp.ProcessId = p.Id
       INNER JOIN Processes p2 ON pp.ProcessGuid = p2.[Guid] and p2.[IsPublishedCopy] = 0
       LEFT OUTER JOIN dbo.ProcessLocalizations pl
            INNER JOIN dbo.Localizations l ON pl.LocalizationId = l.Id AND l.CultureName = '{0}'
                ON p2.Id = pl.ProcessId
WHERE p.IsRemoved = 0 AND p2.IsRemoved = 0
ORDER BY p.Name", culture);

                using (var cmd = new SqlCommand(commandText, connection))
                using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                {
                    while (reader.Read())
                    {
                        var dto = new PublishedProcessInfoDTO
                                      {
                                          Id = reader.GetInt32(0),
                                          Name = reader.GetString(1),
                                          SystemName = reader.GetString(2),
                                          ProcessId = reader.GetInt32(3),
                                          IconId = reader.GetNullableInt(5),
                                          ProcessGuid = reader.GetGuid(6),
                                          ProcessOption = reader.GetEnum(7, ProcessOption.None),
                                          IsStateEnabled = reader.GetBoolean(8)
                                      };

                        if (!reader.IsDBNull(4))
                        {
                            dto.BaseProcess = this.FetchPublishedProcess(reader.GetInt(4));
                        }

                        result.Add(dto);
                    }
                }
            }

            return result;
        }
コード例 #6
0
ファイル: PersonManagerBase.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Initializes a new <see cref="PersonInfo"/> with values from a data reader.
        /// </summary>
        /// <param name="reader">
        /// The data reader.
        /// </param>
        /// <returns>
        /// The <see cref="PersonInfo"/>.
        /// </returns>
        protected virtual PersonInfo ReadPerson(SafeDataReader reader)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");

            return new PersonInfo
                       {
                           Id = reader.GetInt32(0),
                           FirstName = reader.GetString(1),
                           LastName = reader.GetString(2),
                           Email = reader.GetString(3),
                           OutOfOffice = reader.GetNullableBool(4),
                           DelegateApproverId = reader.GetNullableInt(5),
                           AccountId = reader.GetNullableInt(6),
                           UserName = reader.GetString(7),
                           Locale = reader.GetString(8),
                           AuthenticationType = reader.GetEnum(9, AuthenticationTypes.MQ1)
                       };
        }
コード例 #7
0
ファイル: ProcessDAL2.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Reads the data trigger stored procedure parameters.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <param name="sr">The data reader.</param>
        private static void ReadDataTriggerStoredProcedureParameters(ProcessEditDto process, SafeDataReader sr)
        {
            sr.NextResult();

            int? triggerId = null;
            ProcessDataTriggerEditDto trigger = null;

            while (sr.Read())
            {
                var parameterDto = new DataTriggerStoredProcedureParameterDto
                                       {
                                           Id = sr.GetInt32(0),
                                           Guid = sr.GetGuid(1),
                                           TriggerId = sr.GetInt32(2),
                                           Name = sr.GetString(3),
                                           DataType =
                                               sr.GetEnum(4, DbDataType.String),
                                           Expression = sr.GetString(5)
                                       };

                if (parameterDto.TriggerId != triggerId)
                {
                    trigger = process.TriggerList.First(t => t.Id == parameterDto.TriggerId);
                    triggerId = parameterDto.TriggerId;
                }

                trigger.StoredProcedureParameters.Add(parameterDto);
            }
        }
コード例 #8
0
ファイル: ProcessDAL2.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Reads data triggers.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <param name="sr">The reader.</param>
        private static void ReadDataTriggers(ProcessEditDto process, SafeDataReader sr)
        {
            sr.NextResult();

            while (sr.Read())
            {
                var dto = new ProcessDataTriggerEditDto
                {
                    Id = sr.GetInt32(0),
                    Guid = sr.GetGuid(1),
                    Name = sr.GetString(2),
                    Notes = sr.GetString(3),
                    ProcessToModifySystemName = sr.GetString(4),
                    FilterGuid = sr.GetNullableGuid(5),
                    FilterDefinition = sr.GetString(6),
                    ModificationType = (DataTriggerModificationType)Enum.Parse(typeof(DataTriggerModificationType), sr.GetString(7), true),
                    ModificationMapping = sr.GetString(8),
                    TriggerType = sr.GetEnum(9, DataTriggerTypes.Process),
                    StoredProcedureName = sr.GetString(10)
                };

                process.TriggerList.Add(dto);
            }

            ReadDataTriggerMappings(process, sr);
            ReadDataTriggerRules(process, sr);
            ReadDataTriggerStoredProcedureParameters(process, sr);
        }
コード例 #9
0
        /// <summary>
        /// Reads the integration service methods.
        /// </summary>
        /// <param name="settingsDto">The settings dto.</param>
        /// <param name="reader">The reader.</param>
        private static void ReadIntegrationServiceMethods(IntegrationServiceCreationSettingsDto settingsDto, SafeDataReader reader)
        {
            reader.NextResult();

            while (reader.Read())
            {
                var dto = new IntegrationServiceMethodDto
                              {
                                  Id = reader.GetInt32(0),
                                  Guid = reader.GetGuid(1),
                                  Name = reader.GetString(2),
                                  Username = reader.GetString(3),
                                  Password = reader.GetString(4),
                                  CanInsert = reader.GetBoolean(5),
                                  CanUpdate = reader.GetBoolean(6),
                                  CanInsertOrUpdate = reader.GetBoolean(7),
                                  CanRemove = reader.GetBoolean(8),
                                  EndpointMapping = reader.GetString(9),
                                  Namespace = reader.GetString(10),
                                  CanSelect = reader.GetBoolean("CanSelect"),
                                  ResultTypeGuid = reader.GetNullableGuid("ResultTypeGuid"),
                                  ResultMapping = reader.GetString("ResultMapping"),
                                  ReturnMode = reader.GetEnum("ReturnMode", IntegrationServiceMethodReturnMode.All),
                                  GenerateIndexes = reader.GetBoolean("GenerateIndexes")
                              };

                settingsDto.Methods.Add(dto);
            }

            ReadIntegrationServiceMethodParameters(settingsDto, reader);
        }
コード例 #10
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;
        }