예제 #1
0
        public IHttpActionResult IsExists(string projectId, string userAccount, string roleCode)
        {
            var list   = ProjectUsers.Search(e => e.ProjectId == projectId && e.UserAccount == userAccount && e.RoleCode == roleCode).ToList();
            var result = list.Count > 0;

            return(Ok(result));
        }
예제 #2
0
        public IHttpActionResult IsEditer(string projectId, string nodeCode)
        {
            bool   result      = false;
            string nodeCodeStr = nodeCode.Trim().ToLower();
            //获取用户的关店流程权限
            var userRoles = ProjectUsers.Search(e => e.ProjectId == projectId &&
                                                e.UserAccount == ClientCookie.UserCode).ToList();

            if (userRoles.Count > 0)
            {
                if (nodeCodeStr == ClosureNodeInfo.WOCheckListCode.ToLower())
                {
                    result = CheckEditer(userRoles, ClosureRoleInfo.PM);
                }
                else if (nodeCodeStr == ClosureNodeInfo.LegalReviewCode.ToLower())
                {
                    result = CheckEditer(userRoles, ClosureRoleInfo.AssetActor);
                }
            }

            return(Ok(result));
        }
예제 #3
0
        public void ChangeProjectTeamMembers(string projectId, ProjectTeamMembers projectTeamMembers)
        {
            using (var scope = new TransactionScope())
            {
                #region update ProjectUsers
                var projectUsers = ProjectUsers.Search(e => e.ProjectId == projectId).AsNoTracking().ToList();
                foreach (var projectUser in projectUsers)
                {
                    switch (projectUser.RoleCode)
                    {
                    case ProjectUserRoleCode.AssetActor:
                        if (projectTeamMembers.AssetActor != null)
                        {
                            projectUser.UserAccount  = projectTeamMembers.AssetActor.UserAccount;
                            projectUser.UserNameENUS = projectTeamMembers.AssetActor.UserNameENUS;
                            projectUser.UserNameZHCN = projectTeamMembers.AssetActor.UserNameZHCN;
                        }
                        break;

                    case ProjectUserRoleCode.Finance:
                    case "Finance Team":
                        projectUser.UserAccount  = projectTeamMembers.Finance.UserAccount;
                        projectUser.UserNameENUS = projectTeamMembers.Finance.UserNameENUS;
                        projectUser.UserNameZHCN = projectTeamMembers.Finance.UserNameZHCN;
                        break;

                    case ProjectUserRoleCode.Legal:
                        if (projectTeamMembers.Legal != null)
                        {
                            projectUser.UserAccount  = projectTeamMembers.Legal.UserAccount;
                            projectUser.UserNameENUS = projectTeamMembers.Legal.UserNameENUS;
                            projectUser.UserNameZHCN = projectTeamMembers.Legal.UserNameZHCN;
                        }
                        break;

                    case ProjectUserRoleCode.PM:
                        projectUser.UserAccount  = projectTeamMembers.PM.UserAccount;
                        projectUser.UserNameENUS = projectTeamMembers.PM.UserNameENUS;
                        projectUser.UserNameZHCN = projectTeamMembers.PM.UserNameZHCN;
                        break;

                    case ProjectUserRoleCode.AssetRep:
                        projectUser.UserAccount  = projectTeamMembers.AssetRep.UserAccount;
                        projectUser.UserNameENUS = projectTeamMembers.AssetRep.UserNameENUS;
                        projectUser.UserNameZHCN = projectTeamMembers.AssetRep.UserNameZHCN;
                        break;

                    case ProjectUserRoleCode.AssetManager:
                        projectUser.UserAccount  = projectTeamMembers.AssetMgr.UserAccount;
                        projectUser.UserNameENUS = projectTeamMembers.AssetMgr.UserNameENUS;
                        projectUser.UserNameZHCN = projectTeamMembers.AssetMgr.UserNameZHCN;
                        break;

                    case ProjectUserRoleCode.CM:
                        projectUser.UserAccount  = projectTeamMembers.CM.UserAccount;
                        projectUser.UserNameENUS = projectTeamMembers.CM.UserNameENUS;
                        projectUser.UserNameZHCN = projectTeamMembers.CM.UserNameZHCN;
                        break;
                    }
                }

                ProjectUsers.Update(projectUsers.ToArray());


                #endregion

                #region update project tasks
                var projectTasks = TaskWork.Search(e => e.RefID == projectId &&
                                                   e.Status == TaskWorkStatus.UnFinish &&
                                                   e.ActivityName == "Start").AsNoTracking().ToList();

                foreach (var projectTask in projectTasks)
                {
                    UpdateProjectTaskUser(projectTask, projectTeamMembers);
                }

                UpdateProjectCreateUser(projectTeamMembers);

                TaskWork.Update(projectTasks.ToArray());
                #endregion

                #region update workflow tasks
                var workflowTasks = TaskWork.Search(e => e.RefID == projectId &&
                                                    e.Status == TaskWorkStatus.UnFinish &&
                                                    e.K2SN != null).ToList();

                ChangeProjectApprover(workflowTasks, projectTeamMembers);
                #endregion
                TaskWork.Update(workflowTasks.ToArray());

                scope.Complete();
            }
        }
예제 #4
0
        public IHttpActionResult GetRoles(string projectId, string userCode)
        {
            var projectUsers = ProjectUsers.Search(pu => pu.ProjectId == projectId && pu.UserAccount == userCode).Select(r => r.RoleCode).ToList();

            return(Ok(projectUsers));
        }
예제 #5
0
        public IHttpActionResult GetViewers(string projectId)
        {
            var results = ProjectUsers.Search(pu => pu.ProjectId == projectId && pu.RoleCode == ProjectUserRoleCode.View).ToList();

            return(Ok(results));
        }