public PerformanceMeasureSubcategoriesTotalReportedValue(Models.Project project, List <IPerformanceMeasureValueSubcategoryOption> subcategoryOptions, Models.PerformanceMeasure performanceMeasure, double?totalReportedValue) { Project = project; PerformanceMeasureActualSubcategoryOptions = subcategoryOptions; PerformanceMeasure = performanceMeasure; TotalReportedValue = totalReportedValue; }
public PerformanceMeasureExpectedGridSpec(Models.PerformanceMeasure performanceMeasure) { Add(Models.FieldDefinition.Project.ToGridHeaderString(), a => UrlTemplate.MakeHrefString(a.Project.GetDetailUrl(), a.Project.DisplayName), 350, DhtmlxGridColumnFilterType.Html); if (MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship()) { Add(Models.FieldDefinition.ProjectsStewardOrganizationRelationshipToProject.ToGridHeaderString(), x => x.Project.GetCanStewardProjectsOrganization().GetShortNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html); } Add(Models.FieldDefinition.PrimaryContactOrganization.ToGridHeaderString(), x => x.Project.GetPrimaryContactOrganization().GetShortNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html); Add(Models.FieldDefinition.ProjectStage.ToGridHeaderString(), a => a.Project.ProjectStage.ProjectStageDisplayName, 90, DhtmlxGridColumnFilterType.SelectFilterStrict); foreach (var performanceMeasureSubcategory in performanceMeasure.PerformanceMeasureSubcategories.OrderBy(x => x.PerformanceMeasureSubcategoryDisplayName)) { Add(performanceMeasureSubcategory.PerformanceMeasureSubcategoryDisplayName, a => { var performanceMeasureExpectedSubcategoryOption = a.PerformanceMeasureExpectedSubcategoryOptions.SingleOrDefault(x => x.PerformanceMeasureSubcategoryID == performanceMeasureSubcategory.PerformanceMeasureSubcategoryID); if (performanceMeasureExpectedSubcategoryOption != null) { return(performanceMeasureExpectedSubcategoryOption.PerformanceMeasureSubcategoryOption.PerformanceMeasureSubcategoryOptionName); } return(string.Empty); }, 120, DhtmlxGridColumnFilterType.SelectFilterStrict); } var expectedValueColumnName = $"{Models.FieldDefinition.ExpectedValue.ToGridHeaderString()} ({performanceMeasure.MeasurementUnitType.MeasurementUnitTypeDisplayName})"; Add(expectedValueColumnName, a => a.ExpectedValue, 150, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total); }
public ViewGoogleChartViewData(List <GoogleChartJson> googleChartJsons, string chartTitle, int chartHeight, DateTime?lastUpdatedDate, string chartUniqueName, bool canConfigureChart, string downloadChartDataUrl, bool showChartTitle, bool sortChartsByLegendTitle, 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; }
public void UpdateModel(Models.PerformanceMeasure performanceMeasure, Person currentPerson) { performanceMeasure.PerformanceMeasureDisplayName = PerformanceMeasureDisplayName; performanceMeasure.PerformanceMeasureTypeID = PerformanceMeasureTypeID.Value; performanceMeasure.MeasurementUnitTypeID = MeasurementUnitTypeID; performanceMeasure.PerformanceMeasureDefinition = PerformanceMeasureDefinition; performanceMeasure.IsAggregatable = IsAggregatable.GetValueOrDefault(); // will never be null due to RequiredAttribute }
public PerformanceMeasureChartViewData(Models.PerformanceMeasure performanceMeasure, Person currentPerson, bool showLastUpdatedDate, bool showConfigureOption, List <Models.Project> projects) : this( performanceMeasure, DefaultHeight, currentPerson, showLastUpdatedDate, showConfigureOption, projects) { }
public EditViewModel(Models.PerformanceMeasure performanceMeasure) { PerformanceMeasureID = performanceMeasure.PerformanceMeasureID; PerformanceMeasureDisplayName = performanceMeasure.PerformanceMeasureDisplayName; PerformanceMeasureTypeID = performanceMeasure.PerformanceMeasureTypeID; MeasurementUnitTypeID = performanceMeasure.MeasurementUnitTypeID; PerformanceMeasureDefinition = performanceMeasure.PerformanceMeasureDefinition; IsAggregatable = performanceMeasure.IsAggregatable; }
public void UpdateModel(Models.PerformanceMeasure performanceMeasure, int performanceMeasureSubcategoryID) { //Remove certain properties that we don't want saved to the DB var chartConfigurationString = CleanAndSerializeChartJsonString(ChartConfigurationJson); var performanceMeasureSubcategory = performanceMeasure.PerformanceMeasureSubcategories.Single(x => x.PerformanceMeasureSubcategoryID == performanceMeasureSubcategoryID); var googleChartType = ConverChartTypeStringToGoogleChartType(); performanceMeasureSubcategory.GoogleChartTypeID = googleChartType != null ? googleChartType.GoogleChartTypeID : (int?)null; performanceMeasureSubcategory.ChartConfigurationJson = chartConfigurationString; }
public void UpdateModel(Models.PerformanceMeasure performanceMeasure) { var performanceMeasureSubcategoriesFromDatabase = HttpRequestStorage.DatabaseEntities.PerformanceMeasureSubcategories.Local; var performanceMeasureSubcategoryOptionsFromDatabase = HttpRequestStorage.DatabaseEntities.PerformanceMeasureSubcategoryOptions.Local; var performanceMeasureSubcategoriesToUpdate = PerformanceMeasureSubcategorySimples.Select(x => { var performanceMeasureSubcategory = new PerformanceMeasureSubcategory(new Models.PerformanceMeasure(String.Empty, default(int), default(int), false, false, true, PerformanceMeasureDataSourceType.Project.PerformanceMeasureDataSourceTypeID), x.PerformanceMeasureSubcategoryDisplayName); performanceMeasureSubcategory.PerformanceMeasure = performanceMeasure; performanceMeasureSubcategory.PerformanceMeasureSubcategoryID = x.PerformanceMeasureSubcategoryID; performanceMeasureSubcategory.PerformanceMeasureSubcategoryOptions = x.PerformanceMeasureSubcategoryOptions.OrderBy(y => y.SortOrder).Select( (y, index) => new PerformanceMeasureSubcategoryOption( new PerformanceMeasureSubcategory(new Models.PerformanceMeasure(String.Empty, default(int), default(int), false, false, true, PerformanceMeasureDataSourceType.Project.PerformanceMeasureDataSourceTypeID), String.Empty), y.PerformanceMeasureSubcategoryOptionName, false) { PerformanceMeasureSubcategory = performanceMeasure.PerformanceMeasureSubcategories.SingleOrDefault(z => z.PerformanceMeasureSubcategoryID == x.PerformanceMeasureSubcategoryID), PerformanceMeasureSubcategoryOptionID = y.PerformanceMeasureSubcategoryOptionID, SortOrder = index + 1, ShowOnFactSheet = y.ShowOnFactSheet }).ToList(); var chartConfigurationJson = JObject.FromObject(PerformanceMeasureModelExtensions.GetDefaultPerformanceMeasureChartConfigurationJson(performanceMeasure)).ToString(); performanceMeasureSubcategory.ChartConfigurationJson = chartConfigurationJson; performanceMeasureSubcategory.GoogleChartTypeID = GoogleChartType.ColumnChart.GoogleChartTypeID; return(performanceMeasureSubcategory); }).ToList(); var performanceMeasureSubcategoryOptionsToUpdate = performanceMeasureSubcategoriesToUpdate.SelectMany(x => x.PerformanceMeasureSubcategoryOptions).ToList(); performanceMeasure.PerformanceMeasureSubcategories.SelectMany(x => x.PerformanceMeasureSubcategoryOptions).ToList().Merge( performanceMeasureSubcategoryOptionsToUpdate, performanceMeasureSubcategoryOptionsFromDatabase, (x, y) => x.PerformanceMeasureSubcategoryOptionID == y.PerformanceMeasureSubcategoryOptionID, (x, y) => { x.PerformanceMeasureSubcategoryOptionName = y.PerformanceMeasureSubcategoryOptionName; x.SortOrder = y.SortOrder; x.ShowOnFactSheet = y.ShowOnFactSheet; }); performanceMeasure.PerformanceMeasureSubcategories.Merge(performanceMeasureSubcategoriesToUpdate, performanceMeasureSubcategoriesFromDatabase, (x, y) => x.PerformanceMeasureSubcategoryID == y.PerformanceMeasureSubcategoryID, (x, y) => { x.PerformanceMeasureSubcategoryDisplayName = y.PerformanceMeasureSubcategoryDisplayName; }); }
public DetailViewData(Person currentPerson, Models.PerformanceMeasure performanceMeasure, PerformanceMeasureChartViewData performanceMeasureChartViewData, EntityNotesViewData entityNotesViewData, bool userHasPerformanceMeasureManagePermissions) : base(currentPerson) { PageTitle = performanceMeasure.PerformanceMeasureDisplayName; EntityName = "PerformanceMeasure Detail"; PerformanceMeasure = performanceMeasure; PerformanceMeasureChartViewData = performanceMeasureChartViewData; EntityNotesViewData = entityNotesViewData; UserHasPerformanceMeasureOverviewManagePermissions = userHasPerformanceMeasureManagePermissions; EditPerformanceMeasureUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.Edit(performanceMeasure)); EditSubcategoriesAndOptionsUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.EditSubcategoriesAndOptions(performanceMeasure)); EditCriticalDefinitionsUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.EditPerformanceMeasureRichText(performanceMeasure, EditRtfContent.PerformanceMeasureRichTextType.CriticalDefinitions)); EditProjectReportingUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.EditPerformanceMeasureRichText(performanceMeasure, EditRtfContent.PerformanceMeasureRichTextType.ProjectReporting)); IndexUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.Index()); var associatePerformanceMeasureTaxonomyLevel = MultiTenantHelpers.GetAssociatePerformanceMeasureTaxonomyLevel(); TaxonomyTierDisplayNamePluralized = associatePerformanceMeasureTaxonomyLevel.GetFieldDefinition().GetFieldDefinitionLabelPluralized(); UserHasTaxonomyTierPerformanceMeasureManagePermissions = new TaxonomyTierPerformanceMeasureManageFeature().HasPermission(currentPerson, performanceMeasure).HasPermission; EditTaxonomyTiersUrl = SitkaRoute <TaxonomyTierPerformanceMeasureController> .BuildUrlFromExpression(c => c.Edit(performanceMeasure)); RelatedTaxonomyTiersViewData = new RelatedTaxonomyTiersViewData(performanceMeasure, associatePerformanceMeasureTaxonomyLevel, true); PerformanceMeasureReportedValuesGridSpec = new PerformanceMeasureReportedValuesGridSpec(performanceMeasure) { ObjectNameSingular = $"{Models.FieldDefinition.ReportedValue.GetFieldDefinitionLabel()} for {Models.FieldDefinition.Project.GetFieldDefinitionLabel()}", ObjectNamePlural = $"{Models.FieldDefinition.ReportedValue.GetFieldDefinitionLabelPluralized()} for {Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true }; PerformanceMeasureReportedValuesGridName = "performanceMeasuresReportedValuesFromPerformanceMeasureGrid"; PerformanceMeasureReportedValuesGridDataUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(tc => tc.PerformanceMeasureReportedValuesGridJsonData(performanceMeasure)); PerformanceMeasureExpectedGridSpec = new PerformanceMeasureExpectedGridSpec(performanceMeasure) { ObjectNameSingular = $"{Models.FieldDefinition.ExpectedValue.GetFieldDefinitionLabel()} for {Models.FieldDefinition.Project.GetFieldDefinitionLabel()}", ObjectNamePlural = $"{Models.FieldDefinition.ExpectedValue.GetFieldDefinitionLabelPluralized()} for {Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true }; PerformanceMeasureExpectedsGridName = "performanceMeasuresExpectedValuesFromPerformanceMeasureGrid"; PerformanceMeasureExpectedsGridDataUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(tc => tc.PerformanceMeasureExpectedsGridJsonData(performanceMeasure)); }
/// <summary> /// Used by PerformanceMeasure Guidance /// </summary> public void UpdateModel(Models.PerformanceMeasure performanceMeasure, EditRtfContent.PerformanceMeasureRichTextType performanceMeasureRichTextType) { switch (performanceMeasureRichTextType) { case EditRtfContent.PerformanceMeasureRichTextType.CriticalDefinitions: performanceMeasure.CriticalDefinitionsHtmlString = RtfContent; break; case EditRtfContent.PerformanceMeasureRichTextType.ProjectReporting: performanceMeasure.ProjectReportingHtmlString = RtfContent; break; default: throw new ArgumentOutOfRangeException(string.Format("Invalid GuidanceType {0}", performanceMeasureRichTextType)); } }
public RelatedTaxonomyTiersViewData(Models.PerformanceMeasure performanceMeasure, TaxonomyLevel associatePerformanceMeasureTaxonomyLevel, bool showHelpLinks) { ProjectTypePerformanceMeasures = performanceMeasure.GetTaxonomyTiers(); PerformanceMeasureDisplayName = MultiTenantHelpers.GetPerformanceMeasureName(); var fieldDefinitionForTaxonomyTier = associatePerformanceMeasureTaxonomyLevel.GetFieldDefinition(); TaxonomyTierDisplayName = fieldDefinitionForTaxonomyTier.GetFieldDefinitionLabel(); TaxonomyTierHeaderDisplayName = showHelpLinks ? LabelWithSugarForExtensions.LabelWithSugarFor( fieldDefinitionForTaxonomyTier, LabelWithSugarForExtensions.DefaultPopupWidth, LabelWithSugarForExtensions.DisplayStyle.HelpIconWithLabel, TaxonomyTierDisplayName) : new HtmlString(TaxonomyTierDisplayName); var fieldDefinitionIsPrimaryTaxonomyBranch = Models.FieldDefinition.IsPrimaryTaxonomyBranch; var isPrimaryTaxonomyBranchLabel = $"Is Primary {TaxonomyTierDisplayName}"; IsPrimaryTaxonomyTierHeaderDisplayName = showHelpLinks ? LabelWithSugarForExtensions.LabelWithSugarFor( fieldDefinitionIsPrimaryTaxonomyBranch, LabelWithSugarForExtensions.DefaultPopupWidth, LabelWithSugarForExtensions.DisplayStyle.HelpIconWithLabel, isPrimaryTaxonomyBranchLabel) : new HtmlString(isPrimaryTaxonomyBranchLabel); TaxonomyTierDisplayNamePluralized = fieldDefinitionForTaxonomyTier.GetFieldDefinitionLabelPluralized(); AssociatePerformanceMeasureTaxonomyLevel = associatePerformanceMeasureTaxonomyLevel; }
public PerformanceMeasureChartViewData(Models.PerformanceMeasure performanceMeasure, int height, Person currentPerson, bool showLastUpdatedDate, bool fromPerformanceMeasureDetailPage, List <Models.Project> projects) { PerformanceMeasure = performanceMeasure; HyperlinkPerformanceMeasureName = !fromPerformanceMeasureDetailPage; GoogleChartJsons = performanceMeasure.GetGoogleChartJsonDictionary(projects); var performanceMeasureActuals = PerformanceMeasure.PerformanceMeasureActuals.Where(x => projects.Contains(x.Project)).ToList(); ChartTotal = performanceMeasureActuals.Any() ? performanceMeasureActuals.Sum(x => x.ActualValue) : (double?)null; ChartTotalFormatted = PerformanceMeasure.MeasurementUnitType.DisplayValue(ChartTotal); ChartTotalUnit = PerformanceMeasure.MeasurementUnitType.LegendDisplayName; var currentPersonHasManagePermission = new PerformanceMeasureManageFeature().HasPermissionByPerson(currentPerson); CanManagePerformanceMeasures = currentPersonHasManagePermission && fromPerformanceMeasureDetailPage; ShowLastUpdatedDate = showLastUpdatedDate; ChartTitle = performanceMeasure.DisplayName; ViewGoogleChartViewData = new ViewGoogleChartViewData(GoogleChartJsons, ChartTitle, height, null, performanceMeasure.GetJavascriptSafeChartUniqueName(), CanManagePerformanceMeasures, SitkaRoute <GoogleChartController> .BuildUrlFromExpression(c => c.DownloadPerformanceMeasureChartData()), true, true, performanceMeasure, HyperlinkPerformanceMeasureName); }
public DefinitionAndGuidanceViewData(Models.PerformanceMeasure performanceMeasure) { PerformanceMeasure = performanceMeasure; }
public static Func <GoogleChartColumn, bool> IsValidColumn(Models.PerformanceMeasure performanceMeasure) { return(x => performanceMeasure.PerformanceMeasureSubcategories.SelectMany(x1 => x1.PerformanceMeasureSubcategoryOptions).Select(x2 => x2.PerformanceMeasureSubcategoryOptionName).ToList().Contains(x.ColumnLabel) || x.ColumnLabel == performanceMeasure.PerformanceMeasureDisplayName); }
public EditSubcategoriesAndOptionsViewModel(Models.PerformanceMeasure performanceMeasure) { PerformanceMeasureSubcategorySimples = performanceMeasure.PerformanceMeasureSubcategories.ToList().Select(x => new PerformanceMeasureSubcategorySimple(x)).ToList(); }
public PerformanceMeasureSubcategoriesCalendarYearReportedValue(Models.PerformanceMeasure performanceMeasure, List <SubcategoriesReportedValue> subcategoriesReportedValues, string displayCssClass) { _performanceMeasure = performanceMeasure; SubcategoriesReportedValues = subcategoriesReportedValues; DisplayCssClass = displayCssClass; }