public GridJsonNetJObjectResult <GeospatialArea> GeospatialAreaPerformanceMeasureTargetsGridJsonData( PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; // Get all three possible target types var noTargets = performanceMeasure.GeospatialAreaPerformanceMeasureNoTargets; var overallTargets = performanceMeasure.GeospatialAreaPerformanceMeasureFixedTargets; var reportingPeriodTargets = performanceMeasure.GeospatialAreaPerformanceMeasureReportingPeriodTargets; var allRelevantGeoSpatialAreasWithTargets = new List <GeospatialArea>(); allRelevantGeoSpatialAreasWithTargets.AddRange(noTargets.Select(nt => nt.GeospatialArea)); allRelevantGeoSpatialAreasWithTargets.AddRange(overallTargets.Select(nt => nt.GeospatialArea)); List <GeospatialArea> temp = reportingPeriodTargets .DistinctBy(rpt => $"{rpt.GeospatialAreaID}_{rpt.PerformanceMeasureID}").Select(nt => nt.GeospatialArea) .ToList(); allRelevantGeoSpatialAreasWithTargets.AddRange(temp); var gridSpec = new GeospatialAreaPerformanceMeasureTargetGridSpec(CurrentFirmaSession, performanceMeasurePrimaryKey.EntityObject); var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <GeospatialArea>(allRelevantGeoSpatialAreasWithTargets, gridSpec); return(gridJsonNetJObjectResult); }
public PartialViewResult EditPerformanceMeasureRichText( PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, EditRtfContent.PerformanceMeasureRichTextType performanceMeasureRichTextType) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; HtmlString rtfContent; switch (performanceMeasureRichTextType) { case EditRtfContent.PerformanceMeasureRichTextType.CriticalDefinitions: rtfContent = performanceMeasure.CriticalDefinitionsHtmlString; break; case EditRtfContent.PerformanceMeasureRichTextType.ProjectReporting: rtfContent = performanceMeasure.ProjectReportingHtmlString; break; case EditRtfContent.PerformanceMeasureRichTextType.Importance: rtfContent = performanceMeasure.ImportanceHtmlString; break; case EditRtfContent.PerformanceMeasureRichTextType.AdditionalInformation: rtfContent = performanceMeasure.AdditionalInformationHtmlString; break; default: throw new ArgumentOutOfRangeException( $"Invalid PerformanceMeasure Rich Text Content Type: '{performanceMeasureRichTextType}'"); } var viewModel = new EditRtfContentViewModel(rtfContent); return(ViewEditGuidance(viewModel, performanceMeasureRichTextType)); }
public PartialViewResult DefinitionAndGuidance(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var viewData = new DefinitionAndGuidanceViewData(performanceMeasure); return(RazorPartialView <DefinitionAndGuidance, DefinitionAndGuidanceViewData>(viewData)); }
public PartialViewResult DeletePerformanceMeasure(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var viewModel = new ConfirmDialogFormViewModel(performanceMeasure.PerformanceMeasureID); return(ViewDeletePerformanceMeasure(performanceMeasure, viewModel)); }
public PartialViewResult EditSubcategoriesAndOptions(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var viewModel = new EditSubcategoriesAndOptionsViewModel(performanceMeasure); return(ViewEditSubcategoriesAndOptions(viewModel)); }
public ActionResult Edit(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey, PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, EditPerformanceMeasureTargetsViewModel viewModel) { var geospatialArea = geospatialAreaPrimaryKey.EntityObject; var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewEdit(geospatialArea, performanceMeasure, viewModel)); } HttpRequestStorage.DatabaseEntities.PerformanceMeasureReportingPeriods.Load(); HttpRequestStorage.DatabaseEntities.GeospatialAreaPerformanceMeasureNoTargets.Load(); HttpRequestStorage.DatabaseEntities.GeospatialAreaPerformanceMeasureFixedTargets.Load(); HttpRequestStorage.DatabaseEntities.GeospatialAreaPerformanceMeasureReportingPeriodTargets.Load(); viewModel.UpdateModel( geospatialArea, performanceMeasure, HttpRequestStorage.DatabaseEntities.AllPerformanceMeasureReportingPeriods.Local, HttpRequestStorage.DatabaseEntities.AllGeospatialAreaPerformanceMeasureNoTargets.Local, HttpRequestStorage.DatabaseEntities.AllGeospatialAreaPerformanceMeasureFixedTargets.Local, HttpRequestStorage.DatabaseEntities.AllGeospatialAreaPerformanceMeasureReportingPeriodTargets.Local ); SetMessageForDisplay($"Successfully saved {FieldDefinitionEnum.PerformanceMeasure.ToType().GetFieldDefinitionLabel()} Targets"); return(new ModalDialogFormJsonResult()); }
public ViewResult Detail(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var canManagePerformanceMeasure = new PerformanceMeasureManageFeature().HasPermissionByFirmaSession(CurrentFirmaSession); var isAdmin = new FirmaAdminFeature().HasPermissionByFirmaSession(CurrentFirmaSession); var performanceMeasureChartViewData = new PerformanceMeasureChartViewData(performanceMeasure, CurrentFirmaSession, false, canManagePerformanceMeasure, performanceMeasure.GetAssociatedProjectsWithReportedValues(CurrentFirmaSession)); // Avoid scrolling the legend if it can be displayed on two lines performanceMeasureChartViewData.ViewGoogleChartViewData.GoogleChartJsons.ForEach(x => { if (x.GoogleChartConfiguration.Legend != null && x.GoogleChartConfiguration.Legend.MaxLines == null) { x.GoogleChartConfiguration.Legend.MaxLines = 2; } }); var entityNotesViewData = new EntityNotesViewData( EntityNote.CreateFromEntityNote(performanceMeasure.PerformanceMeasureNotes), SitkaRoute <PerformanceMeasureNoteController> .BuildUrlFromExpression(c => c.New(performanceMeasure.PrimaryKey)), performanceMeasure.PerformanceMeasureDisplayName, canManagePerformanceMeasure); var viewData = new DetailViewData(CurrentFirmaSession, performanceMeasure, performanceMeasureChartViewData, entityNotesViewData, canManagePerformanceMeasure, isAdmin); return(RazorView <Detail, DetailViewData>(viewData)); }
public ActionResult Edit(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, EditViewModel viewModel) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewEdit(viewModel)); } viewModel.UpdateModel(performanceMeasure, CurrentFirmaSession); if (performanceMeasure.CanBeChartedCumulatively) { foreach (var pmSubcategory in performanceMeasure.PerformanceMeasureSubcategories) { //Check for cumulative chart config and create if one doesn't exist if (!pmSubcategory.ShowOnCumulativeChart()) { var targetSubcategoryChartConfigurationJson = performanceMeasure.GetDefaultPerformanceMeasureChartConfigurationJson(); pmSubcategory.CumulativeChartConfigurationJson = JObject.FromObject(targetSubcategoryChartConfigurationJson).ToString(); pmSubcategory.CumulativeGoogleChartTypeID = performanceMeasure.HasTargets() ? GoogleChartType.ComboChart.GoogleChartTypeID : GoogleChartType.ColumnChart.GoogleChartTypeID; } } } return(new ModalDialogFormJsonResult(performanceMeasure.GetSummaryUrl())); }
public PartialViewResult Edit(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var viewModel = new EditViewModel(performanceMeasure); return(ViewEdit(viewModel)); }
public PartialViewResult ResetChartConfiguration(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, int performanceMeasureSubcategoryID, PerformanceMeasureSubcategoryChartConfiguration chartConfiguration) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var viewModel = new ConfirmDialogFormViewModel(performanceMeasure.PerformanceMeasureID); return(ViewResetChartConfiguration(performanceMeasure, viewModel)); }
public ActionResult EditPerformanceMeasureReportedValues( PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var viewModel = new EditPerformanceMeasureTargetsViewModel(performanceMeasure); return(ViewEditPerformanceMeasureReportedValues(performanceMeasure, viewModel)); }
public PartialViewResult AddGeospatialAreaToPerformanceMeasure(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var viewModel = new AddGeospatialAreaToPerformanceMeasureViewModel(performanceMeasure); return(ViewAddGeospatialAreaToPerformanceMeasure(performanceMeasure, viewModel)); }
public ActionResult Edit(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey, PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { //throw new NotImplementedException("Edit has not been implemented"); var geospatialArea = geospatialAreaPrimaryKey.EntityObject; var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var viewModel = new EditPerformanceMeasureTargetsViewModel(geospatialArea, performanceMeasure); return(ViewEdit(geospatialArea, performanceMeasure, viewModel)); }
public PartialViewResult Edit(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var taxonomyTierPerformanceMeasureSimples = performanceMeasure.GetTaxonomyTiers().Select(x => new TaxonomyTierPerformanceMeasureSimple(x.Key.TaxonomyTierID, x.First().PerformanceMeasureID)).ToList(); var viewModel = new EditViewModel(taxonomyTierPerformanceMeasureSimples); return(ViewEdit(viewModel, performanceMeasure)); }
public GridJsonNetJObjectResult <PerformanceMeasureExpected> PerformanceMeasureExpectedsGridJsonData( PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasureExpecteds = GetPerformanceMeasureExpectedsAndGridSpec(out var gridSpec, performanceMeasurePrimaryKey.EntityObject); var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <PerformanceMeasureExpected>(performanceMeasureExpecteds, gridSpec); return(gridJsonNetJObjectResult); }
public GridJsonNetJObjectResult <PerformanceMeasureReportedValue> PerformanceMeasureReportedValuesGridJsonData( PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasureActuals = GetPerformanceMeasureReportedValuesAndGridSpec(out var gridSpec, performanceMeasurePrimaryKey.EntityObject, CurrentFirmaSession); var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <PerformanceMeasureReportedValue>(performanceMeasureActuals, gridSpec); return(gridJsonNetJObjectResult); }
SpendingByPerformanceMeasureByProjectGridJsonData(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var performanceMeasureSubcategoriesTotalReportedValues = GetSpendingByPerformanceMeasureByProjectAndGridSpec(out var gridSpec, performanceMeasure, CurrentFirmaSession); var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <PerformanceMeasureSubcategoriesTotalReportedValue>( performanceMeasureSubcategoriesTotalReportedValues, gridSpec); return(gridJsonNetJObjectResult); }
public ActionResult Edit(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, EditViewModel viewModel) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewEdit(viewModel)); } viewModel.UpdateModel(performanceMeasure, CurrentPerson); return(new ModalDialogFormJsonResult(performanceMeasure.GetSummaryUrl())); }
public ActionResult DeletePerformanceMeasure(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, ConfirmDialogFormViewModel viewModel) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewDeletePerformanceMeasure(performanceMeasure, viewModel)); } performanceMeasure.DeleteFull(HttpRequestStorage.DatabaseEntities); SetMessageForDisplay($"Successfully deleted {MultiTenantHelpers.GetPerformanceMeasureName()} '{performanceMeasure.PerformanceMeasureDisplayName}'!"); return(new ModalDialogFormJsonResult()); }
public ActionResult Edit(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, EditViewModel viewModel) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewEdit(viewModel, performanceMeasure)); } HttpRequestStorage.DatabaseEntities.ProjectTypePerformanceMeasures.Load(); viewModel.UpdateModel(performanceMeasure.ProjectTypePerformanceMeasures.ToList(), HttpRequestStorage.DatabaseEntities.ProjectTypePerformanceMeasures.Local); return(new ModalDialogFormJsonResult()); }
public ActionResult AddGeospatialAreaToPerformanceMeasure(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, AddGeospatialAreaToPerformanceMeasureViewModel viewModel) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewAddGeospatialAreaToPerformanceMeasure(performanceMeasure, viewModel)); } viewModel.UpdateModel(CurrentFirmaSession, performanceMeasure); return(new ModalDialogFormJsonResult()); }
public ActionResult EditPerformanceMeasureRichText(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, EditRtfContent.PerformanceMeasureRichTextType performanceMeasureRichTextType, EditRtfContentViewModel viewModel) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewEditGuidance(viewModel, performanceMeasureRichTextType)); } viewModel.UpdateModel(performanceMeasure, performanceMeasureRichTextType); return(new ModalDialogFormJsonResult()); }
public ActionResult EditSubcategoriesAndOptions(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, EditSubcategoriesAndOptionsViewModel viewModel) { if (!ModelState.IsValid) { return(ViewEditSubcategoriesAndOptions(viewModel)); } var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; viewModel.UpdateModel(performanceMeasure); SetMessageForDisplay($"Successfully updated {MultiTenantHelpers.GetPerformanceMeasureName()} '{performanceMeasure.PerformanceMeasureDisplayName}'!"); return(new ModalDialogFormJsonResult()); }
public ActionResult New(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, EditNoteViewModel viewModel) { if (!ModelState.IsValid) { return(ViewEdit(viewModel)); } var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var performanceMeasureNote = PerformanceMeasureNote.CreateNewBlank(performanceMeasure); viewModel.UpdateModel(performanceMeasureNote, CurrentFirmaSession); HttpRequestStorage.DatabaseEntities.AllPerformanceMeasureNotes.Add(performanceMeasureNote); return(new ModalDialogFormJsonResult()); }
public ActionResult SaveChartConfiguration(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, PerformanceMeasureSubcategoryPrimaryKey performanceMeasureSubcategoryPrimaryKey, GoogleChartConfigurationViewModel viewModel) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var performanceMeasureSubcategoryID = performanceMeasureSubcategoryPrimaryKey.EntityObject.PerformanceMeasureSubcategoryID; if (!ModelState.IsValid) { SetErrorForDisplay("Unable to save chart configuration: Unsupported options."); } else { viewModel.UpdateModel(performanceMeasure, performanceMeasureSubcategoryID); } return(RedirectToAction(new SitkaRoute <PerformanceMeasureController>(x => x.Detail(performanceMeasure)))); }
public ActionResult ResetChartConfiguration(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, PerformanceMeasureSubcategoryPrimaryKey performanceMeasureSubcategoryPrimaryKey, ConfirmDialogFormViewModel viewModel) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var performanceMeasureSubcategoryID = performanceMeasureSubcategoryPrimaryKey.EntityObject.PerformanceMeasureSubcategoryID; if (!ModelState.IsValid) { SetErrorForDisplay("Error resetting chart configuration."); return(ViewResetChartConfiguration(performanceMeasure, viewModel)); } var performanceMeasureSubcategory = performanceMeasure.PerformanceMeasureSubcategories.Single(x => x.PerformanceMeasureSubcategoryID == performanceMeasureSubcategoryID); var defaultSubcategoryChartConfigurationJson = PerformanceMeasureModelExtensions.GetDefaultPerformanceMeasureChartConfigurationJson(performanceMeasure); performanceMeasureSubcategory.ChartConfigurationJson = JObject.FromObject(defaultSubcategoryChartConfigurationJson).ToString(); performanceMeasureSubcategory.GoogleChartTypeID = GoogleChartType.ColumnChart.GoogleChartTypeID; return(new ModalDialogFormJsonResult()); }
public ActionResult ResetChartConfiguration(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, int performanceMeasureSubcategoryID, PerformanceMeasureSubcategoryChartConfiguration chartConfiguration, ConfirmDialogFormViewModel viewModel) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; if (!ModelState.IsValid) { SetErrorForDisplay("Error resetting chart configuration."); return(ViewResetChartConfiguration(performanceMeasure, viewModel)); } var performanceMeasureSubcategory = performanceMeasure.PerformanceMeasureSubcategories.Single(x => x.PerformanceMeasureSubcategoryID == performanceMeasureSubcategoryID); GoogleChartConfiguration defaultSubcategoryChartConfigurationJson = performanceMeasure.GetDefaultPerformanceMeasureChartConfigurationJson(); switch (chartConfiguration) { case PerformanceMeasureSubcategoryChartConfiguration.ChartConfiguration: performanceMeasureSubcategory.ChartConfigurationJson = JObject.FromObject(defaultSubcategoryChartConfigurationJson).ToString(); performanceMeasureSubcategory.GoogleChartTypeID = GoogleChartType.ColumnChart.GoogleChartTypeID; break; case PerformanceMeasureSubcategoryChartConfiguration.CumulativeConfiguration: performanceMeasureSubcategory.CumulativeChartConfigurationJson = JObject.FromObject(defaultSubcategoryChartConfigurationJson).ToString(); performanceMeasureSubcategory.CumulativeGoogleChartTypeID = GoogleChartType.ColumnChart.GoogleChartTypeID; break; default: throw new ArgumentOutOfRangeException( $"Invalid PerformanceMeasureSubcategoryChartConfiguration: '{chartConfiguration}'"); } return(new ModalDialogFormJsonResult()); }
public ActionResult Delete(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey, PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, ConfirmDialogFormViewModel viewModel) { var geospatialArea = geospatialAreaPrimaryKey.EntityObject; var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewDelete(geospatialArea, performanceMeasure, viewModel)); } // no target var geospatialAreaPerformanceMeasureNoTargets = HttpRequestStorage.DatabaseEntities.GeospatialAreaPerformanceMeasureNoTargets.Where(x => x.GeospatialAreaID == geospatialArea.GeospatialAreaID && x.PerformanceMeasureID == performanceMeasure.PerformanceMeasureID); foreach (var noTarget in geospatialAreaPerformanceMeasureNoTargets) { noTarget.DeleteFull(HttpRequestStorage.DatabaseEntities); } // fixed target var areaPerformanceMeasureFixedTargets = HttpRequestStorage.DatabaseEntities.GeospatialAreaPerformanceMeasureFixedTargets.Where(x => x.GeospatialAreaID == geospatialArea.GeospatialAreaID && x.PerformanceMeasureID == performanceMeasure.PerformanceMeasureID); foreach (var overallTarget in areaPerformanceMeasureFixedTargets) { overallTarget.DeleteFull(HttpRequestStorage.DatabaseEntities); } // target per year var geospatialAreaPerformanceMeasureTargets = HttpRequestStorage.DatabaseEntities.GeospatialAreaPerformanceMeasureReportingPeriodTargets.Where(x => x.GeospatialAreaID == geospatialArea.GeospatialAreaID && x.PerformanceMeasureID == performanceMeasure.PerformanceMeasureID); foreach (var geoTarget in geospatialAreaPerformanceMeasureTargets) { geoTarget.DeleteFull(HttpRequestStorage.DatabaseEntities); } return(new ModalDialogFormJsonResult()); }
public PartialViewResult Delete(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey, PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { //throw new NotImplementedException("Delete is not implemented"); var geospatialArea = geospatialAreaPrimaryKey.EntityObject; var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var viewModel = new ConfirmDialogFormViewModel(geospatialArea.GeospatialAreaID); return(ViewDelete(geospatialArea, performanceMeasure, viewModel)); }
public ContentResult SaveChartConfiguration(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, int performanceMeasureSubcategoryID, PerformanceMeasureSubcategoryChartConfiguration chartConfiguration) { return(new ContentResult()); }