예제 #1
0
        public async Task <ActionResult> Index(string view)
        {
            var user = AbpSession.ToUserIdentifier();

            Session.Dto.LoginInformationDto loginInfo;
            try
            {
                loginInfo = await _sessionAppService.GetCurrentLoginInformations();

                var userModel = await _userManager.GetByIdAsync(user.UserId);

                if (userModel.GetData <string>("currentToken") != Request.Cookies["token"])
                {
                    throw new Exception("已在别处登录");
                }
            }
            catch
            {
                Response.Cookies.Delete("token");
                return(Redirect("/Account/Login"));
            }


            var appConfiguration = _env.GetAppConfiguration();

            ViewData["softTitle"] = appConfiguration["System:SoftTitle"];

            //默认首页
            if (loginInfo.User.HomeUrl.IsNullOrEmpty())
            {
                loginInfo.User.HomeUrl = "/Home/Default";
            }

            //申报人、分公司科管、专业负责人、集团科管进入赛事实例页页面
            if (AbpSession.IsReporter() ||
                AbpSession.IsSubManager() ||
                AbpSession.IsGroupManager() ||
                AbpSession.IsMajorManager()
                )
            {
                if (view == "resultsearch")
                {
                    return(View("ResultSearch", loginInfo));
                }
                return(View("Index_MatchInstance", loginInfo));
            }
            if (AbpSession.IsExpert())
            {
                return(View("Index_Review", loginInfo));
            }
            if (AbpSession.IsProjectViewer())
            {
                ViewData["MatchNames"] = await MatchManager.GetAll().Select(o => o.Name).ToListAsync();

                return(View("ProjectView", loginInfo));
            }
            return(View(loginInfo));
        }
        public virtual async Task <bool> GetIfMatchInstanceAvailable(int matchInstanceId)
        {
            var matchInstance = await Repository.GetAsync(matchInstanceId);

            //申报者和分公司科管及专业负责人列出所有申报中的赛事实例
            if (AbpSession.IsReporter() || AbpSession.IsSubManager() || AbpSession.IsMajorManager())
            {
                return(matchInstance.MatchInstanceStatus == MatchInstanceStatus.Applying);
            }
            //集团科管列出所有申报中评选中以及评选完成的赛事实例
            if (AbpSession.IsGroupManager())
            {
                return(matchInstance.MatchInstanceStatus == MatchInstanceStatus.Applying || matchInstance.MatchInstanceStatus == MatchInstanceStatus.Complete);
            }

            return(false);
        }
        /// <summary>
        /// 获取所有可用的赛事实例
        /// </summary>
        /// <returns></returns>
        public virtual async Task <object> GetAvailableMatchInstance()
        {
            var query = Repository.GetAllIncluding(o => o.Match);

            //add 20200828 过滤不显示的
            query = query.Where(o => o.Match.IsDisplay);
            //申报者和分公司科管及专业负责人列出所有申报中的赛事实例
            if (AbpSession.IsReporter() || AbpSession.IsSubManager() || AbpSession.IsMajorManager())
            {
                query = query.Where(o => o.MatchInstanceStatus == MatchInstanceStatus.Applying);
            }
            //集团科管列出所有申报评选中以及评选完成的赛事实例
            if (AbpSession.IsGroupManager())
            {
                query = query.Where(o => o.MatchInstanceStatus == MatchInstanceStatus.Applying || o.MatchInstanceStatus == MatchInstanceStatus.Complete);
            }

            return((await query.ToListAsync())
                   .Select(o => new { o.Id, MatchName = o.Match.Name, o.Identifier, o.DisplayGroup }));
        }