public ViewGoogleChartViewData(List <GoogleChartJson> googleChartJsons,
                                       string chartTitle,
                                       int chartHeight,
                                       DateTime?lastUpdatedDate,
                                       string chartUniqueName,
                                       bool canConfigureChart,
                                       string downloadChartDataUrl,
                                       bool showChartTitle,
                                       bool sortChartsByLegendTitle,
                                       ProjectFirmaModels.Models.PerformanceMeasure performanceMeasure,
                                       bool hyperlinkPerformanceMeasureName)
        {
            GoogleChartJsons = googleChartJsons;
            ChartTitle       = chartTitle;
            var hasData = googleChartJsons.Count != 0 && googleChartJsons.Any(x => x != null && x.HasData());

            HasData              = hasData;
            MainColumnLabel      = hasData ? googleChartJsons.Where(x => x != null).Select(x => x.GoogleChartDataTable.GoogleChartColumns.FirstOrDefault()?.ColumnLabel).Distinct().SingleOrDefault() : null;
            ChartHeight          = hasData ? chartHeight : 65;
            LastUpdatedDate      = lastUpdatedDate;
            ChartUniqueName      = chartUniqueName;
            DownloadChartDataUrl = downloadChartDataUrl;
            ChartPopupUrl        = SitkaRoute <GoogleChartController> .BuildUrlFromExpression(c => c.GoogleChartPopup());

            CanConfigureChart               = canConfigureChart;
            ShowChartTitle                  = showChartTitle;
            SortChartsByLegendTitle         = sortChartsByLegendTitle;
            PerformanceMeasure              = performanceMeasure;
            HyperlinkPerformanceMeasureName = hyperlinkPerformanceMeasureName;
            CanBeChartedCumulatively        = performanceMeasure?.CanBeChartedCumulatively ?? false;
        }
        /// <summary>
        /// Used by PerformanceMeasure Guidance
        /// </summary>
        public void UpdateModel(ProjectFirmaModels.Models.PerformanceMeasure performanceMeasure, EditRtfContent.PerformanceMeasureRichTextType performanceMeasureRichTextType)
        {
            switch (performanceMeasureRichTextType)
            {
            case EditRtfContent.PerformanceMeasureRichTextType.CriticalDefinitions:
                performanceMeasure.CriticalDefinitionsHtmlString = RtfContent;
                break;

            case EditRtfContent.PerformanceMeasureRichTextType.ProjectReporting:
                performanceMeasure.ProjectReportingHtmlString = RtfContent;
                break;

            case EditRtfContent.PerformanceMeasureRichTextType.Importance:
                performanceMeasure.ImportanceHtmlString = RtfContent;
                break;

            case EditRtfContent.PerformanceMeasureRichTextType.AdditionalInformation:
                performanceMeasure.AdditionalInformationHtmlString = RtfContent;
                break;

            default:
                throw new ArgumentOutOfRangeException(string.Format("Invalid GuidanceType {0}", performanceMeasureRichTextType));
            }
        }
 public static Func <GoogleChartColumn, bool> IsValidColumn(ProjectFirmaModels.Models.PerformanceMeasure performanceMeasure)
 {
     return(x => performanceMeasure.PerformanceMeasureSubcategories.SelectMany(x1 => x1.PerformanceMeasureSubcategoryOptions).Select(x2 => x2.PerformanceMeasureSubcategoryOptionName).ToList().Contains(x.ColumnLabel) ||
            x.ColumnLabel == performanceMeasure.PerformanceMeasureDisplayName);
 }
 public DefinitionAndGuidanceViewData(ProjectFirmaModels.Models.PerformanceMeasure performanceMeasure)
 {
     PerformanceMeasure = performanceMeasure;
 }