Inheritance: DataTextBox
Example #1
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            Controls.Clear();
            RockControlHelper.CreateChildControls( this, Controls );

            _datePicker = new DatePicker();
            _datePicker.ID = this.ID + "_datePicker";
            _datePicker.CssClass = "input-width-md";

            Controls.Add( _datePicker );

            _timePicker = new TimePicker();
            _timePicker.ID = this.ID + "_timePicker";
            _timePicker.CssClass = "input-width-md";
            Controls.Add( _timePicker );
        }
Example #2
0
 /// <summary>
 /// Creates the control(s) neccessary for prompting user for a new value
 /// </summary>
 /// <param name="configurationValues">The configuration values.</param>
 /// <param name="id"></param>
 /// <returns>
 /// The control
 /// </returns>
 public override Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id )
 {
     var tp = new TimePicker { ID = id }; 
     return tp;
 }
Example #3
0
        /// <summary>
        /// Adds the field type controls.
        /// </summary>
        /// <param name="parentControl">The filter control.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="entityField">The entity field.</param>
        protected void AddFieldTypeControls( Control parentControl, List<Control> controls, EntityField entityField )
        {
            string controlIdPrefix = string.Format( "{0}_{1}", parentControl.ID, entityField.FieldKind == FieldKind.Attribute ? entityField.AttributeGuid.Value.ToString("n") : entityField.Name );
            switch ( entityField.FilterFieldType )
            {
                case SystemGuid.FieldType.DATE:

                    var ddlDateCompare = ComparisonControl( DateFilterComparisonTypes );
                    ddlDateCompare.ID = string.Format( "{0}_ddlDateCompare", controlIdPrefix );
                    ddlDateCompare.AddCssClass( "js-filter-compare" );
                    parentControl.Controls.Add( ddlDateCompare );
                    controls.Add( ddlDateCompare );

                    var datePicker = new DatePicker();
                    datePicker.ID = string.Format( "{0}_dtPicker", controlIdPrefix );
                    datePicker.AddCssClass( "js-filter-control" );
                    parentControl.Controls.Add( datePicker );
                    controls.Add( datePicker );

                    break;

                case SystemGuid.FieldType.TIME:

                    var ddlTimeCompare = ComparisonControl( DateFilterComparisonTypes );
                    ddlTimeCompare.ID = string.Format( "{0}_ddlTimeCompare", controlIdPrefix );
                    ddlTimeCompare.AddCssClass( "js-filter-compare" );
                    parentControl.Controls.Add( ddlTimeCompare );
                    controls.Add( ddlTimeCompare );

                    var timePicker = new TimePicker();
                    timePicker.ID = string.Format( "{0}_timePicker", controlIdPrefix );
                    timePicker.AddCssClass( "js-filter-control" );
                    parentControl.Controls.Add( timePicker );
                    controls.Add( timePicker );

                    break;

                case SystemGuid.FieldType.INTEGER:
                case SystemGuid.FieldType.DECIMAL:

                    var ddlNumberCompare = ComparisonControl( NumericFilterComparisonTypes );
                    ddlNumberCompare.ID = string.Format( "{0}_ddlNumberCompare", controlIdPrefix );
                    ddlNumberCompare.AddCssClass( "js-filter-compare" );
                    parentControl.Controls.Add( ddlNumberCompare );
                    controls.Add( ddlNumberCompare );

                    var numberBox = new NumberBox();
                    numberBox.ID = string.Format( "{0}_numberBox", controlIdPrefix );
                    numberBox.AddCssClass( "js-filter-control" );
                    parentControl.Controls.Add( numberBox );
                    controls.Add( numberBox );

                    numberBox.FieldName = entityField.Title;

                    break;

                case SystemGuid.FieldType.MULTI_SELECT:

                    var cblMultiSelect = new RockCheckBoxList();
                    cblMultiSelect.ID = string.Format( "{0}_cblMultiSelect", controlIdPrefix );
                    parentControl.Controls.Add( cblMultiSelect );
                    cblMultiSelect.RepeatDirection = RepeatDirection.Horizontal;
                    controls.Add( cblMultiSelect );

                    if ( entityField.FieldKind == FieldKind.Property )
                    {
                        if ( entityField.PropertyType.IsEnum )
                        {
                            // Enumeration property
                            foreach ( var value in Enum.GetValues( entityField.PropertyType ) )
                            {
                                cblMultiSelect.Items.Add( new ListItem( Enum.GetName( entityField.PropertyType, value ).SplitCase() ) );
                            }
                        }
                        else if ( entityField.DefinedTypeGuid.HasValue )
                        {
                            // Defined Value Properties
                            var definedType = DefinedTypeCache.Read( entityField.DefinedTypeGuid.Value );
                            if ( definedType != null )
                            {
                                foreach ( var definedValue in definedType.DefinedValues )
                                {
                                    cblMultiSelect.Items.Add( new ListItem( definedValue.Name, definedValue.Guid.ToString() ) );
                                }
                            }
                        }
                    }
                    else
                    {
                        var attribute = AttributeCache.Read( entityField.AttributeGuid.Value );
                        if ( attribute != null )
                        {
                            switch ( attribute.FieldType.Guid.ToString().ToUpper() )
                            {
                                case SystemGuid.FieldType.SINGLE_SELECT:
                                    //TODO get attribute values qualifier to populate cbl
                                    break;
                                case SystemGuid.FieldType.MULTI_SELECT:
                                    //TODO get attribute values qualifier to populate cbl
                                    break;
                            }
                        }
                    }

                    break;

                case SystemGuid.FieldType.SINGLE_SELECT:

                    var ddlSingleSelect = new RockDropDownList();
                    ddlSingleSelect.ID = string.Format( "{0}_ddlSingleSelect", controlIdPrefix );
                    parentControl.Controls.Add( ddlSingleSelect );
                    controls.Add( ddlSingleSelect );

                    if ( entityField.FieldKind == FieldKind.Property )
                    {
                        if ( entityField.PropertyType == typeof( bool ) || entityField.PropertyType == typeof( bool? ) )
                        {
                            ddlSingleSelect.Items.Add( new ListItem( "True", "True" ) );
                            ddlSingleSelect.Items.Add( new ListItem( "False", "False" ) );
                        }
                    }
                    else
                    {
                        var attribute = AttributeCache.Read( entityField.AttributeGuid.Value );
                        if ( attribute != null )
                        {
                            switch ( attribute.FieldType.Guid.ToString().ToUpper() )
                            {
                                case SystemGuid.FieldType.BOOLEAN:
                                    ddlSingleSelect.Items.Add( new ListItem( "True", "True" ) );
                                    ddlSingleSelect.Items.Add( new ListItem( "False", "False" ) );
                                    break;
                            }
                        }
                    }

                    break;

                case SystemGuid.FieldType.DAY_OF_WEEK:
                    var dayOfWeekPicker = new DayOfWeekPicker();
                    dayOfWeekPicker.Label = string.Empty;
                    dayOfWeekPicker.ID = string.Format( "{0}_dayOfWeekPicker", controlIdPrefix );
                    dayOfWeekPicker.AddCssClass( "js-filter-control" );
                    parentControl.Controls.Add( dayOfWeekPicker );
                    controls.Add( dayOfWeekPicker );

                    break;

                case SystemGuid.FieldType.TEXT:

                    var ddlText = ComparisonControl( StringFilterComparisonTypes );
                    ddlText.ID = string.Format( "{0}_ddlText", controlIdPrefix );
                    ddlText.AddCssClass( "js-filter-compare" );
                    parentControl.Controls.Add( ddlText );
                    controls.Add( ddlText );

                    var tbText = new RockTextBox();
                    tbText.ID = string.Format( "{0}_tbText", controlIdPrefix );
                    tbText.AddCssClass( "js-filter-control" );
                    parentControl.Controls.Add( tbText );
                    controls.Add( tbText );

                    break;
            }
        }