/// <summary> /// 查询指定班级ID所选必修课程 /// </summary> /// <param name="classID"></param> /// <returns></returns> public List <T_InsertedFactionModel> ExecuteT_ClassSetUpCourseTeach(int classID) { string t_sql = "SelectClassSetUpCourse"; SqlParameter par = new SqlParameter("@classID", SqlDbType.Int) { Value = classID }; SqlHelper helper = new SqlHelper(); List <T_InsertedFactionModel> res = null; using (SqlDataReader reader = helper.ExecuteReader(t_sql, CommandType.StoredProcedure, par)) { if (reader.HasRows) { res = new List <T_InsertedFactionModel>(); while (reader.Read()) { //select s3.CourseID,s3.ClassID,s3.ClassName,s3.CourseName,s3.TeacherName T_InsertedFactionModel course = new T_InsertedFactionModel(); course.CourseID = reader.GetInt32(0); course.CourseName = reader.GetString(1); course.TeacherID = reader.GetInt32(2); course.TeacherName = reader.GetString(3); res.Add(course); } } } return(res); }
private void comCourseName_SelectedIndexChanged(object sender, EventArgs e) { var obj = sender as ComboBox; var res = obj.SelectedItem as T_InsertedFactionModel; if (res == null) { return; } txtTeachName.Text = res.TeacherName; courseTeach = res; }
private void ucBtnExt1_BtnClick(object sender, EventArgs e) { if (comClass.Items.Count < 0 || comCourse.Items.Count < 0) { return; } T_Class @class = comClass.SelectedItem as T_Class; T_InsertedFactionModel course = comCourse.SelectedItem as T_InsertedFactionModel; if (@class == null || course == null) { return; } DialogResult = DialogResult.OK; values = new string[2] { @class.ClassID.ToString(), course.CourseID.ToString() }; Close(); }