Inheritance: System.Web.UI.WebControls.PlaceHolder, INamingContainer
 /// <summary>
 /// Gfs the settings_ display filter value.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected void gfSettings_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
 {
     if ( e.Key != "Include Inactive" )
     {
         e.Value = string.Empty;
     }
 }
Example #2
0
        /// <summary>
        /// Handles the filter display for each saved user value
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void gContentListFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Site":
                    e.Value = ddlSiteFilter.SelectedValue;
                    break;

                case "Approval Status":
                    e.Value = ddlApprovedFilter.SelectedValue;
                    break;

                case "Approved By":
                    int personId = 0;
                    if ( int.TryParse( e.Value, out personId ) && personId != 0 )
                    {
                        var personService = new PersonService( new RockContext() );
                        var person = personService.Get( personId );
                        if ( person != null )
                        {
                            e.Value = person.FullName;
                        }
                    }

                    break;
            }
        }
        /// <summary>
        /// Gfs the pledges_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void gfPledges_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Date Range":
                    e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
                    break;

                case "Person":
                    int? personId = e.Value.AsIntegerOrNull();
                    if ( personId != null )
                    {
                        var person = new PersonService( new RockContext() ).Get( personId.Value );
                        if ( person != null )
                        {
                            e.Value = person.ToString();
                        }
                        else
                        {
                            e.Value = string.Empty;
                        }
                    }
                    else
                    {
                        e.Value = string.Empty;
                    }
                    break;

                case "Accounts":

                    var accountIdList = e.Value.Split( ',' ).AsIntegerList();
                    if ( accountIdList.Any() )
                    {
                        var service = new FinancialAccountService( new RockContext() );
                        var accounts = service.GetByIds( accountIdList );
                        if ( accounts != null && accounts.Any() )
                        {
                            e.Value = accounts.Select( a => a.Name ).ToList().AsDelimited( "," );
                        }
                        else
                        {
                            e.Value = string.Empty;
                        }
                    }
                    else
                    {
                        e.Value = string.Empty;
                    }

                    break;

                default:
                    e.Value = string.Empty;
                    break;
            }
        }
Example #4
0
        /// <summary>
        /// Displays the text of the current filters
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void fRequest_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Request Date Range":
                case "Response Date Range":
                    e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
                    break;

            }
        }
Example #5
0
        /// <summary>
        /// Displays the text of the current filters
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void fDevice_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Printer":

                    int deviceId = 0;
                    if ( int.TryParse( e.Value, out deviceId ) )
                    {
                        var service = new DeviceService( new RockContext() );
                        var device = service.Get( deviceId );
                        if ( device != null )
                        {
                            e.Value = device.Name;
                        }
                    }

                    break;

                case "Device Type":

                    int definedValueId = 0;
                    if ( int.TryParse( e.Value, out definedValueId ) )
                    {
                        var definedValue = DefinedValueCache.Read( definedValueId );
                        if ( definedValue != null )
                        {
                            e.Value = definedValue.Value;
                        }
                    }

                    break;

                case "Print To":

                    e.Value = ( (PrintTo)System.Enum.Parse( typeof( PrintTo ), e.Value ) ).ToString();
                    break;

                case "Print From":

                    e.Value = ( (PrintFrom)System.Enum.Parse( typeof( PrintFrom ), e.Value ) ).ToString();
                    break;

            }
        }
        /// <summary>
        /// Handles displaying the stored filter values.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e as DisplayFilterValueArgs (hint: e.Key and e.Value).</param>
        protected void gfFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Date Range":
                    e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
                    break;

                // don't display dead setting
                case "From Date":
                    e.Value = string.Empty;
                    break;

                // don't display dead setting
                case "To Date":
                    e.Value = string.Empty;
                    break;

                case "Prayer Category":

                    int categoryId = e.Value.AsIntegerOrNull() ?? All.Id;
                    if ( categoryId == All.Id )
                    {
                        e.Value = "All";
                    }
                    else
                    {
                        var category = Rock.Web.Cache.CategoryCache.Read( categoryId );
                        if ( category != null )
                        {
                            e.Value = category.Name;
                        }
                    }

                    break;
            }
        }
Example #7
0
        /// <summary>
        /// Rs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void rFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "EntityType":

                    if ( e.Value != "" )
                    {
                        if ( e.Value == "0" )
                        {
                            e.Value = "None (Global Attributes)";
                        }
                        else
                        {
                            e.Value = EntityTypeCache.Read( int.Parse( e.Value ) ).FriendlyName;
                        }
                    }
                    break;
            }
        }
        /// <summary>
        /// Handles displaying the stored filter values.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e as DisplayFilterValueArgs (hint: e.Key and e.Value).</param>
        protected void gfFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Date Range":
                    e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
                    break;

                // don't display dead setting
                case "From Date":
                    e.Value = string.Empty;
                    break;

                // don't display dead setting
                case "To Date":
                    e.Value = string.Empty;
                    break;
            }
        }
Example #9
0
        /// <summary>
        /// Build filter values/summary with user friendly data from filters
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void fExceptionList_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Site":
                    int siteId;
                    if ( int.TryParse( e.Value, out siteId ) )
                    {
                        var site = SiteCache.Read( siteId );
                        if ( site != null )
                        {
                            e.Value = site.Name;
                        }
                    }
                    break;

                case "Page":
                    int pageId;
                    if ( int.TryParse( e.Value, out pageId ) )
                    {
                        var page = PageCache.Read( pageId );
                        if ( page != null )
                        {
                            e.Value = page.InternalName;
                        }
                    }
                    break;

                case "User":
                    int userPersonId;
                    if ( int.TryParse( e.Value, out userPersonId ) )
                    {
                        PersonService personService = new PersonService( new RockContext() );
                        var user = personService.Get( userPersonId );
                        if ( user != null )
                        {
                            e.Value = user.FullName;
                        }
                    }
                    break;

                // ignore old filter parameters
                case "Start Date":
                case "End Date":
                    e.Value = null;
                    break;

                case "Date Range":
                    e.Value = SlidingDateRangePicker.FormatDelimitedValues( e.Value );
                    break;

            }
        }
        /// <summary>
        /// Gfs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void gfFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            if ( AvailableAttributes != null && SelectedChannelId.HasValue )
            {
                var attribute = AvailableAttributes.FirstOrDefault( a => MakeKeyUniqueToChannel( SelectedChannelId.Value, a.Key ) == e.Key );
                if ( attribute != null )
                {
                    try
                    {
                        var values = JsonConvert.DeserializeObject<List<string>>( e.Value );
                        e.Value = attribute.FieldType.Field.FormatFilterValues( attribute.QualifierValues, values );
                        return;
                    }
                    catch
                    {
                        // intentionally ignore
                    }
                }
            }

            if ( e.Key == "Date Range" )
            {
                e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
            }
            else if ( e.Key == "Status" )
            {
                var status = e.Value.ConvertToEnumOrNull<ContentChannelItemStatus>();
                if ( status.HasValue )
                {
                    {
                        e.Value = status.ConvertToString();
                    }
                }
            }
            else if ( e.Key == "Title" )
            {
                return;
            }
            else
            {
                e.Value = string.Empty;
            }
        }
Example #11
0
 /// <summary>
 /// Gfs the metric values_ display filter value.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected void gfMetricValues_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
 {
     if ( e.Key == "Date Range" )
     {
         e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
     }
     else if ( e.Key == "Goal/Measure" )
     {
         var metricValueType = e.Value.ConvertToEnumOrNull<MetricValueType>();
         if ( metricValueType.HasValue )
         {
             e.Value = metricValueType.Value.ConvertToString();
         }
         else
         {
             e.Value = null;
         }
     }
     else if ( e.Key == EntityPreferenceKey )
     {
         e.Key = hfEntityTypeName.Value;
         var parts = e.Value.Split( '|' );
         if ( parts.Length >= 2 )
         {
             e.Value = GetSeriesName( parts[1].AsIntegerOrNull() );
         }
     }
     else
     {
         e.Value = null;
     }
 }
Example #12
0
        /// <summary>
        /// Displays the text of the current filters
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            DateTime startDateTimeValue;
            DateTime endDateTimeValue;

            if ( DateRangePicker.TryParse( e.Value, out startDateTimeValue, out endDateTimeValue ) )
            {
                e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
            }
        }
Example #13
0
        /// <summary>
        /// Rs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void rFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            if ( AvailableAttributes != null )
            {
                var attribute = AvailableAttributes.FirstOrDefault( a => MakeKeyUniqueToGroup( a.Key ) == e.Key );
                if ( attribute != null )
                {
                    try
                    {
                        var values = JsonConvert.DeserializeObject<List<string>>( e.Value );
                        e.Value = attribute.FieldType.Field.FormatFilterValues( attribute.QualifierValues, values );
                        return;
                    }
                    catch
                    {
                        // intentionally ignore
                    }
                }
            }

            if ( e.Key == MakeKeyUniqueToGroup( "First Name" ) )
            {
                return;
            }
            else if ( e.Key == MakeKeyUniqueToGroup( "Last Name" ) )
            {
                return;
            }
            else if ( e.Key == MakeKeyUniqueToGroup( "Role" ) )
            {
                e.Value = ResolveValues( e.Value, cblRole );
            }
            else if ( e.Key == MakeKeyUniqueToGroup( "Status" ) )
            {
                e.Value = ResolveValues( e.Value, cblStatus );
            }
            else
            {
                e.Value = string.Empty;
            }
        }
        /// <summary>
        /// Rs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void rFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            var rockContext = new RockContext();
            switch ( e.Key )
            {
                case "Date Range":
                    e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
                    break;

                case "Person":
                    int? personId = e.Value.AsIntegerOrNull();
                    e.Value = null;
                    if ( personId.HasValue )
                    {
                        var person = new PersonService( rockContext ).Get( personId.Value );
                        if ( person != null )
                        {
                            e.Value = person.ToString();
                        }
                    }
                    break;

                case "Group":
                    int? groupId = e.Value.AsIntegerOrNull();
                    e.Value = null;
                    if ( groupId.HasValue )
                    {
                        var group = new GroupService( rockContext ).Get( groupId.Value );
                        if ( group != null )
                        {
                            e.Value = group.ToString();
                        }
                    }
                    break;

                case "Schedule":
                    int? scheduleId = e.Value.AsIntegerOrNull();
                    e.Value = null;
                    if ( scheduleId.HasValue )
                    {
                        var schedule = new ScheduleService( rockContext ).Get( scheduleId.Value );
                        if ( schedule != null )
                        {
                            e.Value = schedule.Name;
                        }
                    }
                    break;

                case "Attended":
                    if ( e.Value == "1" )
                    {
                        e.Value = "Did Attend";
                    }
                    else if ( e.Value == "0" )
                    {
                        e.Value = "Did Not Attend";
                    }
                    else
                    {
                        e.Value = null;
                    }

                    break;

                default:
                    e.Value = null;
                    break;
            }
        }
Example #15
0
        void gfSettings_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Authentication Provider":
                    {
                        var entityType = EntityTypeCache.Read( compProvider.SelectedValue.AsGuid() );
                        if ( entityType != null )
                        {
                            e.Value = entityType.FriendlyName;
                        }

                        break;
                    }

                case "Created":
                case "Last Login":
                    {
                        e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
                        break;
                    }
                case "Is Confirmed":
                case "Is Locked Out":
                    {
                        bool value = false;
                        if ( bool.TryParse( e.Value, out value ) )
                        {
                            e.Value = value ? "Yes" : "No";
                        }
                        break;
                    }
            }
        }
Example #16
0
        /// <summary>
        /// Rs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void rFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Date Range":
                    e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
                    break;

                case "Active Status":
                    e.Value = e.Value;
                    break;

                default:
                    e.Value = string.Empty;
                    break;
            }
        }
        /// <summary>
        /// Rs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void rFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            if ( e.Key == MakeKeyUniqueToGroup( "Date Range" ) )
            {
                // show the date range pickers current value, instead of the user preference since we set it to a default value if blank
                e.Value = DateRangePicker.FormatDelimitedValues( drpDates.DelimitedValues );
            }
            else if ( e.Key == MakeKeyUniqueToGroup( "Schedule" ) )
            {
                int scheduleId = e.Value.AsInteger();
                if ( scheduleId != 0 )
                {
                    var schedule = new ScheduleService( _rockContext ).Get( scheduleId );
                    e.Value = schedule != null ? schedule.Name : string.Empty;
                }
                else
                {
                    e.Value = string.Empty;
                }
            }
            else if ( e.Key == MakeKeyUniqueToGroup( "Location" ) )
            {
                string locId = e.Value;
                if ( locId.StartsWith( "P" ) )
                {
                    locId = locId.Substring( 1 );
                }

                int locationId = locId.AsInteger();
                e.Value = new LocationService( _rockContext ).GetPath( locationId );
            }
            else
            {
                e.Value = string.Empty;
            }
        }
Example #18
0
        /// <summary>
        /// Handles the filter display
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void rAccountFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Campus":

                    int? campusId = e.Value.AsIntegerOrNull();
                    if ( campusId.HasValue )
                    {
                        var campus = CampusCache.Read( campusId.Value );
                        if ( campus != null )
                        {
                            e.Value = campus.Name;
                        }
                    }

                    break;
            }
        }
 /// <summary>
 /// Gfs the filter_ display filter value.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 void gfFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
 {
     switch ( e.Key )
     {
         case "Type":
             {
                 int? typeId = e.Value.AsIntegerOrNull();
                 if ( typeId.HasValue )
                 {
                     var contentType = new ContentChannelTypeService( new RockContext() ).Get( typeId.Value );
                     if ( contentType != null )
                     {
                         e.Value = contentType.Name;
                     }
                 }
                 break;
             }
         default:
             {
                 e.Value = string.Empty;
                 break;
             }
     }
 }
Example #20
0
        /// <summary>
        /// Handles displaying the stored filter values.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e as DisplayFilterValueArgs (hint: e.Key and e.Value).</param>
        protected void gfFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Prayer Category":

                    int categoryId = e.Value.AsIntegerOrNull() ?? All.Id;
                    if ( categoryId == All.Id )
                    {
                        e.Value = "All";
                    }
                    else
                    {
                        var service = new CategoryService( new RockContext() );
                        var category = service.Get( categoryId );
                        if ( category != null )
                        {
                            e.Value = category.Name;
                        }
                    }

                    break;
            }
        }
        /// <summary>
        /// Gfs the settings_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void gfSettings_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Campus":
                    {
                        if ( !string.IsNullOrWhiteSpace( e.Value ) )
                        {
                            e.Value = CampusCache.Read( int.Parse( e.Value ) ).Name;
                        }
                        break;
                    }

                case "Agency Type":
                    {
                        int? valueId = gfSettings.GetUserPreference( "Agency Type" ).AsInteger( false );
                        if ( valueId.HasValue )
                        {
                            var definedValue = DefinedValueCache.Read( valueId.Value );
                            if ( definedValue != null )
                            {
                                e.Value = definedValue.Name;
                            }
                        }
                        break;
                    }

                default:
                    {
                        e.Value = string.Empty;
                        break;
                    }
            }
        }
 /// <summary>
 /// Handles displaying the stored filter values.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e as DisplayFilterValueArgs (hint: e.Key and e.Value).</param>
 protected void gfFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
 {
     // not necessary yet.
 }
Example #23
0
        /// <summary>
        /// Builds the controls.
        /// </summary>
        /// <param name="setData">if set to <c>true</c> [set data].</param>
        private void BuildControls( bool setData )
        {
            var showGridFilterControls = GetAttributeValue( "ShowGridFilter" ).AsBoolean();
            string errorMessage = string.Empty;

            // get just the schema of the data until we actually need the data
            var dataSetSchema = GetData( out errorMessage, true );

            if ( !string.IsNullOrWhiteSpace( errorMessage ) )
            {
                phContent.Visible = false;

                nbError.Text = errorMessage;
                nbError.Visible = true;
            }
            else
            {
                phContent.Controls.Clear();

                var mergeFields = GetDynamicDataMergeFields();

                if ( dataSetSchema != null )
                {
                    string formattedOutput = GetAttributeValue( "FormattedOutput" );

                    // load merge objects if needed by either for formatted output OR page title
                    if ( !string.IsNullOrWhiteSpace( GetAttributeValue( "PageTitleLava" ) ) || !string.IsNullOrWhiteSpace( formattedOutput ) )
                    {
                        int i = 1;

                        // Formatted output needs all the rows, so get the data regardless of the setData parameter
                        var dataSet = GetData( out errorMessage);
                        foreach ( DataTable dataTable in dataSet.Tables )
                        {
                            var dropRows = new List<DataRowDrop>();
                            foreach ( DataRow row in dataTable.Rows )
                            {
                                dropRows.Add( new DataRowDrop( row ) );
                            }

                            if ( dataSet.Tables.Count > 1 )
                            {
                                var tableField = new Dictionary<string, object>();
                                tableField.Add( "rows", dropRows );
                                mergeFields.Add( "table" + i.ToString(), tableField );
                            }
                            else
                            {
                                mergeFields.Add( "rows", dropRows );
                            }
                            i++;
                        }
                    }

                    // set page title
                    if ( !string.IsNullOrWhiteSpace( GetAttributeValue( "PageTitleLava" ) ) )
                    {
                        string title = GetAttributeValue( "PageTitleLava" ).ResolveMergeFields( mergeFields );

                        RockPage.BrowserTitle = title;
                        RockPage.PageTitle = title;
                        RockPage.Header.Title = title;
                    }

                    if ( string.IsNullOrWhiteSpace( formattedOutput ) )
                    {
                        bool personReport = GetAttributeValue( "PersonReport" ).AsBoolean();

                        int tableId = 0;
                        DataSet dataSet;
                        if ( setData == false )
                        {
                            dataSet = dataSetSchema;
                        }
                        else
                        {
                            dataSet = GetData( out errorMessage );
                        }

                        foreach ( DataTable dataTable in dataSet.Tables )
                        {
                            var div = new HtmlGenericControl( "div" );
                            div.AddCssClass( "grid" );

                            if ( GetAttributeValue( "PaneledGrid" ).AsBoolean() )
                            {
                                div.AddCssClass( "grid-panel" );
                            }

                            phContent.Controls.Add( div );

                            GridFilter = new GridFilter()
                            {
                                ID = string.Format("gfFilter{0}", tableId )
                            };

                            div.Controls.Add( GridFilter );
                            GridFilter.ApplyFilterClick += ApplyFilterClick;
                            GridFilter.DisplayFilterValue += DisplayFilterValue;
                            GridFilter.Visible = showGridFilterControls && (dataSet.Tables.Count == 1);

                            var grid = new Grid();
                            div.Controls.Add( grid );
                            grid.ID = string.Format( "dynamic_data_{0}", tableId++ );
                            grid.AllowSorting = true;
                            grid.EmptyDataText = "No Results";
                            grid.Actions.ShowCommunicate = GetAttributeValue( "ShowCommunicate" ).AsBoolean();
                            grid.Actions.ShowMergePerson = GetAttributeValue( "ShowMergePerson" ).AsBoolean();
                            grid.Actions.ShowBulkUpdate = GetAttributeValue( "ShowBulkUpdate" ).AsBoolean();
                            grid.Actions.ShowExcelExport = GetAttributeValue( "ShowExcelExport" ).AsBoolean();
                            grid.Actions.ShowMergeTemplate = GetAttributeValue( "ShowMergeTemplate" ).AsBoolean();

                            grid.GridRebind += gReport_GridRebind;
                            grid.RowSelected += gReport_RowSelected;
                            if ( personReport )
                            {
                                grid.PersonIdField = "Id";
                            }
                            else
                            {
                                grid.PersonIdField = null;
                            }
                            grid.CommunicateMergeFields = GetAttributeValue( "MergeFields" ).SplitDelimitedValues().ToList<string>();

                            AddGridColumns( grid, dataTable );
                            SetDataKeyNames( grid, dataTable );

                            if ( setData )
                            {
                                FilterTable( grid, dataTable );
                                SortTable( grid, dataTable );
                                grid.DataSource = dataTable;

                                if ( personReport)
                                {
                                    grid.EntityTypeId = EntityTypeCache.GetId<Person>();
                                }

                                grid.DataBind();
                            }
                        }
                    }
                    else
                    {
                        phContent.Controls.Add( new LiteralControl( formattedOutput.ResolveMergeFields( mergeFields ) ) );
                    }
                }

                phContent.Visible = true;
                nbError.Visible = false;
            }
        }
        /// <summary>
        /// Rs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void rFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            switch ( e.Key )
            {
                case "Group Type":

                    int id = e.Value.AsInteger() ?? 0;

                    var groupType = GroupTypeCache.Read( id );
                    if ( groupType != null )
                    {
                        e.Value = groupType.Name;
                    }

                    break;
            }
        }
 /// <summary>
 /// Build filter values/summary with user friendly data from filters
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected void fExceptionList_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
 {
     switch ( e.Key )
     {
         case "Site":
             int siteId;
             if ( int.TryParse( e.Value, out siteId ) )
             {
                 var site = SiteCache.Read( siteId );
                 if ( site != null )
                 {
                     e.Value = site.Name;
                 }
             }
             break;
         case "Page":
             int pageId;
             if ( int.TryParse( e.Value, out pageId ) )
             {
                 var page = PageCache.Read( pageId );
                 if ( page != null )
                 {
                     e.Value = page.InternalName;
                 }
             }
             break;
         case "User":
             int userPersonId;
             if ( int.TryParse( e.Value, out userPersonId ) )
             {
                 PersonService personService = new PersonService( new RockContext() );
                 var user = personService.Get( userPersonId );
                 if ( user != null )
                 {
                     e.Value = user.FullName;
                 }
             }
             break;
     }
 }
Example #26
0
 /// <summary>
 /// Fs the campusEventItems_ display filter value.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected void fLinkages_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
 {
     switch ( e.Key )
     {
         case "Campus":
             {
                 var values = new List<string>();
                 foreach ( string value in e.Value.Split( ';' ) )
                 {
                     var item = cblCampus.Items.FindByValue( value );
                     if ( item != null )
                     {
                         values.Add( item.Text );
                     }
                 }
                 e.Value = values.AsDelimited( ", " );
                 break;
             }
         default:
             {
                 e.Value = string.Empty;
                 break;
             }
     }
 }
 /// <summary>
 /// Rs the filter_ display filter value.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected void rFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
 {
     switch ( e.Key )
     {
         case "EntityType":
             e.Value = EntityTypeCache.Read( int.Parse( e.Value ) ).FriendlyName;
             break;
         case "Owner":
             int? personId = e.Value.AsInteger( false );
             if ( personId.HasValue )
             {
                 var person = new PersonService( new RockContext() ).Get( personId.Value );
                 if ( person != null )
                 {
                     e.Value = person.FullNameReversed;
                 }
                 else
                 {
                     e.Value = string.Empty;
                 }
             }
             else
             {
                 e.Value = string.Empty;
             }
             break;
     }
 }
Example #28
0
        /// <summary>
        /// Fs the registrants_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void fRegistrants_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
        {
            if ( RegistrantFields != null )
            {
                var attribute = RegistrantFields
                    .Where( a =>
                        a.Attribute != null &&
                        a.Attribute.Key == e.Key )
                    .Select( a => a.Attribute )
                    .FirstOrDefault();

                if ( attribute != null )
                {
                    try
                    {
                        var values = JsonConvert.DeserializeObject<List<string>>( e.Value );
                        e.Value = attribute.FieldType.Field.FormatFilterValues( attribute.QualifierValues, values );
                        return;
                    }
                    catch { }
                }
            }

            switch ( e.Key )
            {
                case "Date Range":
                case "Birthdate Range":
                    {
                        e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
                        break;
                    }
                case "First Name":
                case "Last Name":
                case "Email":
                case "Phone":
                    {
                        break;
                    }
                case "Gender":
                    {
                        var gender = e.Value.ConvertToEnumOrNull<Gender>();
                        e.Value = gender.HasValue ? gender.ConvertToString() : string.Empty;
                        break;
                    }
                case "Campus":
                    {
                        int? campusId = e.Value.AsIntegerOrNull();
                        if ( campusId.HasValue )
                        {
                            var campus = CampusCache.Read( campusId.Value );
                            e.Value = campus != null ? campus.Name : string.Empty;
                        }
                        else
                        {
                            e.Value = string.Empty;
                        }
                        break;
                    }
                case "Marital Status":
                    {
                        int? dvId = e.Value.AsIntegerOrNull();
                        if ( dvId.HasValue )
                        {
                            var maritalStatus = DefinedValueCache.Read( dvId.Value );
                            e.Value = maritalStatus != null ? maritalStatus.Value : string.Empty;
                        }
                        else
                        {
                            e.Value = string.Empty;
                        }
                        break;
                    }
                default:
                    {
                        e.Value = string.Empty;
                        break;
                    }
            }
        }
 /// <summary>
 /// Gfs the filter_ display filter value.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 void gfFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
 {
     switch ( e.Key )
     {
         case "Date Range":
             {
                 e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
                 break;
             }
         case "Status":
             {
                 var status = e.Value.ConvertToEnumOrNull<ContentChannelItemStatus>();
                 if (status.HasValue)
                 {
                     {
                         e.Value = status.ConvertToString();
                     }
                 }
                 break;
             }
         case "Title":
             {
                 break;
             }
         default:
             {
                 e.Value = string.Empty;
                 break;
             }
     }
 }
Example #30
0
 /// <summary>
 /// Fs the registrations_ display filter value.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected void fRegistrations_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
 {
     switch ( e.Key )
     {
         case "Date Range":
             {
                 e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
                 break;
             }
         case "Payment Status":
         case "RegisteredBy First Name":
         case "RegisteredBy Last Name":
         case "Registrant First Name":
         case "Registrant Last Name":
             {
                 break;
             }
         default:
             {
                 e.Value = string.Empty;
                 break;
             }
     }
 }