//查询数据库获取班级的个数 private void GetClass() { string sql = "select ClassId,ClassName from dbo.Class"; DataSet ForTable = DBHelpSQL.Query(sql); ClassIdArr = new string[ForTable.Tables[0].Rows.Count]; ClassNameArr = new string[ForTable.Tables[0].Rows.Count]; for (int i = 0; i < ForTable.Tables[0].Rows.Count; i++) { ClassIdArr[i] = ForTable.Tables[0].Rows[i]["ClassId"].ToString(); ClassNameArr[i] = ForTable.Tables[0].Rows[i]["ClassName"].ToString(); } }
//判断是否选中 public Boolean OrNotCho(int Day, string ClassId, string SlotNo) { string TMonth = this.DropDownList1.SelectedValue; string slotTime = ""; string sql = "select TimeSlot from dbo.PlanTable where Year=" + Year + " and Month=" + TMonth + " and Day=" + Day + " and ClassId=" + ClassId; DataSet ForPlanTable = DBHelpSQL.Query(sql); if (ForPlanTable.Tables[0].Rows.Count != 0) { if (ForPlanTable.Tables[0].Rows.Count > 1) { for (int n = 0; n < ForPlanTable.Tables[0].Rows.Count; n++) { slotTime += ForPlanTable.Tables[0].Rows[n]["TimeSlot"].ToString(); if (n < ForPlanTable.Tables[0].Rows.Count - 1) { slotTime += ","; } } } else { slotTime = ForPlanTable.Tables[0].Rows[0]["TimeSlot"].ToString(); } } if (slotTime == "") { return(false); } else { int r = slotTime.IndexOf(SlotNo); if (slotTime.IndexOf(SlotNo) >= 0) { return(true); } else { return(false); } } }