示例#1
0
        public IHttpActionResult GetTeamUsers(string storeCode, string projectId = "")
        {
            var bll         = new ProjectUsers();
            var bllEmployee = new Employee();
            List <ProjectTeamMember> assetReps   = new List <ProjectTeamMember>();
            List <ProjectTeamMember> assetActors = new List <ProjectTeamMember>();
            List <ProjectTeamMember> assetMgrs   = new List <ProjectTeamMember>();
            var currentUser = Employee.GetSimpleEmployeeByCode(ClientCookie.UserCode);

            if (string.IsNullOrEmpty(projectId))
            {
                assetReps   = bllEmployee.GetAssetRepsByStoreCode(storeCode, currentUser.Code, ProjectUserRoleCode.AssetRep);
                assetActors = bllEmployee.GetAssetActorByStoreCode(storeCode, currentUser.Code, ProjectUserRoleCode.AssetActor);
                assetMgrs   = Employee.GetAssetRepMgrByStoreCode(storeCode);
            }
            else
            {
                assetReps   = bll.GetProjctRepsByProjectId(projectId, storeCode, ProjectUserRoleCode.AssetRep);
                assetActors = bll.GetProjctActorsByProjectId(projectId, storeCode, ProjectUserRoleCode.AssetActor, currentUser.Code);
                assetMgrs   = bll.GetProjctMgrByProjectId(projectId, storeCode, ProjectUserRoleCode.AssetManager);
            }
            return(Ok(new
            {
                AssetReps = assetReps,
                AssetActors = assetActors,
                PMs = bll.GetProjectUsers(projectId, storeCode, RoleCode.PM.ToString()),
                Finances = bll.GetProjectUsers(projectId, storeCode, RoleCode.Finance_Consultant.ToString()),
                Legals = bll.GetProjectUsers(projectId, storeCode, RoleCode.Legal_Counsel.ToString()),
                AssetMgrs = assetMgrs,
                CMs = bll.GetProjectUsers(projectId, storeCode, RoleCode.Cons_Mgr.ToString())
            }));
        }