/// <summary> /// 创建一列记录 /// </summary> public static int CreateMatchJuryRelation(List <string> MatchIds, List <string> JudgeIds, List <string> Enables) { int matchId = 0; int judgeId = 0; bool enable = true; if (MatchIds.Count != JudgeIds.Count ? true : JudgeIds.Count != Enables.Count) { return(0); } Models.DB.MatchJuryRelation MatchJuryRelation; List <Models.DB.MatchJuryRelation> MatchJuryRelations = new List <Models.DB.MatchJuryRelation> (); for (int i = 0; i < MatchIds.Count; i++) { MatchJuryRelation = new Models.DB.MatchJuryRelation(); try { matchId = Convert.ToInt32(MatchIds[i]); judgeId = Convert.ToInt32(JudgeIds[i]); enable = Convert.ToBoolean(Enables[i]); } catch { return(0); } MatchJuryRelation.JudgeId = judgeId; MatchJuryRelation.MatchId = matchId; MatchJuryRelation.Enable = enable; MatchJuryRelations.Add(MatchJuryRelation); } return(DAL.Create.CreateList(MatchJuryRelations)); }
/// <summary> /// 指定MatchId统计记录数 /// </summary> /// <param name="MatchID"></param> /// <returns></returns> public static double CountJudges(string MatchID) { int matchId = 0; if (string.IsNullOrEmpty(MatchID)) { return(0); } try { matchId = Convert.ToInt32(MatchID); } catch { return(0); } Models.DB.MatchJuryRelation MatchJuryRelation = new Models.DB.MatchJuryRelation(); MatchJuryRelation.MatchId = matchId; return(DAL.Select.GetCount(MatchJuryRelation, "MatchId")); }
/// <summary> /// 指定MatchId删除 /// </summary> /// <param name="MatchID"></param> /// <returns></returns> public static int DeleteMatchJuryRelation(string MatchID) { int matchId = 0; if (string.IsNullOrEmpty(MatchID)) { return(0); } try { matchId = Convert.ToInt32(MatchID); } catch { return(0); } Models.DB.MatchJuryRelation MatchJuryRelation = new Models.DB.MatchJuryRelation(); MatchJuryRelation.MatchId = matchId; return(DAL.Delete.Work(MatchJuryRelation, "MatchId")); }
/// <summary> /// 创建一条记录 /// </summary> public static int CreateMatchJuryRelation(string MatchId, string JudgeId, string Enable) { int matchId = 0; int judgeId = 0; bool enable = true; Models.DB.MatchJuryRelation MatchJuryRelation = new Models.DB.MatchJuryRelation(); try { matchId = Convert.ToInt32(MatchId); judgeId = Convert.ToInt32(JudgeId); enable = Convert.ToBoolean(Enable); } catch { return(0); } MatchJuryRelation.JudgeId = judgeId; MatchJuryRelation.MatchId = matchId; MatchJuryRelation.Enable = enable; return(DAL.Create.CreateOne(MatchJuryRelation)); }
public static List <Models.DB.JudgeInfoModel> SelectJudges(int MatchId) { List <Models.DB.JudgeInfoModel> Judges = new List <Models.DB.JudgeInfoModel>(); Models.DB.JudgeInfoModel Judge = new Models.DB.JudgeInfoModel(); Models.DB.MatchJuryRelation MatchJuryRelation = new Models.DB.MatchJuryRelation(); MatchJuryRelation.MatchId = MatchId; System.Data.DataTable dt = DAL.Select.GetList(MatchJuryRelation, "MatchId"); System.Data.DataTable dtJudge; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { int Id = Convert.ToInt32(dt.Rows[i]["JudgeId"]); dtJudge = DAL.Select.GetOne("Tb_JudgeInfoModel", Id); if (dtJudge.Rows.Count > 0) { Judge = new Models.DB.JudgeInfoModel(); Judge.WorkUnits = dtJudge.Rows[0]["WorkUnits"].ToString(); Judge.Address = dtJudge.Rows[0]["Address"].ToString(); Judge.Background = dtJudge.Rows[0]["Background"].ToString(); Judge.CampusId = dtJudge.Rows[0]["CampusId"].ToString(); Judge.College = dtJudge.Rows[0]["College"].ToString(); Judge.JobId = dtJudge.Rows[0]["JobId"].ToString(); Judge.Mail = dtJudge.Rows[0]["Mail"].ToString(); Judge.Phone = dtJudge.Rows[0]["Phone"].ToString(); Judge.RealName = dtJudge.Rows[0]["RealName"].ToString(); Judge.Research = dtJudge.Rows[0]["Research"].ToString(); Judge.Sex = dtJudge.Rows[0]["Sex"].ToString(); Judge.Title = dtJudge.Rows[0]["Title"].ToString(); Judge.UserId = Convert.ToInt32(dtJudge.Rows[0]["UserId"]); Judge.Id = Convert.ToInt32(dtJudge.Rows[0]["Id"]); Judges.Add(Judge); } } } return(Judges); }