//¸ù¾Ý°à¼¶²éѯ private void cboClass_SelectedIndexChanged(object sender, EventArgs e) { if (this.cboClass.SelectedIndex == -1) { MessageBox.Show("Please select class", "information"); return; } this.dgvScoreList.AutoGenerateColumns = false; this.dgvScoreList.DataSource = objScoreService.GetScoreList(this.cboClass.Text.Trim()); this.gbStat.Text = "[" + this.cboClass.Text.Trim() + "]班级考试成绩统计"; //查询并显示成绩统计 Dictionary <string, string> dic = objScoreService.GetScoreInfoByClassId(this.cboClass.SelectedValue.ToString()); this.lblAttendCount.Text = dic["stuCount"]; this.lblCSharpAvg.Text = dic["avgCSharp"]; this.lblCount.Text = dic["absentCount"]; this.lblDBAvg.Text = dic["avgDB"]; //显示缺考列表 List <string> list = objScoreService.GetAbsentListByClassId(this.cboClass.SelectedValue.ToString()); this.lblList.Items.Clear(); // this.lblList.Items.AddRange(list.ToArray()); if (list.Count == 0) { this.lblList.Items.Add("No Student"); } else { lblList.Items.AddRange(list.ToArray()); } }
//根据班级查询 private void cboClass_SelectedIndexChanged(object sender, EventArgs e) { #region 验证数据 if (this.cboClass.SelectedIndex == -1) { MessageBox.Show("请选择要查询的班级", "查询提示"); return; } #endregion this.dgvScoreList.AutoGenerateColumns = false; //获取班级全部成绩 this.dgvScoreList.DataSource = objScoreService.GetSCoreList(this.cboClass.Text.Trim()); //调整显示格式 new Common.DataGridViewStyle().DgvStyle1(this.dgvScoreList); //显示班级考试信息 this.gbStat.Text = "[" + this.cboClass.Text.Trim() + "]考试成绩统计"; //查询参加人数与考试成绩 未参加考试的人员名单 Dictionary <string, string> dic = objScoreService.GetScoreInfoByClassId(this.cboClass.SelectedValue.ToString()); this.lblAttendCount.Text = dic["stuCount"]; this.lblCSharpAvg.Text = dic["avgCSharp"]; this.lblDBAvg.Text = dic["avgDB"]; this.lblCount.Text = dic["absentCount"]; //显示缺考人员姓名 List <string> list = objScoreService.GetAbsentListByClassId(this.cboClass.SelectedValue.ToString()); this.lblList.Items.Clear(); if (list.Count == 0) { this.lblList.Items.Add("没有缺考"); } else { lblList.Items.AddRange(list.ToArray()); // lblList.DataSource = list; } }