Exemple #1
0
        /// <summary>
        /// Retrieves reverse cross ref field.
        /// </summary>
        /// <param name="fieldId">The field id.</param>
        /// <returns>The <see cref="ReverseCrossRefFieldDto" />.</returns>
        public ReverseCrossRefFieldDto FetchReverseCrossRefField(int fieldId)
        {
            const string CmdText =
                @"
SELECT
     f.[Id]
    ,f.[Name]
    ,f.[SystemName]
    ,x.[DisplayMultiple]
    ,x.[ReverseCrossRefProcessId]
    ,p.[SystemName]
    ,x.[CrossRefFieldName]
    ,x.[DisplayFieldName]
    ,o.[ShowLatestVersion]
FROM [dbo].[Fields] f
INNER JOIN [dbo].[ReverseCrossRefRequiredFieldStep] x ON f.[Id] = x.[FieldId]
INNER JOIN [dbo].[PublishedProcesses] pp ON pp.[Id] = x.[ReverseCrossRefProcessId]
INNER JOIN [dbo].[Processes] p ON p.[Id] = pp.[ProcessId] AND p.[IsRemoved] = 0
LEFT OUTER JOIN [dbo].[ReverseCrossRefOptionsFieldStep] o ON o.[FieldId] = f.[Id]
WHERE f.[Id] = @fieldId";

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

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

                    using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                    {
                        while (reader.Read())
                        {
                            return new ReverseCrossRefFieldDto
                                       {
                                           FieldId = reader.GetInt32(0),
                                           Name = reader.GetString(1),
                                           SystemName = reader.GetString(2),
                                           DisplayMultiple = reader.GetBoolean(3),
                                           ReferenceProcessId = reader.GetInt32(4),
                                           ReferenceProcessSystemName = reader.GetString(5),
                                           ReferenceField = reader.GetString(6),
                                           DisplayField = reader.GetString(7),
                                           ShowLatestVersion = reader.GetNullableBool(8) ?? false
                                       };
                        }
                    }
                }
            }

            return new ReverseCrossRefFieldDto();
        }
        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;
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Adds the navigation item.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="currentGroup">The current group.</param>
        private static void AddNavigationItem(SafeDataReader reader, NavigationGroupDTO currentGroup)
        {
            var navItemDto = new NavigationItemDTO
                                 {
                                     Id = reader.GetInt32(5),
                                     Name = reader.GetString(6),
                                     SystemName = reader.GetString(7),
                                     IconId = reader.GetNullableInt(8),
                                     IconUrl = reader.GetString(9),
                                     AssemblyName = reader.GetString(10),
                                     ProcessId = reader.GetNullableInt(11),
                                     ProcessSystemName = reader.GetString(13),
                                     Description = reader.GetString(17)
                                 };
            navItemDto.Description = navItemDto.ProcessId == null ? reader.GetString("HelpText") : reader.GetString(reader.GetOrdinal("Description"));
            navItemDto.BackgroundColor = reader.GetInt64(reader.GetOrdinal("BackgroundColor"));
            navItemDto.ProcessViewGuid = reader.GetNullableGuid(reader.GetOrdinal("ProcessViewGuid"));
            navItemDto.IsSystem = reader.GetNullableBool(reader.GetOrdinal("IsSystem"));
            navItemDto.IsBeta = reader.GetBoolean(reader.GetOrdinal("IsBeta"));
            var processName = reader.GetString(12);

            if (!string.IsNullOrEmpty(processName))
                navItemDto.Name = processName;

            currentGroup.NavigationItems.Add(navItemDto);
        }
        /// <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)
                       };
        }