Ejemplo n.º 1
0
        /// <summary>
        /// Sets the chart style.
        /// </summary>
        /// <param name="chartStyleDefinedValueGuid">The chart style defined value unique identifier.</param>
        public void SetChartStyle( Guid? chartStyleDefinedValueGuid )
        {
            ChartStyle chartStyle = null;
            if ( chartStyleDefinedValueGuid.HasValue )
            {
                var rockContext = new Rock.Data.RockContext();
                var definedValue = new DefinedValueService( rockContext ).Get( chartStyleDefinedValueGuid.Value );
                if ( definedValue != null )
                {
                    definedValue.LoadAttributes( rockContext );
                    chartStyle = ChartStyle.CreateFromJson( definedValue.Value, definedValue.GetAttributeValue( "ChartStyle" ) );
                }
            }

            SetChartStyle( chartStyle ?? new ChartStyle() );
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the RowSelected event of the gLinks control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param>
        protected void gLinks_RowSelected( object sender, RowEventArgs e )
        {
            dlgLink.Title = "Edit Link";

            using ( var rockContext = new RockContext() )
            {
                var dv = new DefinedValueService( rockContext ).Get( e.RowKeyId );
                if ( dv != null )
                {
                    dv.LoadAttributes();
                    bool isLink = dv.GetAttributeValue( "IsLink" ).AsBoolean( true );

                    hfDefinedValueId.Value = dv.Id.ToString(); ;
                    tbTitle.Text = dv.Value;
                    rblLinkType.SelectedValue = isLink ? "Link" : "Heading";
                    tbLink.Text = dv.Description;
                    tbLink.Visible = isLink;

                    ShowDialog( "Link", true );
                }
            }
        }