/// <summary> /// 选择一条记录 /// </summary> /// <param name="Id"></param> /// <returns></returns> public static Models.DB.MatchModel SelectOne(int Id) { Models.DB.MatchModel MatchModel = new Models.DB.MatchModel(); System.Data.DataTable dt = DAL.Select.GetOne("Tb_MatchModel", Id); if (dt.Rows.Count > 0) { MatchModel.Id = Convert.ToInt32(dt.Rows[0]["Id"]); MatchModel.Name = dt.Rows[0]["Name"].ToString(); } return(MatchModel); }
/// <summary> /// 获取全部记录 /// </summary> /// <returns></returns> public static List <Models.DB.MatchModel> SelectMatchModel() { List <Models.DB.MatchModel> MatchModels = new List <Models.DB.MatchModel>(); Models.DB.MatchModel MatchModel; System.Data.DataTable dt = DAL.Select.GetAll("Tb_MatchModel"); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { MatchModel = new Models.DB.MatchModel(); MatchModel.Id = Convert.ToInt32(dt.Rows[i]["Id"]); MatchModel.Name = dt.Rows[i]["Name"].ToString(); MatchModels.Add(MatchModel); } } return(MatchModels); }
private void initData() { if (Request["edit"] == null) { Response.Redirect("Default.aspx"); } else { try { int Id = Convert.ToInt32(Request["edit"]); Match = BLL.Match.SelectOne(Id); MatchModel = BLL.MatchModel.SelectOne(Match.MatchModel); MatchModels = BLL.MatchModel.SelectMatchModel(); SelectedJudges = BLL.Match.SelectJudges(Id); Judges = BLL.JudgeInfoModel.SelectOnePage(1, Int32.MaxValue); for (int i = Judges.Count - 1; i >= 0; --i) { for (int j = 0; j < SelectedJudges.Count; ++j) { if (Judges[i].Id == SelectedJudges[j].Id) { Judges.RemoveAt(i); break; } } } for (int i = Judges.Count - 1; i >= 0; --i) { if (LoginRole.Name == "CollegeAdmin" && LoginAdmin.College != Judges[i].College) { Judges.RemoveAt(i); } } } catch { Response.Redirect("Default.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { accessControl(); if (Request["more"] == null) { Response.Redirect("Default.aspx"); } else { try { int Id = Convert.ToInt32(Request["more"]); Match = BLL.Match.SelectOne(Id); MatchModel = BLL.MatchModel.SelectOne(Match.MatchModel); Judges = BLL.Match.SelectJudges(Id); } catch { Response.Redirect("Default.aspx"); } } }