//根据班级查询 private void cboClass_SelectedIndexChanged(object sender, EventArgs e) { StudentClass coSelected = (StudentClass)cboClass.SelectedItem; gbStat.Text = "班级考试成绩统计"; dgvScoreList.AutoGenerateColumns = false; dgvScoreList.DataSource = objScore.GetScoreList(cboClass.Text); Dictionary <string, string> scoreDic = new Dictionary <string, string>(); if (cboClass.SelectedIndex != -1) { //统计平均分数 scoreDic = objScore.GetScoreInfo(coSelected.ClassId.ToString()); } else { scoreDic = objScore.GetScoreInfo(); } lblAttendCount.Text = scoreDic["stuCount"]; lblDBAvg.Text = scoreDic["avgSql"]; lblCSharpAvg.Text = scoreDic["avgCsharp"]; lblCount.Text = scoreDic["absentCount"]; //显示缺考人员 lblList.DataSource = null; if (cboClass.SelectedIndex != -1) { lblList.DataSource = objScore.GetAbsentList(coSelected.ClassId.ToString()); } else { lblList.DataSource = objScore.GetAbsentList(); } }
private void cboClass_SelectedIndexChanged(object sender, EventArgs e) { if (this.cboClass.SelectedIndex == -1) { MessageBox.Show("Select a Class"); return; } //ScoList AutoGenerateColumns this.dgvScoreList.AutoGenerateColumns = false; this.dgvScoreList.DataSource = objScoreListService.GetScoreList(this.cboClass.Text); //get ScoreInfo Dictionary <string, string> dic = objScoreListService.GetScoreInfo(this.cboClass.SelectedIndex.ToString()); this.lblAttendCount.Text = dic["stuCount"]; this.lblCSharpAvg.Text = dic["avgCsharp"]; this.lblDBAvg.Text = dic["avgDB"]; this.lblCount.Text = dic["absentCount"]; //show absentce students List <string> list = objScoreListService.GetAbsentList(this.cboClass.SelectedIndex.ToString()); this.lblList.Items.Clear(); this.lblList.Items.AddRange(list.ToArray()); }
//ͳ¼ÆȫУ¿¼ÊԳɼ¨ private void btnStat_Click(object sender, EventArgs e) { this.gbStat.Text = "全校考试成绩统计"; this.dgvScoreList.AutoGenerateColumns = false; this.dgvScoreList.DataSource = objScoreService.GetScoreList(""); //查询并显示成绩统计 Dictionary <string, string> dic = objScoreService.GetScoreInfo(); this.lblAttendCount.Text = dic["stuCount"]; this.lblCSharpAvg.Text = dic["avgCSharp"]; this.lblCount.Text = dic["absentCount"]; this.lblDBAvg.Text = dic["avgDB"]; //显示缺考列表 List <string> list = objScoreService.GetAbsentList(); this.lblList.Items.Clear(); this.lblList.Items.AddRange(list.ToArray()); }