private void teacher_home_Load(object sender, EventArgs e) { Timer = new Timer();//显示当前时间 Timer.Interval = 1000; Timer.Tick += new EventHandler(Timer_Tick); Timer.Start(); panel7成绩.Visible = false; dao.resultDao rdao = new dao.resultDao(); dao.courseDao cdao = new dao.courseDao(); List <model.Course> cs = new List <model.Course>(); cs = cdao.selecttc(teacher_login.tnumber); foreach (model.Course r1 in cs) { model.Course c = new model.Course(); c = cdao.selectNum(r1.Course_num); //Console.WriteLine(c.Course_num + " " + c.Course_name + c.Time_week + c.Time_jie); comboBox1成绩.Items.Add(c.Course_num + " " + c.Course_name + c.Time_week + c.Time_jie); } }
private void button1课表_Click(object sender, EventArgs e) { dao.resultDao dao = new dao.resultDao(); dao.courseDao cdao = new dao.courseDao(); dao.teacherDao tdao = new dao.teacherDao(); List <model.Result> rs = new List <model.Result>(); rs = dao.selectAll1(student_login.number, comboBox1课表.Text, comboBox2课表.Text); Console.WriteLine(comboBox1课表.Text); Console.WriteLine(comboBox2课表.Text); // DataSet ds = new DataSet(); DataTable dt = new DataTable("Table_New"); dt.Columns.Add("代码", typeof(string)); dt.Columns.Add("课程编号", typeof(string)); dt.Columns.Add("课程名称", typeof(string)); dt.Columns.Add("教师", typeof(string)); dt.Columns.Add("学分", typeof(string)); dt.Columns.Add("类型", typeof(string)); dt.Columns.Add("学年", typeof(string)); dt.Columns.Add("学期", typeof(string)); foreach (model.Result r1 in rs) { model.Course c = new model.Course(); c = cdao.selectNum(r1.Course_num); model.Teacher t = new model.Teacher(); t = tdao.selectNum(c.Teacher_num); Console.WriteLine(r1.Result_num); Console.WriteLine(c.Type); Console.WriteLine(c.Course_num); Console.WriteLine(c.Type); Console.WriteLine(r1.Year); Console.WriteLine(r1.Term); dt.Rows.Add(r1.Result_num, c.Course_num, c.Course_name, t.Teacher_name, c.Credit_hour, c.Type, r1.Year, r1.Term); } dataGridView1课表.DataSource = dt; }
private void button1成绩_Click(object sender, EventArgs e) { dao.resultDao dao = new dao.resultDao(); dao.courseDao cdao = new dao.courseDao(); dao.teacherDao tdao = new dao.teacherDao(); List <model.Result> rs = new List <model.Result>(); if (checkBox2成绩.Checked == false && checkBox1成绩.Checked == false) { rs = dao.selectAll(student_login.number, comboBox1成绩.Text, comboBox2成绩.Text); DataSet ds = new DataSet(); DataTable dt = new DataTable("Table_New"); dt.Columns.Add("代码", typeof(string)); dt.Columns.Add("课程名称", typeof(string)); dt.Columns.Add("性质", typeof(String)); dt.Columns.Add("教师", typeof(string)); dt.Columns.Add("学分", typeof(String)); dt.Columns.Add("成绩", typeof(String)); dt.Columns.Add("类型", typeof(String)); dt.Columns.Add("学年", typeof(String)); dt.Columns.Add("学期", typeof(String)); foreach (model.Result r1 in rs) { if (r1.Score != double.NaN) { model.Course c = new model.Course(); c = cdao.selectNum(r1.Course_num); model.Teacher t = new model.Teacher(); t = tdao.selectNum(c.Teacher_num); dt.Rows.Add(r1.Result_num, c.Course_name, c.Type, t.Teacher_name, c.Credit_hour, r1.Score, r1.Type, r1.Year, r1.Term); } } dataGridView1成绩.DataSource = dt; } else if (checkBox1成绩.Checked == true && checkBox2成绩.Checked == false) { rs = dao.select1(student_login.number, comboBox1成绩.Text, comboBox2成绩.Text); DataSet ds = new DataSet(); DataTable dt = new DataTable("Table_New"); dt.Columns.Add("代码", typeof(string)); dt.Columns.Add("课程名称", typeof(string)); dt.Columns.Add("性质", typeof(String)); dt.Columns.Add("教师", typeof(string)); dt.Columns.Add("学分", typeof(String)); dt.Columns.Add("成绩", typeof(String)); dt.Columns.Add("类型", typeof(String)); dt.Columns.Add("学年", typeof(String)); dt.Columns.Add("学期", typeof(String)); foreach (model.Result r1 in rs) { if (r1.Score != double.NaN) { model.Course c = new model.Course(); c = cdao.selectNum(r1.Course_num); model.Teacher t = new model.Teacher(); t = tdao.selectNum(c.Teacher_num); dt.Rows.Add(r1.Result_num, c.Course_name, c.Type, t.Teacher_name, c.Credit_hour, r1.Score, r1.Type, r1.Year, r1.Term); } } dataGridView1成绩.DataSource = dt; } else if (checkBox1成绩.Checked == false && checkBox2成绩.Checked == true) { rs = dao.select2(student_login.number, comboBox1成绩.Text, comboBox2成绩.Text); DataSet ds = new DataSet(); DataTable dt = new DataTable("Table_New"); dt.Columns.Add("代码", typeof(string)); dt.Columns.Add("课程名称", typeof(string)); dt.Columns.Add("性质", typeof(String)); dt.Columns.Add("教师", typeof(string)); dt.Columns.Add("学分", typeof(String)); dt.Columns.Add("成绩", typeof(String)); dt.Columns.Add("类型", typeof(String)); dt.Columns.Add("学年", typeof(String)); dt.Columns.Add("学期", typeof(String)); foreach (model.Result r1 in rs) { if (r1.Score != double.NaN) { model.Course c = new model.Course(); c = cdao.selectNum(r1.Course_num); model.Teacher t = new model.Teacher(); t = tdao.selectNum(c.Teacher_num); dt.Rows.Add(r1.Result_num, c.Course_name, c.Type, t.Teacher_name, c.Credit_hour, r1.Score, r1.Type, r1.Year, r1.Term); } } dataGridView1成绩.DataSource = dt; } else if (checkBox1成绩.Checked == true && checkBox2成绩.Checked == true) { rs = dao.select3(student_login.number, comboBox1成绩.Text, comboBox2成绩.Text); DataSet ds = new DataSet(); DataTable dt = new DataTable("Table_New"); dt.Columns.Add("代码", typeof(string)); dt.Columns.Add("课程名称", typeof(string)); dt.Columns.Add("性质", typeof(String)); dt.Columns.Add("教师", typeof(string)); dt.Columns.Add("学分", typeof(String)); dt.Columns.Add("成绩", typeof(String)); dt.Columns.Add("类型", typeof(String)); dt.Columns.Add("学年", typeof(String)); dt.Columns.Add("学期", typeof(String)); foreach (model.Result r1 in rs) { if (r1.Score != double.NaN) { model.Course c = new model.Course(); c = cdao.selectNum(r1.Course_num); model.Teacher t = new model.Teacher(); t = tdao.selectNum(c.Teacher_num); dt.Rows.Add(r1.Result_num, c.Course_name, c.Type, t.Teacher_name, c.Credit_hour, r1.Score, r1.Type, r1.Year, r1.Term); } } dataGridView1成绩.DataSource = dt; } }