Пример #1
0
        /// <summary>
        /// Shows the mode where the user is only viewing an existing streak type
        /// </summary>
        private void ShowViewMode()
        {
            if (!IsViewMode())
            {
                return;
            }

            var canEdit = CanEdit();

            btnEdit.Visible = canEdit;

            pnlEditDetails.Visible = false;
            pnlViewDetails.Visible = true;
            HideSecondaryBlocks(false);

            // Description
            var node            = WebFarmNode;
            var descriptionList = new DescriptionList();

            descriptionList.Add("Last Seen", node.LastSeen);
            descriptionList.Add("Is Leader", node.IsLeader.ToYesNo());
            descriptionList.Add("Job Runner", node.IsJobRunner.ToYesNo());
            descriptionList.Add("Polling Interval", string.Format("{0:N1}s", node.PollingIntervalSeconds));

            lDescription.Text = descriptionList.Html;

            // Show chart for responsive nodes
            if (node.IsActive && !node.IsUnresponsive && node.Metrics.Count() > 1)
            {
                var samples = WebFarmNodeMetricService.CalculateMetricSamples(node.Metrics, _cpuMetricSampleCount, ChartMinDate, _chartMaxDate);
                var html    = GetChartHtml(samples);
                lChart.Text = html;
            }
        }
Пример #2
0
        /// <summary>
        /// Handles the ItemDataBound event of the rptNcoaResults control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RepeaterItemEventArgs"/> instance containing the event data.</param>
        protected void rptNcoaResults_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var ncoaRow       = e.Item.DataItem as NcoaRow;
            var familyMembers = e.Item.FindControl("lMembers") as Literal;

            DescriptionList mmembers   = new DescriptionList();
            bool            individual = false;

            if (ncoaRow.Individual != null)
            {
                individual = true;
                mmembers.Add("Individual", ncoaRow.Individual.FullName);
            }
            if (ncoaRow.FamilyMembers != null && ncoaRow.FamilyMembers.Count > 0)
            {
                if (!individual)
                {
                    mmembers.Add("Family Members", ncoaRow.FamilyMembers.Select(a => a.FullName).ToList().AsDelimited("<Br/>"));
                }
                else
                {
                    mmembers.Add("Other Family Members", ncoaRow.FamilyMembers.Select(a => a.FullName).ToList().AsDelimited("<Br/>"));

                    var warninglabel = e.Item.FindControl("lWarning") as Literal;
                    warninglabel.Text = "Auto processing this move would result in a split family.";
                }
            }
            familyMembers.Text = mmembers.Html;
        }
Пример #3
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;

            DescriptionList descriptionList = new DescriptionList();

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

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

            descriptionList.Add("Description", dataView.Description);

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

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

            lblMainDetails.Text = descriptionList.Html;

            ShowReport(dataView);
        }
        /// <summary>
        /// Shows the mode where the user is only viewing an existing exclusion
        /// </summary>
        private void ShowViewMode()
        {
            if (!IsViewMode())
            {
                return;
            }

            var canEdit = CanEdit();

            pnlEditDetails.Visible = false;
            pnlViewDetails.Visible = true;
            HideSecondaryBlocks(false);
            pdAuditDetails.Visible = canEdit;

            btnEdit.Visible   = canEdit;
            btnDelete.Visible = canEdit;

            var exclusion  = GetExclusion();
            var streakType = GetStreakType();

            lReadOnlyTitle.Text = ActionTitle.View(StreakTypeExclusion.FriendlyTypeName).FormatAsHtmlTitle();
            var locationName = exclusion.Location != null ? exclusion.Location.Name : "Unspecified";

            var descriptionList = new DescriptionList();

            descriptionList.Add("Streak Type", streakType.Name);
            descriptionList.Add("Location", locationName);

            lExclusionDescription.Text = descriptionList.Html;
        }
Пример #5
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;
        }
Пример #6
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;

            prayerRequest.LoadAttributes();
            var attributes = prayerRequest.Attributes.Select(a => a.Value).OrderBy(a => a.Order).ThenBy(a => a.Name).ToList();

            var attributeCategories = Helper.GetAttributeCategories(attributes);

            Rock.Attribute.Helper.AddDisplayControls(prayerRequest, attributeCategories, phDisplayAttributes, null, false);

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

            hlblUrgent.Visible = prayerRequest.IsUrgent ?? false;
        }
Пример #7
0
        /// <summary>
        /// Binds the details.
        /// </summary>
        private void BindDetails()
        {
            var descriptionList = new DescriptionList();

            var transport = RockMessageBus.GetTransportName();

            if (!transport.IsNullOrWhiteSpace())
            {
                descriptionList.Add("Transport", transport);
            }

            descriptionList.Add("NodeName", RockMessageBus.NodeName);

            var statLog = RockMessageBus.StatLog;

            if (statLog != null)
            {
                if (statLog.MessagesConsumedLastMinute.HasValue)
                {
                    descriptionList.Add("Messages Per Minute", statLog.MessagesConsumedLastMinute);
                }

                if (statLog.MessagesConsumedLastHour.HasValue)
                {
                    descriptionList.Add("Messages Per Hour", statLog.MessagesConsumedLastHour);
                }

                if (statLog.MessagesConsumedLastDay.HasValue)
                {
                    descriptionList.Add("Messages Per Day", statLog.MessagesConsumedLastDay);
                }
            }

            lDetails.Text = descriptionList.Html;
        }
Пример #8
0
        /// <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 leftDescription = new DescriptionList();

            leftDescription.Add("Public Name", account.PublicName);
            leftDescription.Add("Campus", account.Campus != null ? account.Campus.Name : string.Empty);
            leftDescription.Add("GLCode", account.GlCode);
            leftDescription.Add("Is Tax Deductible", account.IsTaxDeductible);
            lLeftDetails.Text = leftDescription.Html;

            var followingsFromDatabase  = GetAccountParticipantStateFromDatabase().OrderBy(a => a.PersonFullName).ToList();
            var accountParticipantsHtml = followingsFromDatabase.Select(a => $"{a.PersonFullName} ({a.PurposeKeyDescription})").ToList().AsDelimited("<br>\n");

            DescriptionList rightDescription = new DescriptionList();

            rightDescription.Add("Account Participants", accountParticipantsHtml);
            lRightDetails.Text = rightDescription.Html;

            account.LoadAttributes();
            Helper.AddDisplayControls(account, Helper.GetAttributeCategories(account, true, false), phAttributesView, null, false);
        }
Пример #9
0
        /// <summary>
        /// Handles the ProgressChanged event of the BackgroundWorker control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProgressChangedEventArgs"/> instance containing the event data.</param>
        private void _importer_OnProgress(object sender, object e)
        {
            string          progressMessage = string.Empty;
            DescriptionList progressResults = new DescriptionList();

            if (e is string)
            {
                progressMessage = e.ToString();
            }

            var exceptionsCopy = _importer.Exceptions.ToArray();

            if (exceptionsCopy.Any())
            {
                progressResults.Add("Exception", string.Join(Environment.NewLine, exceptionsCopy.Select(a => a.Message).ToArray()));
            }

            var resultsCopy = _importer.Results.ToArray();

            foreach (var result in resultsCopy)
            {
                progressResults.Add(result.Key, result.Value);
            }

            WriteProgressMessage(progressMessage, progressResults.Html);
        }
        /// <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)
            {
                SetHeadingStatusInfo(business);
                var detailsLeft = new DescriptionList();
                detailsLeft.Add("Business Name", business.LastName);

                if (business.GivingGroup != null)
                {
                    detailsLeft.Add("Campus", business.GivingGroup.Campus);
                }

                if (business.RecordStatusReasonValue != null)
                {
                    detailsLeft.Add("Record Status Reason", business.RecordStatusReasonValue);
                }

                lDetailsLeft.Text = detailsLeft.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;
            }
        }
Пример #11
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 dayOfWeek = gateway.BatchDayOfWeek;
            var isWeekly  = dayOfWeek.HasValue;

            if (isWeekly)
            {
                descriptionList.Add("Batched Weekly", dayOfWeek.Value.ToString());
            }

            var timeSpan = gateway.GetBatchTimeOffset();

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

            lblMainDetails.Text = descriptionList.Html;
        }
Пример #12
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");

            var eventEntityTypeGuid = EntityTypeCache.Get(followingEvent.EntityType.Id).Guid.ToString();

            if (followingEvent.EntityType != null && string.Equals(eventEntityTypeGuid, Rock.SystemGuid.EntityType.PERSON_PRAYER_REQUEST, StringComparison.OrdinalIgnoreCase))
            {
                descriptionList.Add("Include Non-Public Requests", followingEvent.IncludeNonPublicRequests ? "Yes" : "No");
            }

            lblMainDetails.Text = descriptionList.Html;
        }
Пример #13
0
        /// <summary>
        /// Shows the mode where the user is only viewing an existing streak type
        /// </summary>
        private void ShowViewMode()
        {
            if (!IsViewMode())
            {
                return;
            }

            var canEdit = CanEdit();

            pnlEditDetails.Visible = false;
            pnlViewDetails.Visible = true;
            HideSecondaryBlocks(false);
            pdAuditDetails.Visible = canEdit;

            btnEdit.Visible   = canEdit;
            btnDelete.Visible = canEdit;

            var enrollment = GetStreak();
            var streakType = GetStreakType();

            lReadOnlyTitle.Text = ActionTitle.View(Streak.FriendlyTypeName).FormatAsHtmlTitle();
            btnRebuild.Enabled  = streakType.IsActive;

            lPersonHtml.Text = GetPersonHtml();

            var descriptionList = new DescriptionList();

            descriptionList.Add("Streak Type", streakType.Name);
            descriptionList.Add("Enrollment Date", enrollment.EnrollmentDate.ToShortDateString());

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

            lEnrollmentDescription.Text = descriptionList.Html;

            var streakDetailsList = new DescriptionList();

            streakDetailsList.Add("Current Streak", GetStreakStateString(enrollment.CurrentStreakCount, enrollment.CurrentStreakStartDate));
            streakDetailsList.Add("Longest Streak", GetStreakStateString(enrollment.LongestStreakCount, enrollment.LongestStreakStartDate, enrollment.LongestStreakEndDate));

            lStreakData.Text = streakDetailsList.Html;

            RenderStreakChart();
            SetLinkVisibility(btnAttempts, AttributeKey.AttemptsPage);

            // Show the count of successful attempts on the button
            var successfulAttemptCount = GetSuccessfulAttemptCount();

            if (successfulAttemptCount > 0)
            {
                btnAttempts.Text = string.Format(@"<i class=""fa fa-medal""></i> Achievements <span class=""badge"">{0}</span>", successfulAttemptCount);
            }
            else
            {
                btnAttempts.Text = @"<i class=""fa fa-medal""></i> Achievements";
            }
        }
Пример #14
0
        /// <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;
            string eventPageGuid  = this.GetAttributeValue("EventPage");

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

                if (!string.IsNullOrWhiteSpace(eventPageGuid))
                {
                    var page = new PageService().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 campusList = marketingCampaign.MarketingCampaignCampuses.Select(a => a.Campus.Name).OrderBy(a => a).ToList().AsDelimited("<br>");

            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;

            DescriptionList descriptionList = new DescriptionList()
                                              .Add("Title", marketingCampaign.Title)
                                              .Add("Contact", contactInfo);

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

            if (marketingCampaign.MarketingCampaignCampuses.Count > 0)
            {
                descriptionList.Add("Campuses", campusList);
            }

            descriptionList
            .Add("Primary Audience", primaryAudiences)
            .Add("Secondary Audience", secondaryAudiences);

            lblMainDetails.Text = descriptionList.Html;
        }
Пример #15
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="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;
        }
Пример #17
0
        /// <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);

                nbRoleMessage.Visible = false;
                if (contentChannel.RequiresApproval && !IsApproverConfigured(contentChannel))
                {
                    nbRoleMessage.Text    = "<p>No role or person is configured to approve the items for this channel. Please configure one or more roles or people in the security settings under the &quot;Approve&quot; tab.</p>";
                    nbRoleMessage.Visible = true;
                }

                lGroupDescription.Text = contentChannel.Description;

                var descriptionListLeft  = new DescriptionList();
                var descriptionListRight = new DescriptionList();

                descriptionListLeft.Add("Items Require Approval", contentChannel.RequiresApproval.ToYesNo());

                // Only show index state if indexing is enabled on the server
                if (IndexContainer.IndexingEnabled)
                {
                    descriptionListRight.Add("Is Indexed", contentChannel.IsIndexEnabled.ToYesNo());
                }

                if (contentChannel.EnableRss)
                {
                    descriptionListLeft.Add("Channel URL", contentChannel.ChannelUrl);
                    descriptionListRight.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, attribute.EntityTypeId, contentChannel.Id,
                                                                                   contentChannel.AttributeValues[attribute.Key].Value, attribute.QualifierValues, false);
                        descriptionListLeft.Add(attribute.Name, value);
                    }
                }

                lDetailsLeft.Text  = descriptionListLeft.Html;
                lDetailsRight.Text = descriptionListRight.Html;
            }
        }
        /// <summary>
        /// Shows the mode where the user is only viewing an existing document type
        /// </summary>
        private void ShowViewMode()
        {
            if (!IsViewMode())
            {
                return;
            }

            var canEdit = CanEdit();

            pnlEditDetails.Visible = false;
            pnlViewDetails.Visible = true;
            HideSecondaryBlocks(false);

            btnEdit.Visible     = canEdit;
            btnDelete.Visible   = canEdit;
            btnSecurity.Visible = canEdit;

            var documentType = GetDocumentType();

            if (documentType != null)
            {
                pdAuditDetails.SetEntity(documentType, ResolveRockUrl("~"));
            }

            lReadOnlyTitle.Text = documentType.Name.FormatAsHtmlTitle();
            lIcon.Text          = string.Format("<i class='{0}'></i>", documentType.IconCssClass);

            var descriptionList = new DescriptionList();

            if (documentType.BinaryFileType != null)
            {
                descriptionList.Add("File Type", documentType.BinaryFileType.Name);
            }

            if (documentType.EntityType != null)
            {
                descriptionList.Add("Entity Type", documentType.EntityType.FriendlyName);
                descriptionList.Add("Qualifier Column", documentType.EntityTypeQualifierColumn);
                descriptionList.Add("Qualifier Value", documentType.EntityTypeQualifierValue);
            }

            descriptionList.Add("Manually Selectable", documentType.UserSelectable ? "Yes" : "No");

            lDocumentTypeDescription.Text = descriptionList.Html;

            if (canEdit)
            {
                btnSecurity.Title    = "Secure " + documentType.Name;
                btnSecurity.EntityId = documentType.Id;
            }
        }
Пример #19
0
        /// <summary>
        /// Shows the mode where the user is only viewing an existing streak type
        /// </summary>
        private void ShowViewMode()
        {
            if (!IsViewMode())
            {
                return;
            }

            var canEdit = CanEdit();

            pnlEditDetails.Visible = false;
            pnlViewDetails.Visible = true;
            HideSecondaryBlocks(false);

            btnEdit.Visible = canEdit;

            var queue = GetQueue();

            lReadOnlyTitle.Text = queue.Name.FormatAsHtmlTitle();

            var descriptionList = new DescriptionList();

            var timeToLiveValue = (queue.TimeToLiveSeconds.HasValue && queue.TimeToLiveSeconds >= 1) ?
                                  string.Format("{0} second{1}", queue.TimeToLiveSeconds, queue.TimeToLiveSeconds == 1 ? string.Empty : "s") :
                                  "Indefinite";

            descriptionList.Add("Time to Live", timeToLiveValue);

            var statLog = queue.StatLog;

            if (statLog != null)
            {
                if (statLog.MessagesConsumedLastMinute.HasValue)
                {
                    descriptionList.Add("Messages Last Minute", statLog.MessagesConsumedLastMinute);
                }

                if (statLog.MessagesConsumedLastHour.HasValue)
                {
                    descriptionList.Add("Messages Last Hour", statLog.MessagesConsumedLastHour);
                }

                if (statLog.MessagesConsumedLastDay.HasValue)
                {
                    descriptionList.Add("Messages Last Day", statLog.MessagesConsumedLastDay);
                }
            }

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

            lActionTitle.Text  = lavaShortcode.Name.FormatAsHtmlTitle();
            hlInactive.Visible = !lavaShortcode.IsActive;

            lLayoutDescription.Text = lavaShortcode.Description;

            DescriptionList descriptionList = new DescriptionList();

            descriptionList.Add("System", lavaShortcode.IsSystem.ToYesNo());
            descriptionList.Add("Tag Name", lavaShortcode.TagName);
            descriptionList.Add("Tag Type", lavaShortcode.TagType);
            lblMainDetails.Text = descriptionList.Html;
        }
Пример #21
0
        public DescriptionList GetOptionAvail()
        {
            OracleConnection con = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;
            string           proc = "USP_GET_OPTIONAVAIL";

            cmd             = new OracleCommand(proc, con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            cmd.Connection.Open();
            OracleDataReader dr                 = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            DescriptionBO    DescriptionBO      = null;
            DescriptionList  objDescriptionList = new DescriptionList();

            while (dr.Read())
            {
                DescriptionBO                     = new DescriptionBO();
                DescriptionBO.OptionID            = dr.GetInt32(dr.GetOrdinal("ID"));
                DescriptionBO.OptionAvailablename = dr.GetValue(dr.GetOrdinal("OPTIONAVAILABLE")).ToString();
                objDescriptionList.Add(DescriptionBO);
            }

            dr.Close();
            return(objDescriptionList);
        }
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="mediaAccount">The media account.</param>
        private void ShowReadonlyDetails(MediaAccount mediaAccount)
        {
            SetEditMode(false);

            lActionTitle.Text     = mediaAccount.Name.FormatAsHtmlTitle();
            hlInactive.Visible    = !mediaAccount.IsActive;
            hlLastRefresh.Visible = mediaAccount.LastRefreshDateTime.HasValue;
            if (mediaAccount.LastRefreshDateTime.HasValue)
            {
                var refreshTimeSpan = RockDateTime.Now - mediaAccount.LastRefreshDateTime.Value;

                hlLastRefresh.Text = "Last Refreshed: " + refreshTimeSpan.Humanize();
            }

            var mediaAccountComponent = mediaAccount.GetMediaAccountComponent();
            var descriptionList       = new DescriptionList();

            if (mediaAccountComponent != null)
            {
                descriptionList.Add("Type", mediaAccountComponent.EntityType.FriendlyName);
            }

            lDescription.Text = descriptionList.Html;
            lMetricData.Text  = mediaAccountComponent?.GetAccountHtmlSummary(mediaAccount);
        }
Пример #23
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="site">The site.</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.OrderBy(d => d.Order).Select(d => d.Domain).ToList().AsDelimited(", "));
            descriptionList.Add("Theme", site.Theme);
            descriptionList.Add("Default Page", site.DefaultPageRoute);
            lblMainDetails.Text = descriptionList.Html;
        }
Пример #24
0
        /// <summary>
        /// Shows the mode where the user is only viewing an existing streak type
        /// </summary>
        private void ShowViewMode()
        {
            if (!IsViewMode())
            {
                return;
            }

            var canEdit = CanEdit();

            pnlEditDetails.Visible = false;
            pnlViewDetails.Visible = true;
            HideSecondaryBlocks(false);

            btnEdit.Visible   = canEdit;
            btnDelete.Visible = canEdit;

            lPersonHtml.Text = GetPersonHtml();
            lProgress.Text   = GetProgressHtml();

            var descriptionList = new DescriptionList();

            descriptionList.Add("Date", GetAttemptDateRangeString());
            lAttemptDescription.Text = descriptionList.Html;

            SetLinkVisibility(btnAchievement, AttributeKey.AchievementPage);
            SetLinkVisibility(btnStreak, AttributeKey.StreakPage);
        }
Пример #25
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="group">The group.</param>
        private void ShowReadonlyDetails(Group group)
        {
            SetEditMode(false);

            string groupIconHtml = string.Empty;

            if (!string.IsNullOrWhiteSpace(group.GroupType.IconCssClass))
            {
                groupIconHtml = string.Format("<i class='{0} icon-large' ></i>", group.GroupType.IconCssClass);
            }
            else
            {
                var    appPath        = System.Web.VirtualPathUtility.ToAbsolute("~");
                string imageUrlFormat = "<img src='" + appPath + "GetImage.ashx?id={0}&width=50&height=50' />";
                if (group.GroupType.IconLargeFileId != null)
                {
                    groupIconHtml = string.Format(imageUrlFormat, group.GroupType.IconLargeFileId);
                }
                else if (group.GroupType.IconSmallFileId != null)
                {
                    groupIconHtml = string.Format(imageUrlFormat, group.GroupType.IconSmallFileId);
                }
            }

            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;

            GroupType groupType = new GroupTypeService().Get(group.GroupTypeId);

            groupType.LoadAttributes();
            Rock.Attribute.Helper.AddDisplayControls(groupType, phGroupTypeAttributesReadOnly);

            group.LoadAttributes();
            Rock.Attribute.Helper.AddDisplayControls(group, phGroupAttributesReadOnly);
        }
Пример #26
0
        /// <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;
        }
Пример #27
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();

            var    calendarEvent  = schedule.GetCalenderEvent();
            string occurrenceText = string.Empty;

            if (calendarEvent != null)
            {
                if (calendarEvent.DTStart != null)
                {
                    var occurrences = calendarEvent.GetOccurrences(DateTime.Now.Date, DateTime.Now.Date.AddYears(1));
                    if (occurrences.Any())
                    {
                        var occurrence = occurrences[0];

                        if (occurrence.Period.StartTime.Value.Date.Equals(occurrence.Period.EndTime.Value.Date))
                        {
                            occurrenceText += string.Format("{0} - {1} to {2} ( {3} hours)", occurrence.Period.StartTime.Value.Date.ToShortDateString(), occurrence.Period.StartTime.Value.TimeOfDay.ToTimeString(), occurrence.Period.EndTime.Value.TimeOfDay.ToTimeString(), occurrence.Period.Duration.TotalHours.ToString("#0.00"));
                        }
                        else
                        {
                            occurrenceText += string.Format("<li>{0} to {1} ( {2} hours) </li>", occurrence.Period.StartTime.Value.ToString("g"), occurrence.Period.EndTime.Value.ToString("g"), occurrence.Period.Duration.TotalHours.ToString("#0.00"));
                        }
                    }
                }
            }

            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;
        }
Пример #28
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="LavaShortcode">The lavaShortcode.</param>
        private void ShowReadonlyDetails(LavaShortcode lavaShortcode)
        {
            SetEditMode(false);

            lActionTitle.Text  = lavaShortcode.Name.FormatAsHtmlTitle();
            hlInactive.Visible = !lavaShortcode.IsActive;

            lLayoutDescription.Text = lavaShortcode.Description;
            var list = lavaShortcode.Markup.ToKeyValuePairList();

            DescriptionList headerMarkup = new DescriptionList();

            headerMarkup.Add("System", lavaShortcode.IsSystem.ToYesNo());
            headerMarkup.Add("Tag Name", lavaShortcode.TagName);
            headerMarkup.Add("Tag Type", lavaShortcode.TagType);

            lblHeaderFields.Text = headerMarkup.Html;

            ceView.Text = lavaShortcode.Markup;

            if (!string.IsNullOrEmpty(lavaShortcode.Parameters))
            {
                var      values     = new List <string>();
                string[] nameValues = lavaShortcode.Parameters.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (string nameValue in nameValues)
                {
                    string[] nameAndValue = nameValue.Split(new char[] { '^' });

                    // url decode array items just in case they were UrlEncoded (in the KeyValueList controls)
                    nameAndValue = nameAndValue.Select(s => HttpUtility.UrlDecode(s)).ToArray();

                    if (nameAndValue.Length == 2)
                    {
                        values.Add(string.Format("<strong>{0}:</strong> {1}", nameAndValue[0], nameAndValue[1]));
                    }
                    else
                    {
                        values.Add(nameValue);
                    }
                }

                lblParameters.Text = string.Join("<br/>", values);
            }

            lblEnabledCommands.Text = lavaShortcode.EnabledLavaCommands;
        }
Пример #29
0
        /// <summary>
        /// Shows the mode where the user is only viewing an existing streak type
        /// </summary>
        private void ShowViewMode()
        {
            if (!IsViewMode())
            {
                return;
            }

            var canEdit = CanEdit();

            pnlEditDetails.Visible = false;
            pnlViewDetails.Visible = true;
            HideSecondaryBlocks(false);
            pdAuditDetails.Visible = canEdit;

            btnEdit.Visible   = canEdit;
            btnDelete.Visible = canEdit;

            var enrollment = GetStreak();
            var streakType = GetStreakType();

            lReadOnlyTitle.Text = ActionTitle.View(Streak.FriendlyTypeName).FormatAsHtmlTitle();
            btnRebuild.Enabled  = streakType.IsActive;

            lPersonHtml.Text = GetPersonHtml();

            var descriptionList = new DescriptionList();

            descriptionList.Add("Streak Type", streakType.Name);
            descriptionList.Add("Enrollment Date", enrollment.EnrollmentDate.ToShortDateString());

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

            lEnrollmentDescription.Text = descriptionList.Html;

            var streakDetailsList = new DescriptionList();

            streakDetailsList.Add("Current Streak", GetStreakStateString(enrollment.CurrentStreakCount, enrollment.CurrentStreakStartDate));
            streakDetailsList.Add("Longest Streak", GetStreakStateString(enrollment.LongestStreakCount, enrollment.LongestStreakStartDate, enrollment.LongestStreakEndDate));

            lStreakData.Text = streakDetailsList.Html;

            RenderStreakChart();
        }
Пример #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();

            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]);
                    }
                }
            }

            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;
        }