示例#1
0
        /// <summary>
        /// Returns an HtmlString with a link wrapping the ProjectOrganizationFitnessScoreNumber. The link opens a bootstrap popover when clicked. The popover is triggered by the onclick event on the link itself(meaning no need to initialize the popover yourself).
        /// </summary>
        /// <param name="sourceObjectFieldDefinitionEnum">Used in the intro of the popover eg. "This 'Organization'...". Most likely Project or Organization are what you want to pass</param>
        /// <returns></returns>
        public HtmlString GetMatchMakerScoreWithPopover(FieldDefinitionEnum sourceObjectFieldDefinitionEnum)
        {
            //<div>
            //<p>This organization matches on 4 of 5 elements:</p>
            // <ul>
            //    <li><strong>Area of Interest:</strong> Simple Location and Congressional District 02</li>
            //    <li><strong>First Keyword:</strong> “livestock” </li>
            //    <li><strong>Focus Area:</strong>  Water Quality Implementation Program</li>
            //    <li><strong>Project Theme:</strong> Rangelands </li>
            //    </ul>
            //<p>It did not match on Performance Measures.</p>
            //</div>

            var itemsMatched    = this.ScoreInsightDictionary.Where(x => x.Value.Matched);
            var countOfMatches  = itemsMatched.Count();
            var itemsNotMatched = this.ScoreInsightDictionary.Where(x => !x.Value.Matched).Select(x => MultiTenantHelpers.GetTenantDisplayNameForMatchmakerSubScoreTypeEnum(x.Key)).ToList();
            var countOfTotalPossibleItemsToMatchOn = Enum.GetNames(typeof(MatchmakerSubScoreTypeEnum)).Length;

            if (!MultiTenantHelpers.TrackAccomplishments())
            {
                countOfTotalPossibleItemsToMatchOn -= 1; // progress measures should not be included in the count
            }

            var sb = new StringBuilder();

            sb.AppendLine($"<div><p>This {sourceObjectFieldDefinitionEnum.ToType().GetFieldDefinitionLabel()} matches on {countOfMatches} of {countOfTotalPossibleItemsToMatchOn} elements:</p>");
            sb.Append("<ul>");
            foreach (var match in itemsMatched)
            {
                string keyDisplayName = MultiTenantHelpers.GetTenantDisplayNameForMatchmakerSubScoreTypeEnum(match.Key);
                sb.Append(
                    $"<li><strong>{keyDisplayName}:</strong> {string.Join(", ", match.Value.ScoreInsights)}</li>");
            }
            sb.Append("</ul>");

            if (itemsNotMatched.Any())
            {
                sb.Append($"<p>It did not match on <strong>{string.Join("</strong>, <strong>", itemsNotMatched)}</strong></p>");
            }

            sb.Append("</div>");

            var scoreWithPopover = new HtmlString($"<a tabindex=\"0\" role=\"button\" onclick=\"jQuery(this).popover('show')\" data-container=\"body\" data-toggle=\"popover\" data-trigger=\"focus\" data-placement=\"right\" data-html=\"true\" title=\"Match Score: {this.PartnerOrganizationFitnessScoreNumber}\" data-content=\"{sb}\">{this.PartnerOrganizationFitnessScoreNumber}</a>");

            return(scoreWithPopover);
        }
示例#2
0
 public static FieldDefinitionDefault GetFieldDefinitionDefaultByFieldDefinition(this IQueryable <FieldDefinitionDefault> fieldDefinitionDefaults, FieldDefinitionEnum fieldDefinitionEnum)
 {
     return(fieldDefinitionDefaults.SingleOrDefault(x => x.FieldDefinitionID == (int)fieldDefinitionEnum));
 }
 public static FieldDefinition ToType(this FieldDefinitionEnum fieldDefinitionEnum)
 {
     return(ToType((int)fieldDefinitionEnum));
 }
示例#4
0
 public WebServiceDocumentationAttribute(string formatString, FieldDefinitionEnum fieldDefinitionEnum1, FieldDefinitionEnum fieldDefinitionEnum2, FieldDefinitionEnum fieldDefinitionEnum3, FieldDefinitionEnum fieldDefinitionEnum4)
 {
     Documentation = string.Format(formatString, FieldDefinition.ToType(fieldDefinitionEnum1).GetFieldDefinitionLabel(), FieldDefinition.ToType(fieldDefinitionEnum2).GetFieldDefinitionLabel(), FieldDefinition.ToType(fieldDefinitionEnum3).GetFieldDefinitionLabel(), FieldDefinition.ToType(fieldDefinitionEnum4).GetFieldDefinitionLabel());
 }
 public SecurityFeatureDescription(string formatString, FieldDefinitionEnum fieldDefinitionEnum1, FieldDefinitionEnum fieldDefinitionEnum2, FieldDefinitionEnum fieldDefinitionEnum3)
 {
     DescriptionMessage = string.Format(formatString, fieldDefinitionEnum1.ToType().GetFieldDefinitionLabel(), fieldDefinitionEnum2.ToType().GetFieldDefinitionLabel(), fieldDefinitionEnum3.ToType().GetFieldDefinitionLabel());
 }
示例#6
0
 public FieldDefinitionDisplayAttribute(FieldDefinitionEnum fieldDefinitionEnum) : base(fieldDefinitionEnum.ToType().GetFieldDefinitionLabel())
 {
     FieldDefinition = fieldDefinitionEnum.ToType();
 }
 public FieldDefinitionDisplayAttribute(FieldDefinitionEnum fieldDefinitionEnum) : base(Models.FieldDefinition.ToType(fieldDefinitionEnum).GetFieldDefinitionLabel())
 {
     FieldDefinition = Models.FieldDefinition.ToType(fieldDefinitionEnum);
 }
示例#8
0
 public SecurityFeatureDescription(string formatString, FieldDefinitionEnum fieldDefinitionEnum)
 {
     DescriptionMessage = string.Format(formatString, FieldDefinition.ToType(fieldDefinitionEnum).GetFieldDefinitionLabel());
 }
 public WebServiceDocumentationAttribute(string formatString, FieldDefinitionEnum fieldDefinitionEnum1, FieldDefinitionEnum fieldDefinitionEnum2)
 {
     Documentation = string.Format(formatString, fieldDefinitionEnum1.ToType().GetFieldDefinitionLabel(), fieldDefinitionEnum2.ToType().GetFieldDefinitionLabel());
 }