示例#1
0
        public virtual ActionResult Reassign(int resultsMatrixId, int impactId, int impactIndicatorId)
        {
            // Check if the administrator is accessing
            var accessedByAdministrator = IDBContext.Current.HasRole(Role.RM_ADMINISTRATOR);

            // Get results matrix with interval data associated to administrator
            var lightResultModel = ClientResultsMatrix.GetLightResultsMatrixModel(new ResultsMatrixModel()
            {
                ResultsMatrixId = resultsMatrixId, AccessedByAdministrator = accessedByAdministrator
            });

            // Set impact data
            OutcomeModel currentImpact = ClientResultsMatrix.FindOneOutcomeModel(new OutcomeSpecification()
            {
                OutcomeId = impactId
            });

            // Get outcomes
            IDB.MW.Domain.Models.Architecture.ResultMatrix.Outcomes.ResultsMatrixModel resultModel = ClientResultsMatrix.FindOneModel(new ResultsMatrixSpecification()
            {
                ResultsMatrixId = resultsMatrixId
            });

            List <OutcomeModel> outcomes = resultModel.Outcomes;

            // Remove current outcome
            outcomes.RemoveAll(i => i.OutcomeId == impactId);

            // Set reassign model properties
            CustomReassignOutcomeIndicatorModel reassignModel = new CustomReassignOutcomeIndicatorModel()
            {
                Statement               = currentImpact.Statement,
                Definition              = currentImpact.OutcomeIndicators.Where(ii => ii.OutcomeIndicatorId == impactIndicatorId).SingleOrDefault <OutcomeIndicatorModel>().Definition,
                OutcomeIndicatorId      = impactIndicatorId,
                ResultsMatrixId         = lightResultModel.ResultsMatrixId,
                AccessedByAdministrator = accessedByAdministrator,
                IsThirdInterval         = lightResultModel.IsThirdInterval,
                ImpactId   = impactId,
                Outcomes   = outcomes,
                IntervalId = lightResultModel.Interval.IntervalId
            };

            return(PartialView(reassignModel));
        }