Пример #1
0
        /// <summary>
        /// Retrieves picture.
        /// </summary>
        /// <param name="childData">The DTO object.</param>
        /// <returns>The picture <see cref="PictureStepDto" />.</returns>
        public PictureStepDto FetchPicture(BaseStepDto childData)
        {
            const string CommandText = "GetPictureStep";

            PictureStepDto dto = null;

            Database.GetDataReader(
                CommandText,
                r =>
                {
                    using (var sr = new SafeDataReader(r))
                    {
                        dto = new PictureStepFetcher().Fetch(childData, sr);
                    }
                },
                CommandType.StoredProcedure,
                new SqlParameter("@FieldId", childData.FieldId));

            return dto;
        }
Пример #2
0
        /// <summary>
        /// Retrieves cross ref options step.
        /// </summary>
        /// <param name="childData">The child data.</param>
        /// <returns>The cross reference options step.<see cref="CrossRefOptionsStepDto" />.</returns>
        /// <exception cref="System.ArgumentNullException">The input DTO is null.</exception>
        public CrossRefOptionsStepDto FetchCrossRefOptionsStep(BaseStepDto childData)
        {
            if (childData == null) throw new ArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "childData"));

            const string Sql =
                @"
SELECT
     [Id]
    ,[FieldId]
    ,[FilterGuid]
    ,[FilterDefinition]
    ,[DefaultValueExpression]
    ,[AllowAddNew]
    ,[AllowViewDetail]
    ,[AllowClear]
    ,[MaxCapacity]
FROM [dbo].[CrossRefOptionsFieldStep]
WHERE [FieldId] = @fieldId;
";

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

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

                    using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                    {
                        return new CrossRefOptionsFetcher().Fetch(childData, reader);
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Retrieves expressions.
        /// </summary>
        /// <param name="childData">The child data.</param>
        /// <returns>The <see cref="ExpressionsStepDto" />.</returns>
        public ExpressionsStepDto FetchExpressions(BaseStepDto childData)
        {
            using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
            {
                var connection = ctx.Connection;

                const string CommandText = "GetExpressionStep";
                using (var cmd = new SqlCommand(CommandText, connection))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                    {
                        return new ExpressionStepFetcher().Fetch(childData, reader);
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Retrieves display list required step.
        /// </summary>
        /// <param name="childData">The child data.</param>
        /// <returns>The <see cref="DisplayListRequiredStepDto" />.</returns>
        /// <exception cref="System.ArgumentNullException">The input DTO is null.</exception>
        public DisplayListRequiredStepDto FetchDisplayListRequiredStep(BaseStepDto childData)
        {
            if (childData == null) throw new ArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "childData"));

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

                const string CommandText = "GetDisplayListRequiredStep";
                using (var cmd = new SqlCommand(CommandText, connection))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@FieldId", childData.FieldId);
                    using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                    {
                        return new DisplayListRequiredStepFetcher().Fetch(childData, reader);
                    }
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Retrieves text options.
        /// </summary>
        /// <param name="childData">The child data.</param>
        /// <returns>Text options step.</returns>
        /// <exception cref="System.ArgumentNullException">Indicates stale data.</exception>
        public TextOptionsStepDto FetchTextOptions(BaseStepDto childData)
        {
            if (childData == null) throw new ArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "childData"));

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

                const string CommandText = @"
SELECT [Id]
      ,[UseRichText]
      ,[Mask]
      ,[MaskType]
      ,[HasMaxLength]
      ,[NumberOfCharacters]
  FROM [dbo].[stepTextOptions]
  WHERE FieldId = @fieldId";

                using (var cmd = new SqlCommand(CommandText, connection))
                {
                    cmd.Parameters.AddWithValue("@fieldId", childData.FieldId);
                    using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                    {
                        return new TextOptionsFetcher().Fetch(childData, reader);
                    }
                }
            }
        }