/// <summary>
 /// 根据条件获得记录列表
 /// </summary>
 /// <param name="skip"></param>
 /// <param name="top"></param>
 /// <param name="user"></param>
 /// <param name="problem"></param>
 /// <param name="contest"></param>
 /// <param name="language"></param>
 /// <param name="status"></param>
 /// <param name="order"></param>
 /// <returns></returns>
 public static List<Record> Select(int skip, int top, string user, string problem, string contest, LanguageType? language, StatusType? status, OrderByType order)
 {
     bool privillege;
     Guid uid;
     if (null == Domain.User.CurrentUser)
     {
         uid = Guid.Empty;
         privillege = false;
     }
     else
     {
         uid = Domain.User.CurrentUser.ID;
         privillege = Domain.User.CurrentUser.IsAdmin;
     }
     using (var db = new CHDB())
     {
         return (from r in db.RecordList(top, skip, user, problem, contest, (int?)status, (int?)language, (int?)order, privillege, uid)
                 select new Record
                 {
                     CodeLength = (int)r.CodeLength,
                     Contest = r.Contest,
                     ExecutedTime = null != r.ExecutedTime ? (TimeSpan?)TimeSpan.FromMilliseconds((int)r.ExecutedTime) : null,
                     ID = (Guid)r.ID,
                     Language = (LanguageType)r.Language,
                     Memory = r.MemoryUsed,
                     Problem = r.Problem,
                     Score = r.Score,
                     Status = (StatusType?)r.Status,
                     SubmitTime = (DateTime)r.SubmitTime,
                     User = r.User
                 }).ToList();
     }
 }