public virtual ActionResult DeleteIndicatorWarning(int resultsMatrixId, int impactIndicatorId, int intervalId) { var accessedByAdministrator = IDBContext.Current.HasRole(Role.RM_ADMINISTRATOR); var resultModel = ClientResultsMatrix.GetLightResultsMatrixModel(new ResultsMatrixModel() { ResultsMatrixId = resultsMatrixId, AccessedByAdministrator = accessedByAdministrator }); CustomDeleteOutcomeIndicatorModel deletedModel = new CustomDeleteOutcomeIndicatorModel() { AccessedByAdministrator = accessedByAdministrator, ImpactId = impactIndicatorId, IsThirdInterval = resultModel.IsThirdInterval, ResultsMatrixId = resultModel.ResultsMatrixId, IntervalId = resultModel.Interval.IntervalId }; ViewData["defaulDeleteIndicatorMessage"] = Localization.GetText("This action cannot be undone, are you sure you wish to continue?"); if (resultModel.Interval.IntervalId == ResultsMatrixCodes.ThirdInterval || (deletedModel.AccessedByAdministrator && resultModel.IsThirdInterval)) { ViewData["thirdIntervalDeleteIndicatorMessage"] = Localization.GetText("This change will be registered on the 'Changes to the Matrix' section and you will be required to explain it. Would you like to proceed?"); } else { ViewData["thirdIntervalDeleteIndicatorMessage"] = string.Empty; } return(PartialView(deletedModel)); }
public virtual ActionResult Delete(CustomDeleteOutcomeIndicatorModel deletedModel) { int code = 0; var resultsMatrix = ClientResultsMatrix.FindOneModel( new ResultsMatrixSpecification { ResultsMatrixId = deletedModel.ResultsMatrixId }); try { OutcomeIndicatorModel indicatorModel = ClientResultsMatrix.FindOneOutcomeIndicatorModel( new OutcomeIndicatorSpecification { OutcomeIndicatorId = deletedModel.ImpactId }); if (indicatorModel != null) { ClientResultsMatrix.DeleteOutcomeIndicator( new ResultsMatrixModel { ResultsMatrixId = deletedModel.ResultsMatrixId, IsThirdInterval = deletedModel.IsThirdInterval, AccessedByAdministrator = deletedModel.AccessedByAdministrator, Interval = new IntervalModel { IntervalId = deletedModel.IntervalId } }, indicatorModel, IDBContext.Current.UserName); code = 502; } } catch (Exception e) { Logger.GetLogger().WriteError("OutcomeIndicatorController", "Error when delete indicator", e); code = 498; } _cacheData.Remove(_outcomeIndicatorCacheName, System.Web.Caching.CacheItemRemovedReason.Removed); _cacheData.Remove(_outcomesCacheName, System.Web.Caching.CacheItemRemovedReason.DependencyChanged); return(RedirectToAction( "Edit", "Outcomes", new { operationId = resultsMatrix.OperationId, resultsMatrixId = resultsMatrix.ResultsMatrixId, code = code })); }
public virtual ActionResult Delete(CustomDeleteOutcomeIndicatorModel deletedModel) { int code = 0; var resultsMatrix = ClientResultsMatrix.FindOneModel( new ResultsMatrixSpecification { ResultsMatrixId = deletedModel.ResultsMatrixId }); try { OutcomeIndicatorModel indicatorModel = ClientResultsMatrix.FindOneOutcomeIndicatorModel( new OutcomeIndicatorSpecification { OutcomeIndicatorId = deletedModel.ImpactId }); if (indicatorModel != null) { ClientResultsMatrix.DeleteOutcomeIndicator( new ResultsMatrixModel { ResultsMatrixId = deletedModel.ResultsMatrixId, IsThirdInterval = deletedModel.IsThirdInterval, AccessedByAdministrator = deletedModel.AccessedByAdministrator, Interval = new IntervalModel { IntervalId = deletedModel.IntervalId } }, indicatorModel, IDBContext.Current.UserName); code = 502; } } catch (Exception) { code = 498; } return(RedirectToAction( "Edit", "Outcomes", new { operationId = resultsMatrix.OperationId, resultsMatrixId = resultsMatrix.ResultsMatrixId, code = code })); }
public virtual ActionResult DeleteIndicatorWarning( string order, string definition, int resultsMatrixId, int impactIndicatorId, int intervalId) { // Check if the administrator is accessing var accessedByAdministrator = IDBContext.Current.HasRole(Role.RM_ADMINISTRATOR); // Get results matrix with interval data associated to administrator var resultModel = ClientResultsMatrix.GetLightResultsMatrixModel(new ResultsMatrixModel() { ResultsMatrixId = resultsMatrixId, AccessedByAdministrator = accessedByAdministrator }); CustomDeleteOutcomeIndicatorModel deletedModel = new CustomDeleteOutcomeIndicatorModel() { AccessedByAdministrator = accessedByAdministrator, ImpactId = impactIndicatorId, IsThirdInterval = resultModel.IsThirdInterval, ResultsMatrixId = resultModel.ResultsMatrixId, IntervalId = resultModel.Interval.IntervalId, IsValidated = ClientResultsMatrix.IsValidate(impactIndicatorId), IndicatorName = string.Format("{0} {1}", order, definition) }; ViewData["defaulDeleteIndicatorMessage"] = Localization.GetText("TCM.DO.DeleteOutcomeStatement.UndoneActionMessage"); if (resultModel.Interval.IntervalId == ResultsMatrixCodes.ThirdInterval || (deletedModel.AccessedByAdministrator && resultModel.IsThirdInterval)) { ViewData["thirdIntervalDeleteIndicatorMessage"] = Localization.GetText("TCM.RCMW.RegisterChangesMany.TextMessage"); } else { ViewData["thirdIntervalDeleteIndicatorMessage"] = string.Empty; } return(PartialView(deletedModel)); }