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 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 PartialViewResult ResetChartConfiguration(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, PerformanceMeasureSubcategoryPrimaryKey performanceMeasureSubcategoryPrimaryKey)
        {
            var performanceMeasure            = performanceMeasurePrimaryKey.EntityObject;
            var performanceMeasureSubcategory = performanceMeasureSubcategoryPrimaryKey.EntityObject;
            var viewModel = new ConfirmDialogFormViewModel(performanceMeasure.PerformanceMeasureID);

            return(ViewResetChartConfiguration(performanceMeasure, viewModel));
        }
 public ContentResult SaveChartConfiguration(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, PerformanceMeasureSubcategoryPrimaryKey performanceMeasureSubcategoryPrimaryKey)
 {
     return(new ContentResult());
 }