public virtual ActionResult Edit(RiskMaterializedViewModel model) { if (model == null) { model = new RiskMaterializedViewModel { ErrorMessage = Localization.GetText(Literals.RISK_MATRIX_ERROR_LOAD_REQUEST) }; return(new HttpStatusCodeResult(HttpStatusCode.NoContent, model.ErrorMessage)); } var lockRegister = LockRegister(model.OperationNumber, Request.Url.AbsoluteUri); var resultLock = (ResponseBase)lockRegister.Data; if (!resultLock.IsValid) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden, resultLock.ErrorMessage)); } model.IsEdit = true; model = GetDataCatalog(model); string pageName = "UI-RM-002-EDIT"; model.ScreenSecurity = new ScreenSecurityViewModel { PageName = pageName, Security = GetFieldsSecurity(pageName, model.OperationNumber, IDBContext.Current.Permissions) .SecuredFields .ToList() }; return(PartialView("~/Areas/RiskMatrix/Views/Materialized/Index.cshtml", model)); }
private RiskMaterializedViewModel GetDataCatalog(RiskMaterializedViewModel model) { var response = _materializedService.GetStageData(); model.Stages = response.IsValid ? response.Stages : new List <ListItemViewModel>(); model.MaterializedCategories = response.MaterializedCategories; model.MaterializedCategoryTitles = response.MaterializedCategoriesTitle; return(model); }
public virtual ActionResult NewIssue(RiskMaterializedViewModel model) { if (model == null) { model = new RiskMaterializedViewModel { ErrorMessage = Localization.GetText(Literals.RISK_MATRIX_ERROR_LOAD_REQUEST) }; return(new HttpStatusCodeResult(HttpStatusCode.NoContent, model.ErrorMessage)); } var newIssue = model.MaterializedRisks.LastOrDefault(); model = GetDataCatalog(model); model.MaterializedRisks.Add(new MaterializedViewModel() { Actions = string.Empty, Category = string.Empty, Causes = false, CurrentCompletationDate = null, Description = string.Empty, ExpectedCompletationDate = null, FindingsRecommendations = false, MaterializedCode = newIssue != null ? newIssue.MaterializedCode + 1 : default(int) + 1, MaterializedId = default(int), OperationImpact = string.Empty, Question = string.Empty, RiskId = null, StageId = null, StageName = string.Empty, FindingRecommendationId = default(int), FindingRecommendationVM = new FindingRecommendationViewModel() { CategoriesRelated = model.MaterializedCategories.Select(r => new FindingRecommendationCategoryViewModel() { CategoryId = r.MasterDataId, ParentId = r.MasterDataParentId, CategoryName = r.NameEn, Selected = false }).ToList(), FindingRecommendationId = default(int), } }); return(PartialView("~/Areas/RiskMatrix/Views/Controls/NewIssue.cshtml", model)); }
public virtual ActionResult Save(RiskMaterializedViewModel model) { if (model == null) { model = new RiskMaterializedViewModel { ErrorMessage = Localization.GetText(Literals.RISK_MATRIX_ERROR_LOAD_REQUEST) }; return(new HttpStatusCodeResult(HttpStatusCode.NoContent, model.ErrorMessage)); } var request = new RiskMaterializedSaveRequest { OperationNumber = model.OperationNumber, RiskMaterialized = model.MaterializedRisks }; var result = request.ValidateRequest(); if (!request.IsValid) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, result.FirstOrDefault().ErrorMessage)); } var response = _materializedService.SaveMaterialized(request); if (!response.IsValid) { model.IsEdit = true; model.ErrorMessage = response.ErrorMessage; string pageName = "UI-RM-002-EDIT"; model.ScreenSecurity = new ScreenSecurityViewModel { PageName = pageName, Security = GetFieldsSecurity(pageName, model.OperationNumber, IDBContext.Current.Permissions) .SecuredFields .ToList() }; return(View("~/Areas/RiskMatrix/Views/Materialized/Index.cshtml", model)); } return(RedirectToAction("Index", new { operationNumber = model.OperationNumber })); }
public virtual ActionResult Index(string operationNumber) { ForceUnlockRegister(operationNumber, Request.Path); var resultResponse = _materializedService.GetAllMaterialized(new RiskMaterializedRequest() { OperationNumber = operationNumber }); RiskMaterializedViewModel model = new RiskMaterializedViewModel() { OperationNumber = operationNumber, IsEdit = false }; if (!resultResponse.IsValid) { model.ErrorMessage = resultResponse.ErrorMessage; } else { model = GetDataCatalog(model); model.HeaderInfo.PmrCycle = resultResponse.PmrCycle; model.HeaderInfo.EsgClassfication = resultResponse.EsgClassification; model.HeaderInfo.PmrValidationStage = resultResponse.PmrValidationStage; model.HeaderInfo.ExecutingAgencies = resultResponse.ExecutingAgencies; model.HeaderInfo.LastUpdatedRisk = resultResponse.LastUpdatedRisk; model.HeaderInfo.PmrValidatedClassification = resultResponse.PmrValidatedClassification; model.HeaderInfo.SafeguardPerformance = resultResponse.SafeguardPerformance; model.MaterializedRisks = resultResponse.MaterializedRisks; } string pageName = "UI-RM-002-READ"; model.ScreenSecurity = new ScreenSecurityViewModel { PageName = pageName, Security = GetFieldsSecurity(pageName, model.OperationNumber, IDBContext.Current.Permissions) .SecuredFields .ToList() }; return(View(model)); }
public virtual ActionResult Cancel(RiskMaterializedViewModel model) { return(RedirectToAction("index", new { operationNumber = model.OperationNumber })); }