public async Task <IActionResult> My() { var matchInstance = await GetCurrentMatchInstance(); if (matchInstance == null) { return(Error("请先选择具体赛事")); } var prizes = await PrizeRepository.GetAll().Include(o => o.PrizeSubMajors).Where(o => o.MatchInstanceId == matchInstance.Id && o.IsActive).ToListAsync(); foreach (var prize in prizes) { foreach (var prizeSubMajor in prize.PrizeSubMajors) { await PrizeSubMajorRepository.EnsurePropertyLoadedAsync(prizeSubMajor, o => o.Major); } } var user = await UserManager.GetByIdAsync(AbpSession.UserId.Value); ViewBag.OrganizationId = user.OrganizationId; ViewData["matchInstance"] = matchInstance; return(View(prizes)); }
public async Task <IActionResult> FinalReview() { var matchInstance = await GetCurrentMatchInstance(); var prizes = await PrizeRepository.GetAll().Include(o => o.PrizeSubMajors).Where(o => o.MatchInstanceId == matchInstance.Id && o.IsActive).ToListAsync(); foreach (var prize in prizes) { foreach (var prizeSubMajor in prize.PrizeSubMajors) { await PrizeSubMajorRepository.EnsurePropertyLoadedAsync(prizeSubMajor, o => o.Major); } } ViewData["matchInstance"] = matchInstance; return(View(prizes)); }
private string GenerateReportSN(Project project) { var prize = PrizeRepository.GetAll().Include(o => o.PrizeSubMajors).Include(o => o.Major).Where(o => o.Id == project.PrizeId).Single(); var mainMajorSN = prize.Major.BriefCode; var subMajorSN = ""; if (project.PrizeSubMajorId.HasValue) { var prizeSubMajor = prize.PrizeSubMajors.Where(o => o.Id == project.PrizeSubMajorId.Value).First(); PrizeSubMajorRepository.EnsurePropertyLoaded(prizeSubMajor, o => o.Major); subMajorSN = prizeSubMajor.Major.BriefCode; } var prefix = $"{DateTime.Now.ToString("yy")}-{mainMajorSN}{subMajorSN}-"; var existCount = Repository.Count(o => o.ReportSN.StartsWith(prefix)); return(prefix + PadLeft((existCount + 1).ToString(), 3)); }