Exemplo n.º 1
0
        public virtual ActionResult Index(
            string operationNumber,
            int state         = 0,
            int filter        = 0,
            bool showInactive = false)
        {
            SynchronizationHelper.AccessToResources(
                RMIndicatorValues.CANCEL,
                RMIndicatorValues.URL_RM_IMPACTS,
                operationNumber,
                IDBContext.Current.UserLoginName);

            new IDB.Presentation.MVC4.Controllers.CommonDocument().Log(LogType.Debug,
                                                                       "MVC4(IMP_1S) - CALL WCF MODELS EVERNEXT",
                                                                       "FindOneOperationModel -> BEFORE = OPERATION NUMBER:{0} ",
                                                                       operationNumber);

            // Retrieve OperationModel
            var operationModel = _clientResultsMatrix
                                 .FindOneOperationModel(new OperationSpecification()
            {
                OperationNumber = operationNumber
            });

            new IDB.Presentation.MVC4.Controllers.CommonDocument().Log(LogType.Debug,
                                                                       "MVC4(IMP_1E) - CALL WCF MODELS EVERNEXT",
                                                                       "FindOneOperationModel -> AFTER = RESPONSE ",
                                                                       operationModel);

            // Retrieve ResultsMatrix associated to last PMR Cycle
            ResultsMatrixModel resultMatrixModel = null;

            // Get ResultsMatrix associated to last PMR Cycle
            if (operationModel != null)
            {
                operationModel.AccessedByAdministrator =
                    IDBContext.Current.HasRole(Role.RM_ADMINISTRATOR);
                ViewBag.isLessTaskFive = PCRHelpers.IsCurrentTaskLessThanFive(
                    ClientGenericRepository, PCRWorkflowStatusRepository);

                new IDB.Presentation.MVC4.Controllers.CommonDocument().Log(LogType.Debug,
                                                                           "MVC4(IMP_2S) - CALL WCF MODELS SERVICE",
                                                                           "GetResultsMatrixModel -> BEFORE = OPERATION NUMBER:{0} ",
                                                                           operationModel);

                if (!showInactive)
                {
                    resultMatrixModel = _cacheData.Get <ResultsMatrixModel>(_impactsCacheName) ??
                                        _cacheData.Add(_impactsCacheName,
                                                       _clientResultsMatrix.GetResultsMatrixModel(operationModel, showInactive),
                                                       _timeCachingVal);
                    resultMatrixModel.AccessedByAdministrator =
                        operationModel.AccessedByAdministrator;
                }
                else
                {
                    resultMatrixModel = _clientResultsMatrix
                                        .GetResultsMatrixModel(operationModel, showInactive);
                }

                resultMatrixModel.showInactiveImpacts = showInactive;
                PutResultMatrixEopInCache(_resultMatrixEOPCacheName, resultMatrixModel);

                new IDB.Presentation.MVC4.Controllers.CommonDocument().Log(LogType.Debug,
                                                                           "MVC4(IMP_2E) - CALL WCF MODELS SERVICE",
                                                                           "GetResultsMatrixModel -> AFTER = RESPONSE: ",
                                                                           resultMatrixModel);
            }

            ViewData["filter"] = filter;

            if (state != 0)
            {
                MessageConfiguration message = MessageHandler.setMessageRMImpacts(state, false, 1);
                ViewData["message"] = message;
            }

            if (resultMatrixModel != null)
            {
                resultMatrixModel.DEMLockReviewProcessData = _demLockModulesService
                                                             .BuildLockReviewProcessDEMDataModel(operationNumber);
            }

            return(View(resultMatrixModel));
        }
Exemplo n.º 2
0
        public virtual ActionResult Index(
            string operationNumber,
            string cycleIds     = null,
            string sectionIds   = null,
            string changeIds    = null,
            string subChangeIds = null,
            bool editView       = false)
        {
            var operation = _operationRepository.GetOne(o => o.OperationNumber == operationNumber, o => o.ResultsMatrices);

            ViewBag.isLessTaskFive = PCRHelpers.IsCurrentTaskLessThanFive(
                ClientGenericRepository, PCRWorkflowStatusRepository, operation.OperationId);

            ViewBag.RMAdministrator = IDBContext.Current.HasRole(Role.RM_ADMINISTRATOR);
            ViewBag.ModelIndicators = new LinkPredefinesIndicatorViewModel {
                Name = string.Empty
            };
            ResultsMatrixModel searchResults = null;

            if (string.IsNullOrEmpty(cycleIds))
            {
                searchResults = _clientResultsMatrixChanges.GetResultsMatrixModel(new OperationModel()
                {
                    OperationNumber         = operationNumber,
                    AccessedByAdministrator = IDBContext.Current.HasRole(Role.RM_ADMINISTRATOR)
                }, operation);

                if (editView)
                {
                    return(View("Edit", searchResults));
                }

                searchResults.DEMLockReviewProcessData = _demLockModulesService
                                                         .BuildLockReviewProcessDEMDataModel(operationNumber);

                return(View(searchResults));
            }

            List <int> selectedCycles = new List <int>();

            selectedCycles =
                cycleIds.Split(',').Select(x => int.Parse(x)).ToList <int>();
            List <int>             selectedSections = new List <int>();
            List <FilterItemModel> typesBySection   = new List <FilterItemModel>();

            if (!string.IsNullOrEmpty(sectionIds))
            {
                selectedSections =
                    sectionIds.Split(',').Select(x => int.Parse(x)).ToList <int>();
                typesBySection = _clientResultsMatrixChanges
                                 .GetMatrixChangeTypesBySectionId(
                    selectedSections,
                    IDBContext.Current.CurrentLanguage).ToList();
            }

            List <int>             selectedChanges  = new List <int>();
            List <FilterItemModel> subTypesByChange = new List <FilterItemModel>();

            if (!string.IsNullOrEmpty(changeIds))
            {
                selectedChanges =
                    changeIds.Split(',').Select(x => int.Parse(x)).ToList <int>();
                subTypesByChange = _clientResultsMatrixChanges
                                   .GetMatrixChangeSubTypesByChangeTypeId(
                    selectedChanges,
                    IDBContext.Current.CurrentLanguage).ToList();
            }

            List <int> selectedSubChanges = new List <int>();

            if (!string.IsNullOrEmpty(subChangeIds))
            {
                selectedSubChanges =
                    subChangeIds.Split(',').Select(x => int.Parse(x)).ToList <int>();
            }

            searchResults = _clientResultsMatrixChanges.Search(new ResultsMatrixModel()
            {
                OperationNumber         = operationNumber,
                PmrCycleIds             = selectedCycles,
                SectionIds              = selectedSections,
                TypeOfChangeIds         = selectedChanges,
                SubTypeOfChangeIds      = selectedSubChanges,
                AccessedByAdministrator = IDBContext.Current.HasRole(Role.RM_ADMINISTRATOR)
            }, operation);
            searchResults.PmrCycleIds        = selectedCycles;
            searchResults.SectionIds         = selectedSections;
            searchResults.TypeOfChangeIds    = selectedChanges;
            searchResults.SubTypeOfChangeIds = selectedSubChanges;
            searchResults.TypeOfChanges      = typesBySection;
            searchResults.SubtypeOfChanges   = subTypesByChange;
            if (editView)
            {
                return(View("Edit", searchResults));
            }

            searchResults.DEMLockReviewProcessData = _demLockModulesService
                                                     .BuildLockReviewProcessDEMDataModel(operationNumber);

            return(View(searchResults));
        }