public static List <ContestDll.WorksType> GetWorksType() { using (ContestEntities db = new ContestEntities()) { List <ContestDll.WorksType> wt = db.WorksType.ToList(); return(wt); } }
//获取决赛评分标准 public static List <FinalsScoreStandard> GetFinalsScoreStandard() { using (ContestEntities db = new ContestEntities()) { List <FinalsScoreStandard> csExpertCore = db.FinalsScoreStandard.ToList(); return(csExpertCore); } }
/// <summary> /// 获取提交的作品 /// </summary> /// <param name="id"></param> /// <returns></returns> public static List <ContestDll.Works> GetWorksSubmitByID(long worksID) { using (ContestEntities db = new ContestEntities()) { List <ContestDll.Works> ds = db.Works.Where(p => p.WorksID == worksID).ToList(); return(ds); } }
/// <summary> /// 通过作品类别获取评分标准 /// </summary> /// <param name="worksTypeID"></param> /// <returns></returns> public static List <CSPeriodScoreStandard> GetScoreStandardByWorksType(int worksTypeID, long periodID) { using (ContestEntities db = new ContestEntities()) { List <CSPeriodScoreStandard> pS = db.CSPeriodScoreStandard.Where(p => p.WorkTypeID == worksTypeID && p.PeriodID == periodID).ToList(); return(pS); } }
/// <summary> /// 根据作品ID获取作品评分 /// </summary> /// <param name="worksID">作品ID</param> /// <returns></returns> public static List <CSWorksExpertUser> GetWorksCommentsByWorksID(long worksID) { using (ContestEntities db = new ContestEntities()) { List <CSWorksExpertUser> ds = db.CSWorksExpertUser.Where(p => p.WorksID == worksID).ToList(); return(ds); } }
/// <summary> /// 通过ID获取评分明细 /// </summary> /// <param name="worksExpertsID"></param> /// <returns></returns> public static List <RatingDetails> GetRatingDetailsByWorksExpertID(long worksExpertsID) { using (ContestEntities db = new ContestEntities()) { List <RatingDetails> details = db.RatingDetails.Where(p => p.Flag == 1 && p.WorksExpertID == worksExpertsID).ToList(); return(details); } }
/// <summary> /// 获取每个期次下分配给我评分的作品 /// </summary> /// <param name="periodId">期次ID</param> /// <param name="expertId">我的ID</param> /// <returns></returns> public static List <CSVWorksForMe> GetWorksForMeByPeriodId(long periodId, long expertId) { using (ContestEntities db = new ContestEntities()) { List <CSVWorksForMe> details = db.CSVWorksForMe.Where(p => p.ExpertID == periodId && p.PeriodID == periodId).ToList(); return(details); } }
public static long UpdateWorksSubmit(ContestEntities db, CSWorksWorksType dr) { ContestDll.Works works = db.Works.SingleOrDefault(p => p.WorksID == dr.WorksID); works.WorksState = dr.WorksState; works.Score = dr.Score; db.SaveChanges(); return(1); }
public static List <CSFinalsExpertGroup> GetExpertGroup(long contestID) { using (ContestEntities db = new ContestEntities()) { List <CSFinalsExpertGroup> csExpertCore = db.CSFinalsExpertGroup.Where(p => p.ContestID == contestID).ToList(); return(csExpertCore); } }
/// <summary> /// 获取UserID可以评审但还未分配完成的作品 /// </summary> /// <param name="userId">评分人ID</param> /// <param name="periodId">当前期次ID</param> /// <param name="allotTimes">本期互评组内人数</param> /// <returns></returns> public static List <ContestDll.Works> GetWorksToAllot(long userId, long periodId, long allotTimes) { using (ContestEntities db = new ContestEntities()) { List <ContestDll.Works> w = db.Works.Where(p => p.PeriodID == periodId && p.IsSample == 0 && p.Flag > 0 && p.CreatedBy != userId && p.AllotTimes < allotTimes).OrderBy(p => p.AllotTimes).ToList(); return(w); } }
/// <summary> /// 根据用户ID获取该用户创建的所有期次 /// </summary> /// <param name="userId">用户ID</param> /// <returns></returns> public static List <CSPeriodsCourse> GetPeriodByUserId(long userId) { using (ContestEntities db = new ContestEntities()) { List <CSPeriodsCourse> pd = db.CSPeriodsCourse.Where(p => p.CreatedBy == userId).ToList(); return(pd); } }
public static List <CSWorksTypeScoreStandard> GetWorksTypeScoreStandardByTypeID(int worksTypeID) { using (ContestEntities db = new ContestEntities()) { List <CSWorksTypeScoreStandard> ds = db.CSWorksTypeScoreStandard.Where(p => p.WorkTypeID == worksTypeID).ToList(); return(ds); } }
/// <summary> /// 获取所有期次 /// </summary> /// <returns></returns> public static List <ContestDll.Periods> GetPeriods() { using (ContestEntities db = new ContestEntities()) { List <ContestDll.Periods> pd = db.Periods.ToList(); return(pd); } }
public static ContestDll.Works GetWorksAllotTimesByWorsID(long WorksID) { using (ContestEntities db = new ContestEntities()) { ContestDll.Works works = db.Works.SingleOrDefault(p => p.WorksID == WorksID); return(works); } }
/// <summary> /// 获取所有竞赛列表 /// </summary> /// <returns></returns> public static List <ContestDll.Course> GetCourses() { using (ContestEntities db = new ContestEntities()) { List <ContestDll.Course> cList = db.Course.ToList(); return(cList); } }
//当前作家待评作品 public static List <CSFinalsExpertWillScore> GetFinalsExpertWillScore(int groupID, long expertID) { using (ContestEntities db = new ContestEntities()) { List <CSFinalsExpertWillScore> csExpertCore = db.CSFinalsExpertWillScore.Where(p => p.ExpertID != expertID && p.GroupID != groupID).ToList(); return(csExpertCore); } }
/// <summary> /// 获取每个作品的评分信息 /// </summary> /// <param name="worksID"></param> /// <returns></returns> public static List <WorksExpert> GetWorksExpertByWorksID(long worksID) { using (ContestEntities db = new ContestEntities()) { List <WorksExpert> works = db.WorksExpert.Where(p => p.WorksID == worksID).ToList(); return(works); } }
/// <summary> /// 获取期次下的学生作品 /// </summary> /// <param name="periodID"></param> /// <returns></returns> public static List <CSWorksWorksType> GetWorksByPeriodID(long periodID) { using (ContestEntities db = new ContestEntities()) { List <CSWorksWorksType> works = db.CSWorksWorksType.Where(p => p.PeriodID == periodID).ToList(); return(works); } }
/// <summary> /// 获取评分标准的子级 /// </summary> /// <returns></returns> public static List <ScoreStandard> GetScoreStandardSubLevel() { using (ContestEntities db = new ContestEntities()) { List <ScoreStandard> cs = db.ScoreStandard.Where(p => p.Flag == 1).ToList(); return(cs); } }
/// <summary> /// 获取每个作品的评分信息 /// </summary> /// <param name="worksID"></param> /// <returns></returns> public static int GetWorksNumByPeriodID(long PeriodID) { using (ContestEntities db = new ContestEntities()) { List <ContestDll.Works> file = db.Works.Where(p => p.IsSample == 0 && p.Flag > 0 && p.PeriodID == PeriodID).ToList(); return(file.Count); } }
/// <summary> /// 获取公示的作品,以提交 作品并审批通过 /// </summary> /// <returns></returns> /// <summary> /// 获取我的作品 /// </summary> /// <param name="userAccount"></param> /// <returns></returns> public static List <CSMyWorks> GetMyWorks(long userID) { using (ContestEntities db = new ContestEntities()) { List <CSMyWorks> ds = db.CSMyWorks.Where(p => p.UserID == userID).ToList(); return(ds); } }
/// <summary> /// 获取公示的作品,以提交 作品并审批通过 /// </summary> /// <returns></returns> public static List <CSWorksPublic> GetWorksPublic(long contestID) { using (ContestEntities db = new ContestEntities()) { List <CSWorksPublic> ds = db.CSWorksPublic.Where(p => p.PeriodID == contestID).ToList(); return(ds); } }
public static CSWorksWorksType GetWorksByWorksID(long WorksID) { using (ContestEntities db = new ContestEntities()) { CSWorksWorksType wk = db.CSWorksWorksType.SingleOrDefault(p => p.WorksID == WorksID); return(wk); } }
public static List <CSPeriodsCourse> GetPeriodsList() { using (ContestEntities db = new ContestEntities()) { List <CSPeriodsCourse> ps = db.CSPeriodsCourse.ToList(); return(ps); } }
/// <summary> /// 获取顶级作品类型 /// </summary> /// <returns></returns> public static List <ContestDll.WorksType> GetWorksTypeTopLevel() { using (ContestEntities db = new ContestEntities()) { List <ContestDll.WorksType> ds = db.WorksType.Where(p => p.ParentID == 0).ToList(); return(ds); } }
/// <summary> /// 根据竞赛名称获取竞赛信息 /// </summary> /// <param name="name"></param> /// <returns></returns> public static ContestDll.Course GetCourseByName(string name) { using (ContestEntities db = new ContestEntities()) { ContestDll.Course c = db.Course.SingleOrDefault(p => p.CourseName == name); return(c); } }
/// <summary> /// 执行原始SQL命令 /// </summary> /// <param name="commandText">SQL命令</param> /// <param name="parameters">参数</param> /// <returns>影响的记录数</returns> public Object[] ExecuteSqlNonQuery <T>(string commandText, params Object[] parameters) { using (ContestEntities context = new ContestEntities()) { var results = context.Database.SqlQuery <T>(commandText, parameters); results.Single(); return(parameters); } }
public static long UpdateRatingDetails(ContestEntities db, RatingDetails dr) { RatingDetails dr1 = db.RatingDetails.SingleOrDefault(p => p.RatingDetailsID == dr.RatingDetailsID); dr1.Score = dr.Score; dr1.Flag = dr.Flag; db.SaveChanges(); return(1); }
/// <summary> /// 作品评分 /// </summary> /// <returns></returns> public static int WorksScore(long worksExpertID, long worksID, long expertID, SortedList <int, int> scoreDeltails, string txtPingYu) { List <RatingDetails> dtDetail = DAL.Works.GetRatingDetailsByWorksExpertID(worksExpertID); ContestEntities db = new ContestEntities(); using (TransactionScope scope = new TransactionScope()) { try { int scores = 0; for (int i = 0; i < scoreDeltails.Count; i++) { int standardID = scoreDeltails.Keys[i]; RatingDetails dr; List <RatingDetails> drs; drs = dtDetail.Where(p => p.StandardID == standardID).ToList();// ("StandardID=" + standardID); if (drs.Count > 0) { dr = drs[0]; } else { dr = new RatingDetails(); dr.WorksExpertID = worksExpertID; dr.StandardID = standardID; dr.Flag = 1; } dr.Score = scoreDeltails[standardID]; if (drs.Count == 0) { DAL.Works.InsertRatingDetails(db, dr); } else { DAL.Works.UpdateRatingDetails(db, dr); } scores += scoreDeltails[standardID]; } WorksExpert drWorksExpert = DAL.Works.GetWorksExpertByID(worksExpertID)[0]; drWorksExpert.Score = scores; drWorksExpert.Comments = txtPingYu; drWorksExpert.Modified = DateTime.Now; DAL.Works.UpdateWorksExpert(db, drWorksExpert); scope.Complete(); return(1); } catch { scope.Dispose(); return(0); } } }
public static List <long?> GetUserIdByPeriodId(long periodId) { using (ContestEntities db = new ContestEntities()) { List <ContestDll.Works> w = db.Works.Where(p => (long)p.PeriodID == periodId && p.IsSample == 0 && p.Flag > 0).ToList(); List <long?> wd = w.Select(p => p.CreatedBy).Distinct().ToList(); //.Select(p => p.CreatedBy).ToList();//.Select(p => p.WorksID == 1).Distinct().ToList(); return(wd); } }