/// <summary> /// 显示我的开班情况 /// </summary> void ShowMyOpenCourse() { string sqlStr = "SELECT [course_class].[id] AS'开班ID',[course].[Number] AS'课程编号',[course].[Cname] AS '课程名称',[teacher].[Name] AS '任课教师',[course].[Score] AS '学分',[course].Tchour AS '理论总学时' FROM [teacher],[course_class],[course] WHERE[teacher].[Id] =[course_class].[Teacher_id] AND[course].[Id] =[course_class].[course_id] AND [teacher].[Id]=" + teacher.Id; DataTable dataTable = BaseDao <object> .FindDataTable(sqlStr); if (dataTable != null) { //将数据集合的首张表绑定到dataGridView2的数据源 this.skinDataGridView2.DataSource = dataTable; } }
/// <summary> /// 显示成绩录入界面 /// </summary> void ShowScoreInput() { string sqlStr = "SELECT [class_student].[Id] AS 'ID',[course_class].[Id]AS '开班ID',[student].[scode] AS '学号',[student].[Name] AS '姓名' ,[course].[Cname] AS '课程名',[course].[Number] AS '课程编号' ,[teacher].[Name] AS '任课老师' ,[class_student].Gpa_score AS '平时成绩' ,[class_student].Paper_score AS '考试成绩',[class_student].Practice_score AS '实践成绩',[class_student].Score AS '总成绩'FROM [class_student],[student],[course],[course_class],[teacher] WHERE[class_student].[Student_id] =[student].[id] AND[class_student].[course_class_id] =[course_class].[id] AND[course_class].[course_id] =[course].[id] AND[course_class].Teacher_id =[teacher].Id AND [course_class].[Id]=" + CourseClass.Id; DataTable dataTable = BaseDao <object> .FindDataTable(sqlStr); if (dataTable != null) { //将数据集合的首张表绑定到dataGridView1的数据源 this.dataGridView1.DataSource = dataTable; } }
/// <summary> /// 展示datagridview /// </summary> public void ShowInfo() { string sqlStr = "SELECT [student].scode AS '学号', [student].Name AS '姓名',[student].Gender AS '性别',[class].Name AS '班级名',[major].Name AS '专业',[education_program].Name AS '培养方案', [education_program].Objective AS '培养目标',[education_program].Specification AS '规格要求',[education_program].Duration AS '学制',[education_program].Degree AS '授予学位',[education_program].Min_credit AS '毕业学分要求' ,[education_program].Publish_year AS '制定年份' FROM[student],[class],[major],[education_program] WHERE[student].Class_id=[class].Id AND[class].Major_id=[major].Id AND[education_program].Major_id=[major].Id"; DataTable dataTable = BaseDao <object> .FindDataTable(sqlStr); if (dataTable != null) { //将数据集合的首张表绑定到dataGridView2的数据源 this.dataGridView1.DataSource = dataTable; } }
/// <summary> /// 显示我已正选的课程 /// </summary> void ShowMyFormalCourse(DataGridView dgv) { //清除数据源,防止乱序 dgv.DataSource = null; dgv.Columns.Clear(); String sqlStr = "SELECT [student].[scode] AS '学号',[student].[Name] AS '姓名' ,[course].[Cname] AS '课程名',[course].[Number] AS '课程编号' ,[course_class].[Id] AS '开班ID',[teacher].[Name] AS '任课老师' FROM [class_student],[student],[course],[course_class],[teacher] WHERE[class_student].[Student_id] =[student].[id] AND[class_student].[course_class_id] =[course_class].[id] AND[course_class].[course_id] =[course].[id] AND[course_class].Teacher_id =[teacher].Id AND[student].scode = " + student.SCode; DataTable dataTable = BaseDao <object> .FindDataTable(sqlStr); if (dataTable != null) { //将数据集合的首张表绑定到dataGridView1的数据源 dgv.DataSource = null; dgv.DataSource = dataTable; } }
/// <summary> /// 展示datagridview /// </summary> void Show() { string sqlStr = "SELECT [course_class].[id] AS'开班ID',[course].[Number] AS'课程编号',[course].[Cname] AS '课程名称',[teacher].[Name] AS '任课教师' FROM [teacher],[course_class],[course] WHERE[teacher].[Id] =[course_class].[Teacher_id] AND[course].[Id] =[course_class].[course_id] AND [teacher].[Id]=" + teacher.Id; DataTable dataTable = BaseDao <object> .FindDataTable(sqlStr); if (dataTable != null) { //将数据集合的首张表绑定到dataGridView2的数据源 this.skinDataGridView1.DataSource = dataTable; } //添加一列按钮,按钮的行数取决于DataGridView的行数 DataGridViewButtonColumn col_Btn = new DataGridViewButtonColumn(); col_Btn.Name = "btnChooseCourse"; //列名 col_Btn.HeaderText = "操作"; //该列表头所显示的文字 col_Btn.DefaultCellStyle.NullValue = "选择此班级"; //按钮上显示的文字 this.skinDataGridView1.Columns.Add(col_Btn); //添加列 }
/// <summary> /// 显示学生预选情况 /// </summary> void ShowStuPlan() { string sqlStr = "SELECT [course].[id]AS '课程ID',[course].[Number]AS '课程编号',[course].[Cname]AS '课程名' ,COUNT(course_id)AS '已选人数' FROM [plan_study_course] FULL JOIN[course] ON[plan_study_course].[course_id] =[course].[Id] GROUP BY[plan_study_course].[course_id] ,[course].[id],[course].[Number],[course].[Cname] ORDER BY[course].[Number]"; DataTable dataTable = BaseDao <object> .FindDataTable(sqlStr); if (dataTable != null) { //将数据集合的首张表绑定到skinDataGridView1的数据源 this.skinDataGridView1.DataSource = dataTable; } //添加一列按钮,按钮的行数取决于DataGridView的行数 DataGridViewButtonColumn col_Btn = new DataGridViewButtonColumn(); col_Btn.Name = "btnOpenCourse"; //列名 col_Btn.HeaderText = "操作"; //该列表头所显示的文字 col_Btn.DefaultCellStyle.NullValue = "开班"; //按钮上显示的文字 this.skinDataGridView1.Columns.Add(col_Btn); //添加列 }
/// <summary> /// 显示我已选的预选课程 /// </summary> private void ShowMyPlanCourse(DataGridView dgv) { //清除数据源,防止乱序 dgv.DataSource = null; dgv.Columns.Clear(); String sqlStr = "SELECT [student].[scode]AS '学生学号', [student].[Name]AS '学生姓名',[course].[number]AS '课程编号',[course].[Cname]AS '课程名',[course].[score] AS '学分',[semester].[Name] AS '学期信息',[category_course].Name AS '课程类别' ,[education_program].Name AS '培养方案' FROM[course],[student],[semester],[plan_study_course],[curriculum],[category_course],[education_program] WHERE[student].[id]=[plan_study_course].[Student_id] AND[course].[id]=[plan_study_course].[course_id] AND[semester].[id]=[plan_study_course].[Semester_id] AND[curriculum].course_id = [course].id AND[curriculum].Category_id=[category_course].id AND[curriculum].Program_id= [education_program].id AND[plan_study_course].[Student_id] = " + student.Id + " ORDER BY [course].Number"; DataTable dataTable = BaseDao <object> .FindDataTable(sqlStr); if (dataTable != null) { //将数据集合的首张表绑定到dataGridView1的数据源 dgv.DataSource = null; dgv.DataSource = dataTable; } //添加一列按钮,按钮的行数取决于DataGridView的行数 DataGridViewButtonColumn col_Btn = new DataGridViewButtonColumn(); col_Btn.Name = "colBtn_preDelete"; //列名 col_Btn.HeaderText = "操作"; //该列表头所显示的文字 col_Btn.DefaultCellStyle.NullValue = "撤销预选"; //按钮上显示的文字 dgv.Columns.Add(col_Btn); //添加列 }
/// <summary> /// 显示所有预选课程 /// </summary> private void ShowAllPlanCourse(DataGridView dgv) { //清除数据源,防止乱序 dgv.DataSource = null; dgv.Columns.Clear(); String sqlStr = "SELECT [course].id AS '课程ID',[course].Number AS '课程编号',[cname] AS '课程名称',[Score] AS'学分',[Tlhour] AS '周学时' ,[category_course].Name AS '课程类别' ,[education_program].Name AS '培养方案'FROM[course],[curriculum],[category_course],[education_program] WHERE [curriculum].course_id = [course].id AND [curriculum].Category_id=[category_course].id AND [curriculum].Program_id= [education_program].id ORDER BY [course].Number"; DataTable dataTable = BaseDao <object> .FindDataTable(sqlStr); if (dataTable != null) { //将数据集合的首张表绑定到dataGridView1的数据源 dgv.DataSource = null; dgv.DataSource = dataTable; } //添加一列按钮,按钮的行数取决于DataGridView的行数 DataGridViewButtonColumn col_Btn = new DataGridViewButtonColumn(); col_Btn.Name = "colBtn_preSelect"; //列名 col_Btn.HeaderText = "操作"; //该列表头所显示的文字 col_Btn.DefaultCellStyle.NullValue = "预选"; //按钮上显示的文字 dgv.Columns.Add(col_Btn); //添加列 }
/// <summary> /// 显示所有可正选的课程 /// </summary> void ShowAllFormalCourse(DataGridView dgv) { //清除数据源,防止乱序 dgv.DataSource = null; dgv.Columns.Clear(); string sqlStr = " SELECT [course_class].[id] AS'开班ID',[course].[Number] AS'课程编号',[course].[Cname] AS '课程名称',[teacher].[Name] AS '开班教师',[course].[Score] AS '学分',[course].Tchour AS '理论总学时' FROM [teacher],[course_class],[course] WHERE[teacher].[Id] =[course_class].[Teacher_id] AND[course].[Id] =[course_class].[course_id]"; DataTable dataTable = BaseDao <object> .FindDataTable(sqlStr); if (dataTable != null) { //将数据集合的首张表绑定到dataGridView1的数据源 dgv.DataSource = null; dgv.DataSource = dataTable; } //创建新的按钮列 DataGridViewButtonColumn col_Btn = new DataGridViewButtonColumn(); col_Btn.Name = "colBtn_formalSelect"; //列名 col_Btn.HeaderText = "操作"; //该列表头所显示的文字 col_Btn.DefaultCellStyle.NullValue = "正式选课"; //按钮上显示的文字 this.skinDataGridView1.Columns.Add(col_Btn); //添加列 }