public virtual ActionResult ECOWorkflow(string operationNumber, TaskDataModel model)
        {
            var    pmodel       = _eswcipService.GetProposal(model.Parameters[K2ECOHelpers.TagProposalId].ToString(), model.Parameters[K2ECOHelpers.TagProposalYear].ToString(), model.Parameters[K2ECOHelpers.TagProposalType].ToString());
            var    operation    = _operationRepository.GetOne(o => o.OperationNumber.Equals(operationNumber));
            var    userData     = _operationTeamDataRepository.GetOne(o => o.OperationId.Equals(operation.OperationId) && o.UserName.Equals(IDBContext.Current.UserName));
            string userDataRole = string.Empty;
            string userDataOrganizationalUnit = string.Empty;

            if (userData == null)
            {
                userDataRole = string.Empty;
                userDataOrganizationalUnit = string.Empty;
            }
            else
            {
                userDataRole = userData.UserRole == null ? string.Empty : LoadNameInProperLanguage(userData.UserRole);
                userDataOrganizationalUnit = userData.OrganizationalUnit == null ? string.Empty : LoadNameInProperLanguage(userData.OrganizationalUnit);
            }

            var modelTaskView = new WorkflowViewModels
            {
                ProposalId        = pmodel.Proposal.ProposalId,
                OperationModality = pmodel.Proposal.ProposalType,
                UserName          = IDBContext.Current.UserName,
                Role = model.UserProfile,
                OrganizationalUnit = userDataOrganizationalUnit,
                Instructions       = _k2IntegrationService.getInstructions(model.TaskTypeCode,
                                                                           pmodel.Proposal.ProposalType,
                                                                           !model.TaskTypeCode.Equals(K2ECOHelpers.WF_ECO_001_T1) ? model.Parameters[K2ECOHelpers.TagRole].ToString() : string.Empty),

                UserComments     = pmodel.Proposal.Comments != null ? pmodel.Proposal.Comments : new List <CommentsViewModel>(),
                TaskDataModel    = model,
                Documents        = pmodel.Proposal.DocumentProposalTasks,
                StudiesCommittee = pmodel.Proposal.StudiesCommittee
            };

            ViewBag.SerializedViewModel = IDB.Presentation.MVC4.Helpers.PageSerializationHelper.SerializeObject(modelTaskView);
            return(View(modelTaskView));
        }
Beispiel #2
0
        public virtual ActionResult ActivateGlobalPermissions(string opNum, string username)
        {
            username = username.ToUpper();
            var message   = string.Empty;
            var operation = _operationRepository.GetOne(x => x.OperationNumber == opNum);

            if (operation != null)
            {
                var operationId      = operation.OperationId;
                var operationSiteReq = _operationSiteRequestRepository.GetOne(x => x.OperationId == operationId);

                if (operationSiteReq == null)
                {
                    _operationSiteRequestRepository.Create(new OperationSiteRequest()
                    {
                        OperationId = operationId,
                        Status      = "Created",
                        Error       = "OK",
                        Created     = DateTime.Now,
                        CreatedBy   = "TestCaseManager"
                    });
                    message = "Operation " + opNum + " Global Permissions has been activated. ";
                }
                else
                {
                    message = "Operation " + opNum + " already had Global Permissions activated. ";
                }

                if (username != string.Empty)
                {
                    var teamLeaderId = _catalogService.GetConvergenceMasterDataIdByCode(MemberRoleCode.TEAM_LEADER, MasterType.MEMBER_ROLE).Id;
                    ////var fiduciarySpecialistId = _catalogService.GetConvergenceMasterDataIdByCode(MemberRoleCode.FIDUCIARY_SPECIALIST, MasterType.MEMBER_ROLE).Id;

                    var operationTeamData = _operationTeamDataRepository.GetOne(x => x.OperationId == operationId &&
                                                                                x.UserRoleId == teamLeaderId &&
                                                                                x.UserName == username);

                    ////var fiduciarySpecialistIData = _operationTeamDataRepository.GetOne(x => x.OperationId == operationId &&
                    ////                                                                x.UserRoleId == fiduciarySpecialistId &&
                    ////                                                                x.UserName == username);

                    if (operationTeamData == null)
                    {
                        _operationTeamDataRepository.Create(
                            new OperationTeamData()
                        {
                            OperationId = operationId,
                            UserRoleId  = teamLeaderId,
                            FullName    = username,
                            UserName    = username
                        });
                    }

                    ////if (fiduciarySpecialistIData == null)
                    ////{

                    ////    _operationTeamDataRepository.Create(
                    ////   new OperationTeamData()
                    ////{
                    ////       OperationId = operationId,
                    ////       UserRoleId = fiduciarySpecialistId,
                    ////       FullName = username,
                    ////       UserName = username
                    ////   });
                    ////}
                }
            }
            else
            {
                message = "Operation " + opNum + " not found in database.";
            }

            return(View(viewName: "ActivateGlobalPermissions", model: message));
        }