/// <summary> /// 从当前对象创建数据库查询句柄对象。 /// </summary> /// <returns>数据库查询句柄。</returns> internal SubmissionQueryHandle GetQueryHandle() { SubmissionQueryHandle handle = new SubmissionQueryHandle() { ProblemId = ProblemId, UseProblemId = QueryByProblemId, ContestId = ContestId, UseContestId = QueryByContestId, Username = Username, UseUsername = QueryByUsername, TeamId = TeamId, UseTeamId = QueryByTeamId, Language = (DatabaseLanguage)Language, UseLanguage = QueryByLanguage, VerdictResult = (DatabaseVerdict)Verdict, UseVerdictResult = QueryByVerdict }; return(handle); }
/// <summary> /// 获取当前正处在等待评测状态的用户提交中创建时间最早的一条用户提交的句柄。 /// </summary> /// <returns>当前正处在等待评测状态的用户提交中创建时间最早的一条用户提交的句柄。若不存在这样的用户提交,返回 null。</returns> public SubmissionHandle GetPendingListFront() { SubmissionQueryHandle query = new SubmissionQueryHandle() { VerdictStatus = DatabaseVerdictStatus.Pending, UseVerdictStatus = true }; IList <SubmissionEntity> set = m_factory.WithContext(context => context.QuerySubmissionEntities(query) .OrderBy(entity => entity.CreationTimestamp).Take(1).ToList()); if (set.Count == 0) { return(null); } else { return(SubmissionHandle.FromSubmissionEntity(set[0])); } }