/// <summary>
        /// 项目申报页
        /// </summary>
        /// <param name="prizeId"></param>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public async Task <IActionResult> Post(int prizeId, int?subMajorId, int?projectId)
        {
            var matchInstance = await GetCurrentMatchInstance();

            var prize = await PrizeManager.GetByIdAsync(prizeId);

            var matchResources = await MatchResourceRepository.GetAll().Where(o => o.MajorId == prize.MajorId && o.MatchInstanceId == matchInstance.Id && o.MatchResourceStatus == Matches.MatchResourceStatus.Publish).ToListAsync();

            ViewData["matchResources"] = matchResources;
            ViewData["subMajorId"]     = subMajorId == null?"":subMajorId.Value.ToString();
            ViewData["matchRemarks"]   = matchInstance.Remarks;
            ViewData["prizeRemarks"]   = prize.Remarks;

            ViewBag.ProjectId = projectId;
            //第三级专业
            List <string> ThirdLevelMajors = new List <string>();

            if (subMajorId != null)
            {
                var childMajors = await MajorManager.FindChildrenAsync(null, matchInstance.Id, subMajorId);

                ThirdLevelMajors = childMajors.OrderBy(o => o.Sort).Select(o => o.BriefName).ToList();
            }
            ViewData["ThirdLevelMajors"] = ThirdLevelMajors;
            //所有单位
            var organizations = (await OrganizationManager.FindChildrenAsync(null, true));

            ViewData["organizations"] = organizations;
            ViewData["matchInstance"] = matchInstance;
            return(View(prize));
        }
Пример #2
0
        public virtual async Task <IViewComponentResult> InvokeAsync(int projectId)
        {
            ViewData["OriProjectId"] = projectId;//原始projectId,用于区分下面的关联ProjectId
            var project = await ProjectManager.GetByIdAsync(projectId);

            if (project.ProjectSource == ProjectSource.CrossMatch)
            {
                project = project.CrossProject;
            }
            var prize = await PrizeManager.GetByIdAsync(project.PrizeId);

            ProjectManager.Repository.EnsurePropertyLoaded(project, o => o.PrizeSubMajor);
            var matchInstance = await MatchInstanceManager.Repository.GetAllIncluding(o => o.Match).Where(o => o.Id == project.MatchInstanceId).FirstOrDefaultAsync();

            var matchResources = await MatchResourceManager.Repository.GetAll().Where(o => o.MajorId == prize.MajorId && o.MatchInstanceId == project.MatchInstanceId && o.MatchResourceStatus == Matches.MatchResourceStatus.Publish).ToListAsync();

            ViewData["matchInstance"]  = matchInstance;
            ViewData["matchResources"] = matchResources;
            ViewData["subMajorId"]     = project.PrizeSubMajor == null ? "" : project.PrizeSubMajor.MajorId.ToString();
            //第三级专业
            List <string> ThirdLevelMajors = new List <string>();

            if (project.PrizeSubMajor != null)
            {
                var childMajors = await MajorManager.FindChildrenAsync(null, project.MatchInstanceId, project.PrizeSubMajor.MajorId);

                ThirdLevelMajors = childMajors.OrderBy(o => o.Sort).Select(o => o.BriefName).ToList();
            }
            ViewData["ThirdLevelMajors"] = ThirdLevelMajors;
            ViewData["ProjectId"]        = project.Id;
            return(View(prize));
        }
        public async Task <IActionResult> SelProject(int reviewId)
        {
            var review = await ReviewRepository.GetAllIncluding(o => o.Major).Where(o => o.Id == reviewId).SingleAsync();

            List <Major> subMajors = new List <Major>();

            if (review.SubMajorId == null)
            {
                //如果未指定专业小类,需要列出所有专业小类供查询
                subMajors = await MajorManager.FindChildrenAsync(null, review.MatchInstanceId, review.MajorId);
            }
            else
            {
                ViewBag.SubMajor = await MajorManager.GetByIdAsync(review.SubMajorId.Value);
            }
            ViewBag.SubMajors = subMajors;
            ViewBag.Exclude   = Request.Cookies["excludeProjects"];
            return(View(review));
        }
        public async Task <IActionResult> SelExcludeExpert(int reviewId)
        {
            var review = await ReviewRepository.GetAllIncluding(o => o.Major).Where(o => o.Id == reviewId).SingleAsync();

            List <Major> subMajors = new List <Major>();

            if (review.SubMajorId == null)
            {
                //如果未指定专业小类,需要列出所有专业小类供查询
                subMajors = await MajorManager.FindChildrenAsync(null, review.MatchInstanceId, review.MajorId);
            }
            else
            {
                ViewBag.SubMajor = await MajorManager.GetByIdAsync(review.SubMajorId.Value);
            }
            ViewBag.SubMajors    = subMajors;
            ViewBag.Exclude      = Request.Cookies["excludeExperts"];
            ViewBag.AllExpertIds = Request.Cookies["allExpertIds"];
            var specialities = await SpecialityManager.GetAll().OrderBy(o => o.Name).ToListAsync();

            ViewBag.Specialities = specialities;
            return(View(review));
        }