Beispiel #1
0
        /// <summary>
        /// Configures the report parameter constraint
        /// </summary>
        /// <param name="configuration">The constraint configuration</param>
        internal void Configure
        (
            ReportParameterConstraintConfiguration configuration
        )
        {
            Validate.IsNotNull(configuration);

            if (String.IsNullOrEmpty(configuration.ParameterName))
            {
                throw new ArgumentException
                      (
                          "The constraint parameter name is required."
                      );
            }

            if (configuration.MappingValue == null)
            {
                throw new ArgumentException
                      (
                          "The constraint mapping value is required."
                      );
            }

            var mappingValue = configuration.MappingValue;

            this.ParameterName        = configuration.ParameterName;
            this.MappingType          = configuration.MappingType;
            this.MappingValue         = mappingValue.ToString();
            this.MappingValueTypeName = mappingValue.GetType().AssemblyQualifiedName;
        }
Beispiel #2
0
        /// <summary>
        /// Sets a parameter value constraint against the role assignment
        /// </summary>
        /// <param name="configuration">The constraint configuration</param>
        protected virtual void SetParameterConstraint
        (
            ReportParameterConstraintConfiguration configuration
        )
        {
            Validate.IsNotNull(configuration);

            var parameterName = configuration.ParameterName;

            var constraint = this.ParameterConstraints.FirstOrDefault
                             (
                m => m.ParameterName.Equals
                (
                    parameterName,
                    StringComparison.OrdinalIgnoreCase
                )
                             );

            if (constraint == null)
            {
                constraint = new ReportParameterConstraint
                             (
                    this,
                    configuration
                             );

                this.ParameterConstraints.Add(constraint);
            }
            else
            {
                constraint.Configure(configuration);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Constructs the report parameter constraint with the details
        /// </summary>
        /// <param name="assignment">The role assignment</param>
        /// <param name="configuration">The constraint configuration</param>
        internal ReportParameterConstraint
        (
            ReportRoleAssignment assignment,
            ReportParameterConstraintConfiguration configuration
        )
        {
            Validate.IsNotNull(assignment);

            this.Id         = Guid.NewGuid();
            this.Assignment = assignment;

            Configure(configuration);
        }