Helps generate Bootstrap Description List HTML (
...
)
示例#1
0
        /// <summary>
        /// Shows the detail of the exception
        /// </summary>
        /// <param name="exceptionId">The exception identifier.</param>
        public void ShowDetail( int exceptionId )
        {
            ExceptionLog baseException = null;

            if ( exceptionId != 0 )
            {
                baseException = new ExceptionLogService( new RockContext() ).Get( exceptionId );
            }

            //set fields
            if ( baseException == null )
            {
                pnlSummary.Visible = false;
                return;
            }

            // set page title
            lPageTitle.Text = String.Format("Exception Overview").FormatAsHtmlTitle();

            DescriptionList dl = new DescriptionList();

            dl.Add( "Site", baseException.Site != null ? baseException.Site.Name : String.Empty, true );
            if ( baseException.Page != null || !string.IsNullOrWhiteSpace(baseException.PageUrl) )
            {
                dl.Add( "Page", string.Format( "{0} <a href=\"{1}\" class=\"btn btn-link btn-xs\" target=\"_blank\">Visit Page</a>", baseException.Page != null ? baseException.Page.InternalName : baseException.PageUrl.EncodeHtml(), baseException.PageUrl.EncodeHtml() ) );
            }

            //If query string is not empty build query string list
            if ( !String.IsNullOrWhiteSpace( baseException.QueryString ) )
            {
                dl.Add( "Query String", BuildQueryStringList( baseException.QueryString.EncodeHtml() ) );
            }

            if (baseException.CreatedByPersonAlias != null &&  baseException.CreatedByPersonAlias.Person != null)
            {
                dl.Add( "User", baseException.CreatedByPersonAlias.Person.FullName );
            }

            if ( baseException.CreatedDateTime.HasValue )
            {
                dl.Add( "Exception Date", string.Format( "{0:g}", baseException.CreatedDateTime.Value ) );
            }

            lExceptionSummary.Text = dl.Html;

            lCookies.Text = baseException.Cookies;
            lServerVariables.Text = baseException.ServerVariables;
            lFormData.Text = baseException.Form;
            btnShowCookies.Visible = !string.IsNullOrWhiteSpace( baseException.Cookies );
            btnShowVariables.Visible = !string.IsNullOrWhiteSpace( baseException.ServerVariables );
            btnShowFormData.Visible = !string.IsNullOrWhiteSpace( baseException.Form );

            rptExcpetionDetails.DataSource = GetExceptionLogs( baseException ).OrderBy( e => e.Id );
            rptExcpetionDetails.DataBind();

            pnlSummary.Visible = true;
        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="account">The account.</param>
        private void ShowReadonlyDetails( FinancialAccount account )
        {
            SetEditMode( false );

            hfAccountId.SetValue( account.Id );
            lActionTitle.Text = account.Name.FormatAsHtmlTitle();
            hlInactive.Visible = !account.IsActive;
            lAccountDescription.Text = account.Description;

            DescriptionList descriptionList = new DescriptionList();
            descriptionList.Add( string.Empty, string.Empty );
            lblMainDetails.Text = descriptionList.Html;
        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="marketingCampaign">The marketing campaign.</param>
        private void ShowReadonlyDetails( MarketingCampaign marketingCampaign )
        {
            SetEditMode( false );

            // set title.text value even though it is hidden so that Ad Edit can get the title of the campaign
            tbTitle.Text = marketingCampaign.Title;

            string contactInfo = string.Format( "{0}<br>{1}<br>{2}", marketingCampaign.ContactFullName, marketingCampaign.ContactEmail, marketingCampaign.ContactPhoneNumber );
            contactInfo = string.IsNullOrWhiteSpace( contactInfo.Replace( "<br>", string.Empty ) ) ? None.TextHtml : contactInfo;

            string eventGroupHtml = null;
            /*
             * -- Hide until we implement Marketing Events

            string eventPageGuid = this.GetAttributeValue( "EventPage" );

            if ( marketingCampaign.EventGroup != null )
            {
                eventGroupHtml = marketingCampaign.EventGroup.Name;

                if ( !string.IsNullOrWhiteSpace( eventPageGuid ) )
                {
                    var page = new PageService( new RockContext() ).Get( new Guid( eventPageGuid ) );

                    Dictionary<string, string> queryString = new Dictionary<string, string>();
                    queryString.Add( "groupId", marketingCampaign.EventGroupId.ToString() );
                    string eventGroupUrl = new PageReference( page.Id, 0, queryString ).BuildUrl();
                    eventGroupHtml = string.Format( "<a href='{0}'>{1}</a>", eventGroupUrl, marketingCampaign.EventGroup.Name );
                }
            }
            */

            string primaryAudiences = marketingCampaign.MarketingCampaignAudiences.Where( a => a.IsPrimary ).Select( a => a.Name ).OrderBy( a => a ).ToList().AsDelimited( "<br>" );
            primaryAudiences = marketingCampaign.MarketingCampaignAudiences.Where( a => a.IsPrimary ).Count() == 0 ? None.TextHtml : primaryAudiences;

            string secondaryAudiences = marketingCampaign.MarketingCampaignAudiences.Where( a => !a.IsPrimary ).Select( a => a.Name ).OrderBy( a => a ).ToList().AsDelimited( "<br>" );
            secondaryAudiences = marketingCampaign.MarketingCampaignAudiences.Where( a => !a.IsPrimary ).Count() == 0 ? None.TextHtml : secondaryAudiences;

            lCampaignTitle.Text = marketingCampaign.Title.FormatAsHtmlTitle();

            DescriptionList descriptionListCol1 = new DescriptionList()
                .Add("Contact", contactInfo);

            if (eventGroupHtml != null)
            {
                descriptionListCol1.Add("Linked Event", eventGroupHtml);
            }

            lDetailsCol1.Text = descriptionListCol1.Html;

            DescriptionList descriptionListCol2 = new DescriptionList()
                .Add("Primary Audience", primaryAudiences)
                .Add("Secondary Audience", secondaryAudiences);

            lDetailsCol2.Text = descriptionListCol2.Html;

            lCampusLabels.Text = string.Empty;
            foreach (var campus in marketingCampaign.MarketingCampaignCampuses.Select(a => a.Campus.Name).OrderBy(a => a).ToList())
            {
                lCampusLabels.Text += "<span class='label label-campus'>" + campus + "</span> ";
            }
        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="group">The group.</param>
        private void ShowReadonlyDetails( GroupType groupType )
        {
            SetEditMode( false );

            hfGroupTypeId.SetValue( groupType.Id );
            lReadOnlyTitle.Text = groupType.Name.FormatAsHtmlTitle();
            if ( groupType.GroupTypePurposeValue != null )
            {
                hlType.Text = groupType.GroupTypePurposeValue.Value;
                hlType.Visible = true;
            }
            else
            {
                hlType.Visible = false;
            }

            lGroupTypeDescription.Text = groupType.Description;

            DescriptionList descriptionList = new DescriptionList();
            descriptionList.Add( string.Empty, string.Empty );
            lblMainDetails.Text = descriptionList.Html;
        }
示例#5
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="dataView">The data view.</param>
        private void ShowReadonlyDetails( DataView dataView )
        {
            SetEditMode( false );
            hfDataViewId.SetValue( dataView.Id );
            lReadOnlyTitle.Text = dataView.Name.FormatAsHtmlTitle();

            lDescription.Text = dataView.Description;

            DescriptionList descriptionListMain = new DescriptionList();

            if ( dataView.EntityType != null )
            {
                descriptionListMain.Add( "Applies To", dataView.EntityType.FriendlyName );
            }

            if ( dataView.Category != null )
            {
                descriptionListMain.Add( "Category", dataView.Category.Name );
            }

            if ( dataView.TransformEntityType != null )
            {
                descriptionListMain.Add( "Post-filter Transformation", dataView.TransformEntityType.FriendlyName );
            }

            lblMainDetails.Text = descriptionListMain.Html;

            DescriptionList descriptionListFilters = new DescriptionList();

            if (dataView.DataViewFilter != null && dataView.EntityTypeId.HasValue)
            {
                descriptionListFilters.Add("Filter", dataView.DataViewFilter.ToString(EntityTypeCache.Read(dataView.EntityTypeId.Value).GetEntityType()));
            }
            lFilters.Text = descriptionListFilters.Html;

            ShowReport( dataView );
        }
        /// <summary>
        /// Shows the summary.
        /// </summary>
        /// <param name="business">The business.</param>
        private void ShowSummary( int businessId )
        {
            SetEditMode( false );
            hfBusinessId.SetValue( businessId );
            lTitle.Text = "View Business".FormatAsHtmlTitle();

            var business = new PersonService( new RockContext() ).Get( businessId );
            if ( business != null )
            {
                lDetailsLeft.Text = new DescriptionList()
                    .Add( "Business Name", business.LastName )
                    .Add( "Campus", business.GivingGroup.Campus )
                    .Add( "Record Status", business.RecordStatusValue )
                    .Add( "Record Status Reason", business.RecordStatusReasonValue )
                    .Html;

                var detailsRight = new DescriptionList();

                // Get address
                var workLocationType = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_WORK.AsGuid() );
                if ( workLocationType != null )
                {
                    if ( business.GivingGroup != null ) // Giving Group is a shortcut to Family Group for business
                    {
                        var location = business.GivingGroup.GroupLocations
                            .Where( gl => gl.GroupLocationTypeValueId == workLocationType.Id )
                            .Select( gl => gl.Location )
                            .FirstOrDefault();
                        if ( location != null )
                        {
                            detailsRight.Add( "Address", location.GetFullStreetAddress().ConvertCrLfToHtmlBr() );
                        }
                    }
                }

                var workPhoneType = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_WORK.AsGuid() );
                if ( workPhoneType != null )
                {
                    var phoneNumber = business.PhoneNumbers.FirstOrDefault( n => n.NumberTypeValueId == workPhoneType.Id );
                    if ( phoneNumber != null )
                    {
                        detailsRight.Add( "Phone Number", phoneNumber.ToString() );
                    }
                }

                lDetailsRight.Text = detailsRight
                    .Add( "Email Address", business.Email )
                    .Html;
            }
        }
示例#7
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="groupType">The groupType.</param>
        private void ShowReadonlyDetails( GroupType groupType )
        {
            SetEditMode( false );

            if ( groupType != null )
            {
                hfGroupTypeId.SetValue( groupType.Id );
                lReadOnlyTitle.Text = groupType.ToString().FormatAsHtmlTitle();

                lDescription.Text = groupType.Description;

                groupType.LoadAttributes();

                hlType.Text = groupType.GetAttributeValue( "CheckInType" );
                hlType.Visible = true;

                DescriptionList mainDetailsDescList = new DescriptionList();
                DescriptionList leftDetailsDescList = new DescriptionList();
                DescriptionList rightDetailsDescList = new DescriptionList();

                string scheduleList = string.Empty;
                using ( var rockContext = new RockContext() )
                {
                    var descendantGroupTypeIds = new GroupTypeService( rockContext ).GetAllAssociatedDescendents( groupType.Id ).Select( a => a.Id );
                    scheduleList = new GroupLocationService( rockContext )
                        .Queryable().AsNoTracking()
                        .Where( a =>
                            a.Group.GroupType.Id == groupType.Id ||
                            descendantGroupTypeIds.Contains( a.Group.GroupTypeId ) )
                        .SelectMany( a => a.Schedules )
                        .Select( s => s.Name )
                        .Distinct()
                        .OrderBy( s => s )
                        .ToList()
                        .AsDelimited( ", " );
                }

                if ( !string.IsNullOrWhiteSpace( scheduleList ) )
                {
                    mainDetailsDescList.Add( "Scheduled Times", scheduleList );
                }

                groupType.LoadAttributes();

                if ( groupType.AttributeValues.ContainsKey( "core_checkin_CheckInType" ) )
                {
                    leftDetailsDescList.Add( "Check-in Type", groupType.AttributeValues["core_checkin_CheckInType"].ValueFormatted );
                }
                if ( groupType.AttributeValues.ContainsKey( "core_checkin_SecurityCodeLength" ) )
                {
                    leftDetailsDescList.Add( "Security Code Length", groupType.AttributeValues["core_checkin_SecurityCodeLength"].ValueFormatted );
                }
                if ( groupType.AttributeValues.ContainsKey( "core_checkin_SearchType" ) )
                {
                    rightDetailsDescList.Add( "Search Type", groupType.AttributeValues["core_checkin_SearchType"].ValueFormatted );
                }
                if ( groupType.AttributeValues.ContainsKey( "core_checkin_PhoneSearchType" ) )
                {
                    rightDetailsDescList.Add( "Phone Number Compare", groupType.AttributeValues["core_checkin_PhoneSearchType"].ValueFormatted );
                }

                lblMainDetails.Text = mainDetailsDescList.Html;
                lblLeftDetails.Text = leftDetailsDescList.Html;
                lblRightDetails.Text = rightDetailsDescList.Html;
            }
        }
示例#8
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="event">The event.</param>
        private void ShowReadonlyDetails( FollowingEventType followingEvent )
        {
            SetEditMode( false );

            lActionTitle.Text = followingEvent.Name.FormatAsHtmlTitle();
            hlInactive.Visible = !followingEvent.IsActive;
            lEventDescription.Text = followingEvent.Description;

            DescriptionList descriptionList = new DescriptionList();

            if ( followingEvent.EntityType != null )
            {
                descriptionList.Add( "Event Type", followingEvent.EntityType.Name );
            }

            descriptionList.Add( "Require Notification", followingEvent.IsNoticeRequired ? "Yes" : "No" );
            descriptionList.Add( "Send Weekend Notices on Friday", followingEvent.SendOnWeekends ? "No" : "Yes" );

            lblMainDetails.Text = descriptionList.Html;
        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="mergeTemplate">The merge template.</param>
        private void ShowReadonlyDetails( MergeTemplate mergeTemplate )
        {
            SetEditMode( false );
            hfMergeTemplateId.SetValue( mergeTemplate.Id );
            lReadOnlyTitle.Text = mergeTemplate.Name.FormatAsHtmlTitle();

            var getFileUrl = string.Format(
                "{0}GetFile.ashx?guid={1}",
                System.Web.VirtualPathUtility.ToAbsolute( "~" ),
                mergeTemplate.TemplateBinaryFile != null ? mergeTemplate.TemplateBinaryFile.Guid : (Guid?)null );

            DescriptionList descriptionListCol1 = new DescriptionList()
                .Add( "Template File", string.Format( "<a href='{0}'>{1}</a>", getFileUrl, mergeTemplate.TemplateBinaryFile.FileName ) )
                .Add( "Description", mergeTemplate.Description ?? string.Empty )
                .Add( "Type", mergeTemplate.MergeTemplateTypeEntityType );

            DescriptionList descriptionListCol2 = new DescriptionList()
                .Add( "Category", mergeTemplate.Category != null ? mergeTemplate.Category.Name : string.Empty )
                .Add( "Person", mergeTemplate.PersonAlias, false );

            lblMainDetailsCol1.Text = descriptionListCol1.Html;
            lblMainDetailsCol2.Text = descriptionListCol2.Html;
        }
示例#10
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="group">The group.</param>
        private void ShowReadonlyDetails( Group group )
        {
            SetEditMode( false );

            string groupIconHtml = !string.IsNullOrWhiteSpace( group.GroupType.IconCssClass ) ?
                groupIconHtml = string.Format( "<i class='{0}' ></i>", group.GroupType.IconCssClass ) : "";

            hfGroupId.SetValue( group.Id );
            lGroupIconHtml.Text = groupIconHtml;
            lReadOnlyTitle.Text = group.Name.FormatAsHtmlTitle();

            hlInactive.Visible = !group.IsActive;
            hlType.Text = group.GroupType.Name;

            lGroupDescription.Text = group.Description;

            DescriptionList descriptionList = new DescriptionList();

            if ( group.ParentGroup != null )
            {
                descriptionList.Add( "Parent Group", group.ParentGroup.Name );
            }

            if ( group.Campus != null )
            {
                hlCampus.Visible = true;
                hlCampus.Text = group.Campus.Name;
            }
            else
            {
                hlCampus.Visible = false;
            }


            lblMainDetails.Text = descriptionList.Html;

            var attributes = new List<Rock.Web.Cache.AttributeCache>();

            // Get the attributes inherited from group type
            GroupType groupType = new GroupTypeService().Get( group.GroupTypeId );
            groupType.LoadAttributes();
            attributes = groupType.Attributes.Select( a => a.Value ).OrderBy( a => a.Order ).ThenBy( a => a.Name ).ToList();

            // Combine with the group attributes
            group.LoadAttributes();
            attributes.AddRange( group.Attributes.Select( a => a.Value ).OrderBy( a => a.Order ).ThenBy( a => a.Name ) );

            // display attribute values
            var attributeCategories = Helper.GetAttributeCategories( attributes );
            Rock.Attribute.Helper.AddDisplayControls( group, attributeCategories, phAttributes );

            // Get all the group locations and group all those that have a geo-location into either points or polygons
            var points = new List<GroupLocation>();
            var polygons = new List<GroupLocation>();
            foreach ( GroupLocation groupLocation in group.GroupLocations )
            {
                if ( groupLocation.Location != null )
                {
                    if ( groupLocation.Location.GeoPoint != null )
                    {
                        points.Add( groupLocation );
                    }
                    else if ( groupLocation.Location.GeoFence != null )
                    {
                        polygons.Add( groupLocation );
                    }
                }
            }

            var dict = new Dictionary<string, object>();
            if ( points.Any() )
            {
                var pointsList = new List<Dictionary<string, object>>();
                foreach ( var groupLocation in points)
                {
                    var pointsDict = new Dictionary<string, object>();
                    if ( groupLocation.GroupLocationTypeValue != null )
                    {
                        pointsDict.Add( "type", groupLocation.GroupLocationTypeValue.Name );
                    }
                    pointsDict.Add( "latitude", groupLocation.Location.GeoPoint.Latitude );
                    pointsDict.Add( "longitude", groupLocation.Location.GeoPoint.Longitude );
                    pointsList.Add( pointsDict );
                }
                dict.Add( "points", pointsList );
            }

            if ( polygons.Any() )
            {
                var polygonsList = new List<Dictionary<string, object>>();
                foreach ( var groupLocation in polygons )
                {
                    var polygonDict = new Dictionary<string, object>();
                    if ( groupLocation.GroupLocationTypeValue != null )
                    {
                        polygonDict.Add( "type", groupLocation.GroupLocationTypeValue.Name );
                    }
                    polygonDict.Add( "polygon_wkt", groupLocation.Location.GeoFence.AsText());
                    polygonDict.Add( "google_encoded_polygon", groupLocation.Location.EncodeGooglePolygon() );
                    polygonsList.Add( polygonDict );
                }
                dict.Add( "polygons", polygonsList );
            }

            phMaps.Controls.Clear();
            phMaps.Controls.Add( new LiteralControl( GetAttributeValue( "MapHTML" ).ResolveMergeFields( dict ) ) );

            btnSecurity.Visible = group.IsAuthorized( "Administrate", CurrentPerson );
            btnSecurity.Title = group.Name;
            btnSecurity.EntityId = group.Id;

        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="signatureDocument">Type of the defined.</param>
        private void ShowReadonlyDetails( SignatureDocument signatureDocument )
        {
            SetEditMode( false );

            hfSignatureDocumentId.SetValue( signatureDocument.Id );

            lTitle.Text = signatureDocument.Name.FormatAsHtmlTitle();

            var lDetails = new DescriptionList();
            var rDetails = new DescriptionList();

            if ( signatureDocument.BinaryFile != null )
            {
                var getFileUrl = string.Format( "{0}GetFile.ashx?guid={1}", System.Web.VirtualPathUtility.ToAbsolute( "~" ), signatureDocument.BinaryFile.Guid );
                lDetails.Add( "Document", string.Format( "<a href='{0}'>View</a>", getFileUrl ) );
            }

            lDetails.Add( "Document Key", signatureDocument.DocumentKey );

            if ( signatureDocument.LastInviteDate.HasValue )
            {
                lDetails.Add( "Last Request Date", string.Format( "<span title='{0}'>{1}</span>", signatureDocument.LastInviteDate.Value.ToString(), signatureDocument.LastInviteDate.Value.ToElapsedString() ) );
            }

            if ( signatureDocument.AppliesToPersonAlias != null && signatureDocument.AppliesToPersonAlias.Person != null )
            {
                rDetails.Add( "Applies To", signatureDocument.AppliesToPersonAlias.Person.FullName );
            }

            if ( signatureDocument.AssignedToPersonAlias != null && signatureDocument.AssignedToPersonAlias.Person != null )
            {
                rDetails.Add( "Assigned To", signatureDocument.AssignedToPersonAlias.Person.FullName );
            }

            if ( signatureDocument.SignedByPersonAlias != null && signatureDocument.SignedByPersonAlias.Person != null )
            {
                rDetails.Add( "Signed By", signatureDocument.SignedByPersonAlias.Person.FullName );
            }

            if ( signatureDocument.SignatureDocumentTemplate != null )
            {
                lDetails.Add( "Signature Document Type", signatureDocument.SignatureDocumentTemplate.Name );
            }

            lLeftDetails.Text = lDetails.Html;
            lRightDetails.Text = rDetails.Html;
        }
示例#12
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="prayerRequest">The prayer request.</param>
        private void ShowReadonlyDetails( PrayerRequest prayerRequest )
        {
            SetEditMode( false );
            lActionTitle.Text = string.Format( "{0} Prayer Request", prayerRequest.FullName ).FormatAsHtmlTitle();

            DescriptionList descriptionList = new DescriptionList();
            if ( prayerRequest.RequestedByPersonAlias != null )
            {
                descriptionList.Add( "Requested By", prayerRequest.RequestedByPersonAlias.Person.FullName );
            }

            descriptionList.Add( "Name", prayerRequest.FullName );
            descriptionList.Add( "Request", prayerRequest.Text.ScrubHtmlAndConvertCrLfToBr() );
            descriptionList.Add( "Answer", prayerRequest.Answer.ScrubHtmlAndConvertCrLfToBr() );
            lMainDetails.Text = descriptionList.Html;

            ShowStatus( prayerRequest, this.CurrentPerson, hlblFlaggedMessageRO );
            ShowPrayerCount( prayerRequest );

            hlblUrgent.Visible = prayerRequest.IsUrgent ?? false;
        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="metric">The metric.</param>
        private void ShowReadonlyDetails( Metric metric )
        {
            SetEditMode( false );
            hfMetricId.SetValue( metric.Id );
            lReadOnlyTitle.Text = metric.Title.FormatAsHtmlTitle();

            DescriptionList descriptionListMain = new DescriptionList();

            descriptionListMain.Add( "Subtitle", metric.Subtitle );
            descriptionListMain.Add( "Description", metric.Description );

            if ( metric.MetricCategories != null && metric.MetricCategories.Any() )
            {
                descriptionListMain.Add( "Categories", metric.MetricCategories.Select( s => s.Category.ToString() ).OrderBy( o => o ).ToList().AsDelimited( "," ) );
            }

            lblMainDetails.Text = descriptionListMain.Html;
        }
示例#14
0
        /// <summary>
        /// Shows the detail of the exception
        /// </summary>
        /// <param name="itemKey">Item Key (should be ExceptionId in this instance).</param>
        /// <param name="itemKeyValue">Item key value (should be ExceptionId).</param>
        public void ShowDetail( string itemKey, int itemKeyValue )
        {
            //if item key is not ExceptionId return
            if ( !itemKey.Equals( "ExceptionId" ) )
            {
                return;
            }

            //Get exception
            var baseException = new ExceptionLogService().Get( itemKeyValue );

            //set fields
            if ( baseException == null )
            {
                return;
            }

            DescriptionList dl = new DescriptionList();

            dl.Add( "Site", baseException.Site != null ? baseException.Site.Name : String.Empty, true );
            dl.Add( "Page", baseException.Page != null ? string.Format( "{0} <a href=\"{1}\" class=\"btn btn-mini\" target=\"_blank\"><i class=\"fa fa-arrow-right\"></i></a>", baseException.Page.InternalName, baseException.PageUrl ) : String.Empty, true );

            //If query string is not empty build query string list
            if ( !String.IsNullOrWhiteSpace( baseException.QueryString ) )
            {
                dl.Add( "Query String", BuildQueryStringList( baseException.QueryString ) );
            }


            dl.Add( "User", baseException.CreatedByPersonId != null ? baseException.CreatedByPerson.FullName : "Anonymous" );
            dl.Add( "Exception Date", string.Format( "{0:g}", baseException.ExceptionDateTime ) );
            lExceptionSummary.Text = dl.Html;

            lCookies.Text = baseException.Cookies;
            lServerVariables.Text = baseException.ServerVariables;

            //check to see if Show Cookies attribute is true
            if( Convert.ToBoolean( GetAttributeValue( "ShowCookies" ) ) )
            {
                //if so check check box and register script to show cookies div
                chkShowCookies.Checked = true;
                ScriptManager.RegisterStartupScript( upExcpetionDetail, upExcpetionDetail.GetType(), "ShowCookiesOnLoad" + DateTime.Now.Ticks, "$(\"#divCookies\").css(\"display\", \"inherit\");", true );
            }
            else
            {
                chkShowCookies.Checked = false;
            }

            //check to see if show server variables attribute is checked
            if ( Convert.ToBoolean( GetAttributeValue( "ShowServerVariables" ) ) )
            {
                chkShowServerVariables.Checked = true;
                ScriptManager.RegisterStartupScript( upExcpetionDetail, upExcpetionDetail.GetType(), "ShowServerVariablesOnLoad" + DateTime.Now.Ticks, "$(\"#divServerVariables\").css(\"display\", \"inherit\");", true );
            }
            else
            {
                chkShowServerVariables.Checked = false;
            }

            rptExcpetionDetails.DataSource = GetExceptionLogs( baseException ).OrderBy( e => e.Id );
            rptExcpetionDetails.DataBind();

            pnlSummary.Visible = true;
        }
示例#15
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="metric">The metric.</param>
        private void ShowReadonlyDetails( Metric metric )
        {
            SetEditMode( false );
            hfMetricId.SetValue( metric.Id );

            lcMetricsChart.Visible = GetAttributeValue( "ShowChart" ).AsBooleanOrNull() ?? true;

            var chartDateRange = SlidingDateRangePicker.CalculateDateRangeFromDelimitedValues( GetAttributeValue( "SlidingDateRange" ) ?? "-1||" );
            lcMetricsChart.StartDate = chartDateRange.Start;
            lcMetricsChart.EndDate = chartDateRange.End;
            lcMetricsChart.MetricId = metric.Id;
            lcMetricsChart.CombineValues = GetAttributeValue( "CombineChartSeries" ).AsBooleanOrNull() ?? false;

            lReadOnlyTitle.Text = metric.Title.FormatAsHtmlTitle();

            DescriptionList descriptionListMain = new DescriptionList();

            descriptionListMain.Add( "Subtitle", metric.Subtitle );
            descriptionListMain.Add( "Description", metric.Description );

            if ( metric.MetricCategories != null && metric.MetricCategories.Any() )
            {
                descriptionListMain.Add( "Categories", metric.MetricCategories.Select( s => s.Category.ToString() ).OrderBy( o => o ).ToList().AsDelimited( "," ) );
            }

            if ( metric.MetricPartitions.Count() == 1 )
            {
                var singlePartition = metric.MetricPartitions.First();
                if ( singlePartition.EntityTypeId.HasValue )
                {
                    var entityTypeCache = EntityTypeCache.Read( singlePartition.EntityTypeId.Value );
                    if ( entityTypeCache != null )
                    {
                        descriptionListMain.Add( "Partitioned by ", singlePartition.Label ?? entityTypeCache.FriendlyName );
                    }
                }
            }
            else if ( metric.MetricPartitions.Count() > 1 )
            {
                var partitionNameList = metric.MetricPartitions.OrderBy( a => a.Order ).ThenBy( a => a.Label ).Where( a => a.EntityTypeId.HasValue ).ToList().Select( a => {
                    var entityTypeCache = EntityTypeCache.Read( a.EntityTypeId.Value );
                    return new
                    {
                        Label = a.Label,
                        EntityTypeFriendlyName = entityTypeCache != null ? entityTypeCache.FriendlyName : string.Empty
                    };
                });

                descriptionListMain.Add( "Partitioned by ", partitionNameList.Where( a => a != null ).Select( a => a.Label ?? a.EntityTypeFriendlyName ).ToList().AsDelimited( ", ", " and " ) );
            }

            // only show LastRun and Schedule label if SourceValueType is not Manual
            int manualSourceType = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.METRIC_SOURCE_VALUE_TYPE_MANUAL.AsGuid() ).Id;
            ltLastRunDateTime.Visible = metric.SourceValueTypeId != manualSourceType;
            hlScheduleFriendlyText.Visible = metric.SourceValueTypeId != manualSourceType;

            if ( metric.LastRunDateTime != null )
            {
                ltLastRunDateTime.LabelType = LabelType.Success;
                ltLastRunDateTime.Text = "Last Run: " + metric.LastRunDateTime.ToString();
            }
            else
            {
                ltLastRunDateTime.LabelType = LabelType.Warning;
                ltLastRunDateTime.Text = "Never Run";
            }

            if ( metric.Schedule != null )
            {
                string iconClass;
                if ( metric.Schedule.HasSchedule() )
                {
                    if ( metric.Schedule.HasScheduleWarning() )
                    {
                        hlScheduleFriendlyText.LabelType = LabelType.Warning;
                        iconClass = "fa fa-exclamation-triangle";
                    }
                    else
                    {
                        hlScheduleFriendlyText.LabelType = LabelType.Info;
                        iconClass = "fa fa-clock-o";
                    }
                }
                else
                {
                    hlScheduleFriendlyText.LabelType = LabelType.Danger;
                    iconClass = "fa fa-exclamation-triangle";
                }

                hlScheduleFriendlyText.Text = "<i class='" + iconClass + "'></i> " + metric.Schedule.FriendlyScheduleText;
            }
            else
            {
                hlScheduleFriendlyText.LabelType = LabelType.Danger;
                hlScheduleFriendlyText.Text = "<i class='fa fa-clock-o'></i> " + "Not Scheduled";
            }

            lblMainDetails.Text = descriptionListMain.Html;
        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="group">The group.</param>
        private void ShowReadonlyDetails( Group group )
        {
            SetEditMode( false );
            var rockContext = new RockContext();

            string groupIconHtml = !string.IsNullOrWhiteSpace( group.GroupType.IconCssClass ) ?
                groupIconHtml = string.Format( "<i class='{0}' ></i>", group.GroupType.IconCssClass ) : string.Empty;

            hfGroupId.SetValue( group.Id );
            lGroupIconHtml.Text = groupIconHtml;
            lReadOnlyTitle.Text = group.Name.FormatAsHtmlTitle();

            hlInactive.Visible = !group.IsActive;
            hlType.Text = group.GroupType.Name;

            lGroupDescription.Text = group.Description;

            DescriptionList descriptionList = new DescriptionList();

            if ( group.ParentGroup != null )
            {
                descriptionList.Add( "Parent Group", group.ParentGroup.Name );
            }

            if ( group.Campus != null )
            {
                hlCampus.Visible = true;
                hlCampus.Text = group.Campus.Name;
            }
            else
            {
                hlCampus.Visible = false;
            }

            lblMainDetails.Text = descriptionList.Html;

            var attributes = new List<Rock.Web.Cache.AttributeCache>();

            // Get the attributes inherited from group type
            GroupType groupType = new GroupTypeService( rockContext ).Get( group.GroupTypeId );
            groupType.LoadAttributes();
            attributes = groupType.Attributes.Select( a => a.Value ).OrderBy( a => a.Order ).ThenBy( a => a.Name ).ToList();

            // Combine with the group attributes
            group.LoadAttributes();
            attributes.AddRange( group.Attributes.Select( a => a.Value ).OrderBy( a => a.Order ).ThenBy( a => a.Name ) );

            // display attribute values
            var attributeCategories = Helper.GetAttributeCategories( attributes );
            Rock.Attribute.Helper.AddDisplayControls( group, attributeCategories, phAttributes );

            // Get Map Style
            phMaps.Controls.Clear();
            var mapStyleValue = DefinedValueCache.Read( GetAttributeValue( "MapStyle" ) );
            if ( mapStyleValue == null )
            {
                mapStyleValue = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.MAP_STYLE_ROCK );
            }

            if ( mapStyleValue != null )
            {
                string mapStyle = mapStyleValue.GetAttributeValue( "StaticMapStyle" );

                if ( !string.IsNullOrWhiteSpace( mapStyle ) )
                {
                    // Get all the group locations and group all those that have a geo-location into either points or polygons
                    var points = new List<GroupLocation>();
                    var polygons = new List<GroupLocation>();
                    foreach ( GroupLocation groupLocation in group.GroupLocations )
                    {
                        if ( groupLocation.Location != null )
                        {
                            if ( groupLocation.Location.GeoPoint != null )
                            {
                                points.Add( groupLocation );
                            }
                            else if ( groupLocation.Location.GeoFence != null )
                            {
                                polygons.Add( groupLocation );
                            }
                        }
                    }

                    if ( points.Any() )
                    {
                        foreach ( var groupLocation in points )
                        {
                            string markerPoints = string.Format( "{0},{1}", groupLocation.Location.GeoPoint.Latitude, groupLocation.Location.GeoPoint.Longitude );
                            string mapLink = System.Text.RegularExpressions.Regex.Replace( mapStyle, @"\{\s*MarkerPoints\s*\}", markerPoints );
                            mapLink = System.Text.RegularExpressions.Regex.Replace( mapLink, @"\{\s*PolygonPoints\s*\}", string.Empty );
                            mapLink += "&sensor=false&size=350x200&zoom=13&format=png";
                            var literalcontrol = new Literal()
                            {
                                Text = string.Format(
                                "<div class='group-location-map'>{0}<img src='{1}'/></div>",
                                groupLocation.GroupLocationTypeValue != null ? ( "<h4>" + groupLocation.GroupLocationTypeValue.Name + "</h4>" ) : string.Empty,
                                mapLink ),
                                Mode = LiteralMode.PassThrough
                            };
                            phMaps.Controls.Add( literalcontrol );
                        }
                    }

                    if ( polygons.Any() )
                    {
                        foreach ( var groupLocation in polygons )
                        {
                            string polygonPoints = "enc:" + groupLocation.Location.EncodeGooglePolygon();
                            string mapLink = System.Text.RegularExpressions.Regex.Replace( mapStyle, @"\{\s*MarkerPoints\s*\}", string.Empty );
                            mapLink = System.Text.RegularExpressions.Regex.Replace( mapLink, @"\{\s*PolygonPoints\s*\}", polygonPoints );
                            mapLink += "&sensor=false&size=350x200&format=png";
                            phMaps.Controls.Add(
                                new LiteralControl( string.Format(
                                    "<div class='group-location-map'>{0}<img src='{1}'/></div>",
                                    groupLocation.GroupLocationTypeValue != null ? ( "<h4>" + groupLocation.GroupLocationTypeValue.Name + "</h4>" ) : string.Empty,
                                    mapLink ) ) );
                        }
                    }
                }
            }

            btnSecurity.Visible = group.IsAuthorized( Authorization.ADMINISTRATE, CurrentPerson );
            btnSecurity.Title = group.Name;
            btnSecurity.EntityId = group.Id;
        }
示例#17
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="prayerRequest">The prayer request.</param>
        private void ShowReadonlyDetails( PrayerRequest prayerRequest )
        {
            SetEditMode( false );
            lActionTitle.Text = string.Format( "{0} Prayer Request", prayerRequest.FullName ).FormatAsHtmlTitle();

            DescriptionList descriptionList = new DescriptionList();
            descriptionList.Add( "Name", prayerRequest.FullName.SanitizeHtml() );
            descriptionList.Add( "Category", prayerRequest.Category != null ? prayerRequest.Category.Name : string.Empty );
            descriptionList.Add( "Request", prayerRequest.Text.ScrubHtmlAndConvertCrLfToBr() );
            descriptionList.Add( "Answer", prayerRequest.Answer.ScrubHtmlAndConvertCrLfToBr() );
            lMainDetails.Text = descriptionList.Html;

            ShowStatus( prayerRequest, this.CurrentPerson, hlblFlaggedMessageRO );
            ShowPrayerCount( prayerRequest );

            if ( !prayerRequest.IsApproved.HasValue )
            {
                hlblStatus.Visible = true;
                hlblStatus.Text = "Pending Approval";
            }
            else if ( prayerRequest.IsApproved.HasValue && ( !prayerRequest.IsApproved ?? false ) )
            {
                hlblStatus.Visible = true;
                hlblStatus.Text = "Unapproved";
            }

            hlblUrgent.Visible = prayerRequest.IsUrgent ?? false;
        }
示例#18
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="metric">The metric.</param>
        private void ShowReadonlyDetails( Metric metric )
        {
            SetEditMode( false );
            hfMetricId.SetValue( metric.Id );

            lcMetricsChart.Visible = GetAttributeValue( "ShowChart" ).AsBooleanOrNull() ?? true;

            var chartDateRange = SlidingDateRangePicker.CalculateDateRangeFromDelimitedValues( GetAttributeValue( "SlidingDateRange" ) ?? "-1||" );
            lcMetricsChart.StartDate = chartDateRange.Start;
            lcMetricsChart.EndDate = chartDateRange.End;
            lcMetricsChart.MetricId = metric.Id;
            lcMetricsChart.CombineValues = GetAttributeValue( "CombineChartSeries" ).AsBooleanOrNull() ?? false;

            lReadOnlyTitle.Text = metric.Title.FormatAsHtmlTitle();

            DescriptionList descriptionListMain = new DescriptionList();

            descriptionListMain.Add( "Subtitle", metric.Subtitle );
            descriptionListMain.Add( "Description", metric.Description );

            if ( metric.MetricCategories != null && metric.MetricCategories.Any() )
            {
                descriptionListMain.Add( "Categories", metric.MetricCategories.Select( s => s.Category.ToString() ).OrderBy( o => o ).ToList().AsDelimited( "," ) );
            }

            // only show LastRun and Schedule label if SourceValueType is not Manual
            int manualSourceType = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.METRIC_SOURCE_VALUE_TYPE_MANUAL.AsGuid() ).Id;
            ltLastRunDateTime.Visible = metric.SourceValueTypeId != manualSourceType;
            hlScheduleFriendlyText.Visible = metric.SourceValueTypeId != manualSourceType;

            if ( metric.LastRunDateTime != null )
            {
                ltLastRunDateTime.LabelType = LabelType.Success;
                ltLastRunDateTime.Text = "Last Run: " + metric.LastRunDateTime.ToString();
            }
            else
            {
                ltLastRunDateTime.LabelType = LabelType.Warning;
                ltLastRunDateTime.Text = "Never Run";
            }

            if (metric.Schedule != null)
            {
                hlScheduleFriendlyText.LabelType = metric.Schedule.HasSchedule() ? LabelType.Info : LabelType.Danger;
                hlScheduleFriendlyText.Text = "<i class='fa fa-clock-o'></i> " + metric.Schedule.FriendlyScheduleText;
            }
            else
            {
                hlScheduleFriendlyText.LabelType = LabelType.Danger;
                hlScheduleFriendlyText.Text = "<i class='fa fa-clock-o'></i> " + "Not Scheduled";
            }

            lblMainDetails.Text = descriptionListMain.Html;
        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="layout">The layout.</param>
        private void ShowReadonlyDetails( Rock.Model.Layout layout )
        {
            SetEditMode( false );

            hfLayoutId.SetValue( layout.Id );
            lReadOnlyTitle.Text = layout.Name.FormatAsHtmlTitle();

            lLayoutDescription.Text = layout.Description;

            DescriptionList descriptionList = new DescriptionList();
            descriptionList.Add( "Layout File", layout.FileName );
            lblMainDetails.Text = descriptionList.Html;
        }
示例#20
0
        /// <summary>
        /// Shows the read only details.
        /// </summary>
        /// <param name="txn">The TXN.</param>
        private void ShowReadOnlyDetails( FinancialTransaction txn )
        {
            SetEditMode( false );

            if ( txn != null )
            {
                hfTransactionId.Value = txn.Id.ToString();

                SetHeadingInfo( txn );

                string rockUrlRoot = ResolveRockUrl( "/" );

                var detailsLeft = new DescriptionList()
                    .Add( "Person", txn.AuthorizedPerson != null ? txn.AuthorizedPerson.GetAnchorTag( rockUrlRoot ) : string.Empty )
                    .Add( "Amount", ( txn.TransactionDetails.Sum( d => (decimal?)d.Amount ) ?? 0.0M ).ToString( "C2" ) )
                    .Add( "Date/Time", txn.TransactionDateTime.HasValue ? txn.TransactionDateTime.Value.ToString( "g" ) : string.Empty );

                if ( txn.Batch != null )
                {
                    var qryParam = new Dictionary<string, string>();
                    qryParam.Add( "BatchId", txn.Batch.Id.ToString() );
                    string url = LinkedPageUrl( "BatchDetailPage", qryParam );
                    detailsLeft.Add( "Batch", !string.IsNullOrWhiteSpace( url ) ?
                        string.Format( "<a href='{0}'>{1}</a>", url, txn.Batch.Name ) :
                        txn.Batch.Name );
                }

                detailsLeft.Add( "Source", txn.SourceTypeValue != null ? txn.SourceTypeValue.Value : string.Empty );

                if ( txn.GatewayEntityType != null )
                {
                    detailsLeft.Add( "Payment Gateway", Rock.Financial.GatewayContainer.GetComponentName( txn.GatewayEntityType.Name ) );
                }

                detailsLeft.Add( "Transaction Code", txn.TransactionCode );

                if ( txn.ScheduledTransaction != null )
                {
                    var qryParam = new Dictionary<string, string>();
                    qryParam.Add( "ScheduledTransactionId", txn.ScheduledTransaction.Id.ToString() );
                    string url = LinkedPageUrl( "ScheduledTransactionDetailPage", qryParam );
                    detailsLeft.Add( "Scheduled Transaction Id", !string.IsNullOrWhiteSpace( url ) ?
                        string.Format( "<a href='{0}'>{1}</a>", url, txn.ScheduledTransaction.GatewayScheduleId ) :
                        txn.ScheduledTransaction.GatewayScheduleId );
                }

                if ( txn.CurrencyTypeValue != null )
                {
                    string currencyType = txn.CurrencyTypeValue.Value;
                    if ( txn.CurrencyTypeValue.Guid.Equals( Rock.SystemGuid.DefinedValue.CURRENCY_TYPE_CREDIT_CARD.AsGuid() ) )
                    {
                        currencyType += txn.CreditCardTypeValue != null ? ( " - " + txn.CreditCardTypeValue.Value ) : string.Empty;
                    }
                    detailsLeft.Add( "Currency Type", currencyType );
                }

                detailsLeft.Add( "Summary", txn.Summary );

                var modified = new StringBuilder(); ;
                if ( txn.CreatedByPersonAlias != null && txn.CreatedByPersonAlias.Person != null && txn.CreatedDateTime.HasValue )
                {
                    modified.AppendFormat( "Created by {0} on {1} at {2}<br/>", txn.CreatedByPersonAlias.Person.GetAnchorTag( rockUrlRoot ),
                        txn.CreatedDateTime.Value.ToShortDateString(), txn.CreatedDateTime.Value.ToShortTimeString() );
                }
                if ( txn.ProcessedByPersonAlias != null && txn.ProcessedByPersonAlias.Person != null && txn.ProcessedDateTime.HasValue )
                {
                    modified.AppendFormat( "Processed by {0} on {1} at {2}<br/>", txn.ProcessedByPersonAlias.Person.GetAnchorTag( rockUrlRoot ),
                        txn.ProcessedDateTime.Value.ToShortDateString(), txn.ProcessedDateTime.Value.ToShortTimeString() );
                }
                if ( txn.ModifiedByPersonAlias != null && txn.ModifiedByPersonAlias.Person != null && txn.ModifiedDateTime.HasValue )
                {
                    modified.AppendFormat( "Last Modified by {0} on {1} at {2}<br/>", txn.ModifiedByPersonAlias.Person.GetAnchorTag( rockUrlRoot ),
                        txn.ModifiedDateTime.Value.ToShortDateString(), txn.ModifiedDateTime.Value.ToShortTimeString() );
                }
                detailsLeft.Add( "Updates", modified.ToString() );

                lDetailsLeft.Text = detailsLeft.Html;

                gAccountsView.DataSource = txn.TransactionDetails.ToList();
                gAccountsView.DataBind();

                if ( txn.Images.Any() )
                {
                    var primaryImage = txn.Images
                        .OrderBy( i => i.TransactionImageTypeValue.Order )
                        .FirstOrDefault();
                    imgPrimary.ImageUrl = string.Format( "~/GetImage.ashx?id={0}", primaryImage.BinaryFileId );
                    imgPrimary.Visible = true;

                    rptrImages.DataSource = txn.Images
                        .Where( i => !i.Id.Equals( primaryImage.Id ) )
                        .OrderBy( i => i.TransactionImageTypeValue.Order )
                        .ToList();
                    rptrImages.DataBind();
                }
                else
                {
                    imgPrimary.Visible = false;
                }
            }
        }
示例#21
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="dataView">The data view.</param>
        private void ShowReadonlyDetails( DataView dataView )
        {
            SetEditMode( false );
            hfDataViewId.SetValue( dataView.Id );
            lReadOnlyTitle.Text = dataView.Name.FormatAsHtmlTitle();
            hlblDataViewId.Text = "Id: " + dataView.Id.ToString();

            lDescription.Text = dataView.Description;

            DescriptionList descriptionListMain = new DescriptionList();

            if ( dataView.EntityType != null )
            {
                descriptionListMain.Add( "Applies To", dataView.EntityType.FriendlyName );
            }

            if ( dataView.Category != null )
            {
                descriptionListMain.Add( "Category", dataView.Category.Name );
            }

            if ( dataView.TransformEntityType != null )
            {
                descriptionListMain.Add( "Post-filter Transformation", dataView.TransformEntityType.FriendlyName );
            }

            lblMainDetails.Text = descriptionListMain.Html;

            DescriptionList descriptionListFilters = new DescriptionList();

            if ( dataView.DataViewFilter != null && dataView.EntityTypeId.HasValue )
            {
                var entityTypeCache = EntityTypeCache.Read( dataView.EntityTypeId.Value );
                if ( entityTypeCache != null )
                {
                    var entityTypeType = entityTypeCache.GetEntityType();
                    if ( entityTypeType != null )
                    {
                        descriptionListFilters.Add( "Filter", dataView.DataViewFilter.ToString( entityTypeType ) );
                    }
                }
            }

            lFilters.Text = descriptionListFilters.Html;

            DescriptionList descriptionListDataviews = new DescriptionList();
            var dataViewFilterEntityId = EntityTypeCache.Read( typeof( Rock.Reporting.DataFilter.OtherDataViewFilter ) ).Id;

            var rockContext = new RockContext();
            DataViewService dataViewService = new DataViewService( rockContext );

            var dataViews = dataViewService.Queryable()
                .Where( d => d.DataViewFilter.ChildFilters
                    .Any( f => f.Selection == dataView.Id.ToString()
                        && f.EntityTypeId == dataViewFilterEntityId ) );

            StringBuilder sbDataViews = new StringBuilder();
            var dataViewDetailPage = GetAttributeValue( "DataViewDetailPage" );

            foreach ( var dataview in dataViews )
            {
                if ( !string.IsNullOrWhiteSpace( dataViewDetailPage ) )
                {
                    sbDataViews.Append( "<a href=\"" + LinkedPageUrl( "DataViewDetailPage", new Dictionary<string, string>() { { "DataViewId", dataview.Id.ToString() } } ) + "\">" + dataview.Name + "</a><br/>" );
                }
                else
                {
                    sbDataViews.Append( dataview.Name + "<br/>" );
                }
            }

            descriptionListDataviews.Add( "Data Views", sbDataViews );
            lDataViews.Text = descriptionListDataviews.Html;

            DescriptionList descriptionListReports = new DescriptionList();
            StringBuilder sbReports = new StringBuilder();

            ReportService reportService = new ReportService( rockContext );
            var reports = reportService.Queryable().Where( r => r.DataViewId == dataView.Id );
            var reportDetailPage = GetAttributeValue( "ReportDetailPage" );

            foreach ( var report in reports )
            {
                if ( !string.IsNullOrWhiteSpace( reportDetailPage ) )
                {
                    sbReports.Append( "<a href=\"" + LinkedPageUrl( "ReportDetailPage", new Dictionary<string, string>() { { "ReportId", report.Id.ToString() } } ) + "\">" + report.Name + "</a><br/>" );
                }
                else
                {
                    sbReports.Append( report.Name + "<br/>" );
                }
            }

            descriptionListReports.Add( "Reports", sbReports );
            lReports.Text = descriptionListReports.Html;

            ShowReport( dataView );
        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="schedule">The schedule.</param>
        private void ShowReadonlyDetails( Schedule schedule )
        {
            SetEditMode( false );
            hfScheduleId.SetValue( schedule.Id );
            lReadOnlyTitle.Text = schedule.Name.FormatAsHtmlTitle();

            var calendarEvent = schedule.GetCalenderEvent();
            string occurrenceText = string.Empty;
            if ( calendarEvent != null )
            {
                if ( calendarEvent.DTStart != null )
                {
                    var occurrences = calendarEvent.GetOccurrences( RockDateTime.Now, RockDateTime.Now.AddYears( 1 ) );
                    if ( occurrences.Any() )
                    {
                        occurrenceText = GetOccurrenceText( occurrences[0] );
                    }
                }
            }

            DescriptionList descriptionList = new DescriptionList()
                .Add( "Description", schedule.Description ?? string.Empty )
                .Add( "Next Occurrence", occurrenceText )
                .Add( "Category", schedule.Category != null ? schedule.Category.Name : string.Empty );

            if ( schedule.CheckInStartOffsetMinutes.HasValue )
            {
                descriptionList.Add( "Check-in Starts", schedule.CheckInStartOffsetMinutes.Value.ToString() + " minutes before start of schedule" );
            }

            if ( schedule.CheckInEndOffsetMinutes.HasValue )
            {
                descriptionList.Add( "Check-in Ends", schedule.CheckInEndOffsetMinutes.Value.ToString() + " minutes after start of schedule" );
            }

            lblMainDetails.Text = descriptionList.Html;
        }
示例#23
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="mergeTemplate">The merge template.</param>
        private void ShowReadonlyDetails( MergeTemplate mergeTemplate )
        {
            SetEditMode( false );
            hfMergeTemplateId.SetValue( mergeTemplate.Id );
            lReadOnlyTitle.Text = mergeTemplate.Name.FormatAsHtmlTitle();

            DescriptionList descriptionListCol1 = new DescriptionList()
                .Add( "Template File", string.Format( "<a href='{0}'>{1}</a>", mergeTemplate.TemplateBinaryFile.Url, mergeTemplate.TemplateBinaryFile.FileName ) )
                .Add( "Description", mergeTemplate.Description ?? string.Empty )
                .Add( "Type", mergeTemplate.MergeTemplateTypeEntityType );

            DescriptionList descriptionListCol2 = new DescriptionList()
                .Add( "Category", mergeTemplate.Category != null ? mergeTemplate.Category.Name : string.Empty )
                .Add( "Person", mergeTemplate.PersonAlias, false );

            lblMainDetailsCol1.Text = descriptionListCol1.Html;
            lblMainDetailsCol2.Text = descriptionListCol2.Html;
        }
示例#24
0
        /// <summary>
        /// Shows the view.
        /// </summary>
        /// <param name="txn">The TXN.</param>
        private void ShowView( FinancialScheduledTransaction txn )
        {
            if ( txn != null )
            {
                hlStatus.Text = txn.IsActive ? "Active" : "Inactive";
                hlStatus.LabelType = txn.IsActive ? LabelType.Success : LabelType.Danger;

                string rockUrlRoot = ResolveRockUrl( "/" );

                var detailsLeft = new DescriptionList()
                    .Add( "Person", ( txn.AuthorizedPersonAlias != null && txn.AuthorizedPersonAlias.Person != null ) ?
                        txn.AuthorizedPersonAlias.Person.GetAnchorTag( rockUrlRoot ) : string.Empty );

                var detailsRight = new DescriptionList()
                    .Add( "Amount", ( txn.ScheduledTransactionDetails.Sum( d => (decimal?)d.Amount ) ?? 0.0M ).ToString( "C2" ) )
                    .Add( "Frequency", txn.TransactionFrequencyValue != null ? txn.TransactionFrequencyValue.Value : string.Empty )
                    .Add( "Start Date", txn.StartDate.ToShortDateString() )
                    .Add( "End Date", txn.EndDate.HasValue ? txn.EndDate.Value.ToShortDateString() : string.Empty )
                    .Add( "Next Payment Date", txn.NextPaymentDate.HasValue ? txn.NextPaymentDate.Value.ToShortDateString() : string.Empty )
                    .Add( "Last Status Refresh", txn.LastStatusUpdateDateTime.HasValue ? txn.LastStatusUpdateDateTime.Value.ToString( "g" ) : string.Empty );

                if ( txn.FinancialPaymentDetail != null && txn.FinancialPaymentDetail.CurrencyTypeValue != null )
                {
                    string currencyType = txn.FinancialPaymentDetail.CurrencyTypeValue.Value;
                    if ( txn.FinancialPaymentDetail.CurrencyTypeValue.Guid.Equals( Rock.SystemGuid.DefinedValue.CURRENCY_TYPE_CREDIT_CARD.AsGuid() ) )
                    {
                        currencyType += txn.FinancialPaymentDetail.CreditCardTypeValue != null ? ( " - " + txn.FinancialPaymentDetail.CreditCardTypeValue.Value ) : string.Empty;
                    }
                    detailsLeft.Add( "Currency Type", currencyType );
                }

                if ( txn.FinancialGateway != null )
                {
                    detailsLeft.Add( "Payment Gateway", Rock.Financial.GatewayContainer.GetComponentName( txn.FinancialGateway.Name ) );
                }

                detailsLeft
                    .Add( "Transaction Code", txn.TransactionCode )
                    .Add( "Schedule Id", txn.GatewayScheduleId );

                lDetailsLeft.Text = detailsLeft.Html;
                lDetailsRight.Text = detailsRight.Html;

                gAccountsView.DataSource = txn.ScheduledTransactionDetails.ToList();
                gAccountsView.DataBind();

                var noteType = NoteTypeCache.Read( Rock.SystemGuid.NoteType.SCHEDULED_TRANSACTION_NOTE.AsGuid() );
                if ( noteType != null )
                {
                    var rockContext = new RockContext();
                    rptrNotes.DataSource = new NoteService( rockContext ).Get( noteType.Id, txn.Id )
                        .Where( n => n.CreatedDateTime.HasValue )
                        .OrderBy( n => n.CreatedDateTime )
                        .ToList()
                        .Select( n => new
                        {
                            n.Caption,
                            Text = n.Text.ConvertCrLfToHtmlBr(),
                            Person = ( n.CreatedByPersonAlias != null && n.CreatedByPersonAlias.Person != null ) ? n.CreatedByPersonAlias.Person.FullName : "",
                            Date = n.CreatedDateTime.HasValue ? n.CreatedDateTime.Value.ToShortDateString() : "",
                            Time = n.CreatedDateTime.HasValue ? n.CreatedDateTime.Value.ToShortTimeString() : ""
                        } )
                        .ToList();
                    rptrNotes.DataBind();
                }
                lbCancelSchedule.Visible = txn.IsActive;
                lbReactivateSchedule.Visible = !txn.IsActive;
            }
        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="group">The group.</param>
        private void ShowReadonlyDetails( Rock.Model.Site site )
        {
            SetEditMode( false );

            hfSiteId.SetValue( site.Id );
            lReadOnlyTitle.Text = site.Name.FormatAsHtmlTitle();

            lSiteDescription.Text = site.Description;

            DescriptionList descriptionList = new DescriptionList();
            descriptionList.Add( "Domain(s)", site.SiteDomains.Select( d=> d.Domain ).ToList().AsDelimited(", "));
            descriptionList.Add( "Theme", site.Theme );
            descriptionList.Add( "Default Page", site.DefaultPageRoute );
            lblMainDetails.Text = descriptionList.Html;
        }
示例#26
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="gateway">The gateway.</param>
        private void ShowReadonlyDetails( FinancialGateway gateway )
        {
            SetEditMode( false );

            lActionTitle.Text = gateway.Name.FormatAsHtmlTitle();
            hlInactive.Visible = !gateway.IsActive;
            lGatewayDescription.Text = gateway.Description;

            DescriptionList descriptionList = new DescriptionList();

            if ( gateway.EntityType != null )
            {
                descriptionList.Add( "Gateway Type", gateway.EntityType.Name );
            }

            var timeSpan = gateway.GetBatchTimeOffset();
            if ( timeSpan.Ticks > 0 )
            {
                descriptionList.Add( "Batch Time Offset", timeSpan.ToString() );
            }

            lblMainDetails.Text = descriptionList.Html;
        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="location">The location.</param>
        private void ShowReadonlyDetails( Location location )
        {
            SetEditMode( false );

            hfLocationId.SetValue( location.Id );

            if ( string.IsNullOrWhiteSpace( location.Name ) )
            {
                lReadOnlyTitle.Text = location.ToString().FormatAsHtmlTitle();
            }
            else
            {
                lReadOnlyTitle.Text = location.Name.FormatAsHtmlTitle();
            }

            hlInactive.Visible = !location.IsActive;
            if ( location.LocationTypeValue != null )
            {
                hlType.Text = location.LocationTypeValue.Value;
                hlType.Visible = true;
            }
            else
            {
                hlType.Visible = false;
            }

            string imgTag = GetImageTag( location.ImageId, 150, 150 );
            if ( location.ImageId.HasValue )
            {
                string imageUrl = ResolveRockUrl( String.Format( "~/GetImage.ashx?id={0}", location.ImageId.Value ) );
                lImage.Text = string.Format( "<a href='{0}'>{1}</a>", imageUrl, imgTag );
            }
            else
            {
                lImage.Text = imgTag;
            }

            DescriptionList descriptionList = new DescriptionList();

            if ( location.ParentLocation != null )
            {
                descriptionList.Add( "Parent Location", location.ParentLocation.Name );
            }

            if ( location.LocationTypeValue != null )
            {
                descriptionList.Add( "Location Type", location.LocationTypeValue.Value );
            }

            if ( location.PrinterDevice != null )
            {
                descriptionList.Add( "Printer", location.PrinterDevice.Name );
            }

            string fullAddress = location.GetFullStreetAddress().ConvertCrLfToHtmlBr();
            if ( !string.IsNullOrWhiteSpace( fullAddress ) )
            {
                descriptionList.Add( "Address", fullAddress );
            }

            lblMainDetails.Text = descriptionList.Html;

            location.LoadAttributes();
            Rock.Attribute.Helper.AddDisplayControls( location, phAttributes );

            phMaps.Controls.Clear();
            var mapStyleValue = DefinedValueCache.Read( GetAttributeValue( "MapStyle" ) );
            if ( mapStyleValue == null )
            {
                mapStyleValue = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.MAP_STYLE_ROCK );
            }

            if ( mapStyleValue != null )
            {
                string mapStyle = mapStyleValue.GetAttributeValue( "StaticMapStyle" );

                if ( !string.IsNullOrWhiteSpace( mapStyle ) )
                {
                    if ( location.GeoPoint != null )
                    {
                        string markerPoints = string.Format( "{0},{1}", location.GeoPoint.Latitude, location.GeoPoint.Longitude );
                        string mapLink = System.Text.RegularExpressions.Regex.Replace( mapStyle, @"\{\s*MarkerPoints\s*\}", markerPoints );
                        mapLink = System.Text.RegularExpressions.Regex.Replace( mapLink, @"\{\s*PolygonPoints\s*\}", string.Empty );
                        mapLink += "&sensor=false&size=350x200&zoom=13&format=png";
                        phMaps.Controls.Add( new LiteralControl ( string.Format( "<div class='group-location-map'><img src='{0}'/></div>", mapLink ) ) );
                    }

                    if ( location.GeoFence != null )
                    {
                        string polygonPoints = "enc:" + location.EncodeGooglePolygon();
                        string mapLink = System.Text.RegularExpressions.Regex.Replace( mapStyle, @"\{\s*MarkerPoints\s*\}", string.Empty );
                        mapLink = System.Text.RegularExpressions.Regex.Replace( mapLink, @"\{\s*PolygonPoints\s*\}", polygonPoints );
                        mapLink += "&sensor=false&size=350x200&format=png";
                        phMaps.Controls.Add( new LiteralControl( string.Format( "<div class='group-location-map'><img src='{0}'/></div>", mapLink ) ) );
                    }
                }
            }

            btnSecurity.Visible = location.IsAuthorized( Authorization.ADMINISTRATE, CurrentPerson );
            btnSecurity.Title = location.Name;
            btnSecurity.EntityId = location.Id;
        }
        private void ShowReadonlyDetails( EventItemOccurrence eventItemOccurrence )
        {
            SetEditMode( false );

            hfEventItemOccurrenceId.Value = eventItemOccurrence.Id.ToString();

            lActionTitle.Text = "Event Occurrence".FormatAsHtmlTitle();

            var leftDesc = new DescriptionList();
            leftDesc.Add( "Campus", eventItemOccurrence.Campus != null ? eventItemOccurrence.Campus.Name : "All" );
            leftDesc.Add( "Location Description", eventItemOccurrence.Location );
            leftDesc.Add( "Schedule", eventItemOccurrence.Schedule != null ? eventItemOccurrence.Schedule.FriendlyScheduleText : string.Empty );

            if ( eventItemOccurrence.Linkages.Any() )
            {
                var linkage = eventItemOccurrence.Linkages.First();
                if ( linkage.RegistrationInstance != null )
                {
                    var qryParams = new Dictionary<string, string>();
                    qryParams.Add( "RegistrationInstanceId", linkage.RegistrationInstance.Id.ToString() );
                    leftDesc.Add( "Registration", string.Format( "<a href='{0}'>{1}</a>", LinkedPageUrl( "RegistrationInstancePage", qryParams ), linkage.RegistrationInstance.Name ) );
                }

                if ( linkage.Group != null )
                {
                    var qryParams = new Dictionary<string, string>();
                    qryParams.Add( "GroupId", linkage.Group.Id.ToString() );
                    leftDesc.Add( "Group", string.Format( "<a href='{0}'>{1}</a>", LinkedPageUrl( "GroupDetailPage", qryParams ), linkage.Group.Name ) );
                }
            }
            lLeftDetails.Text = leftDesc.Html;

            var rightDesc = new DescriptionList();
            rightDesc.Add( "Contact", eventItemOccurrence.ContactPersonAlias != null && eventItemOccurrence.ContactPersonAlias.Person != null ?
                eventItemOccurrence.ContactPersonAlias.Person.FullName : "" );
            rightDesc.Add( "Phone", eventItemOccurrence.ContactPhone );
            rightDesc.Add( "Email", eventItemOccurrence.ContactEmail );
            lRightDetails.Text = rightDesc.Html;

            lOccurrenceNotes.Visible = !string.IsNullOrWhiteSpace( eventItemOccurrence.Note );
            lOccurrenceNotes.Text = eventItemOccurrence.Note;
        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="contentChannel">Type of the content.</param>
        private void ShowReadonlyDetails( ContentChannel contentChannel )
        {
            SetEditMode( false );

            if ( contentChannel != null )
            {
                hfId.SetValue( contentChannel.Id );

                SetHeadingInfo( contentChannel, contentChannel.Name );
                SetEditMode( false );

                lGroupDescription.Text = contentChannel.Description;

                var descriptionList = new DescriptionList();
                if ( contentChannel.EnableRss )
                {
                    descriptionList
                    .Add( "Item's Require Approval", contentChannel.RequiresApproval.ToString() )
                    .Add( "Channel Url", contentChannel.ChannelUrl )
                    .Add( "Item Url", contentChannel.ItemUrl );
                }

                contentChannel.LoadAttributes();
                foreach ( var attribute in contentChannel.Attributes
                    .Where( a => a.Value.IsGridColumn )
                    .OrderBy( a => a.Value.Order )
                    .Select( a => a.Value ) )
                {
                    if ( contentChannel.AttributeValues.ContainsKey( attribute.Key ) )
                    {
                        string value = attribute.FieldType.Field.FormatValueAsHtml( null,
                            contentChannel.AttributeValues[attribute.Key].Value, attribute.QualifierValues, false );
                        descriptionList.Add( attribute.Name, value );
                    }
                }

                lDetails.Text = descriptionList.Html;
            }
        }
示例#30
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="schedule">The schedule.</param>
        private void ShowReadonlyDetails( Schedule schedule )
        {
            SetEditMode( false );
            hfScheduleId.SetValue( schedule.Id );
            lReadOnlyTitle.Text = schedule.Name.FormatAsHtmlTitle();

            string occurrenceText = string.Empty;
            var occurrences = schedule.GetOccurrences( RockDateTime.Now, RockDateTime.Now.AddYears( 1 ) );
            if ( occurrences.Any() )
            {
                occurrenceText = GetOccurrenceText( occurrences[0] );
            }

            if ( schedule.CategoryId.HasValue )
            {
                var today = RockDateTime.Today;
                var nextYear = today.AddYears( 1 );
                var exclusions = new List<string>();

                foreach ( var exclusion in new ScheduleCategoryExclusionService( new RockContext() )
                    .Queryable().AsNoTracking()
                    .Where( e =>
                        e.CategoryId == schedule.CategoryId.Value &&
                        e.EndDate >= today &&
                        e.StartDate < nextYear )
                    .OrderBy( e => e.StartDate ) )
                {
                    exclusions.Add( string.Format( "<strong>{0}</strong>: {1} - {2}",
                        exclusion.Title, exclusion.StartDate.ToShortDateString(), exclusion.EndDate.ToShortDateString() ) );
                }

                if ( exclusions.Any() )
                {
                    nbExclusions.Text = string.Format( "<p>This schedule will not be active during the following dates due to being excluded by the schedule's category:</p><p>{0}</p>",
                        exclusions.AsDelimited( "<br/>" ) );
                    nbExclusions.Visible = true;
                }
            }

            var friendlyText = schedule.ToFriendlyScheduleText();
            if ( schedule.HasScheduleWarning() )
            {
                friendlyText = string.Format( "<label class='label label-warning'>{0}</label> <i class='fa fa-exclamation-triangle text-warning'></i>", friendlyText );
            }

            DescriptionList descriptionList = new DescriptionList()
                .Add( "Description", schedule.Description ?? string.Empty )
                .Add( "Schedule", friendlyText )
                .Add( "Next Occurrence", occurrenceText )
                .Add( "Category", schedule.Category != null ? schedule.Category.Name : string.Empty );

            if ( schedule.CheckInStartOffsetMinutes.HasValue )
            {
                descriptionList.Add( "Check-in Starts", schedule.CheckInStartOffsetMinutes.Value.ToString() + " minutes before start of schedule" );
            }

            if ( schedule.CheckInEndOffsetMinutes.HasValue )
            {
                descriptionList.Add( "Check-in Ends", schedule.CheckInEndOffsetMinutes.Value.ToString() + " minutes after start of schedule" );
            }

            lblMainDetails.Text = descriptionList.Html;
        }