//根据班级查询 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("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) { 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 cboClass_SelectedIndexChanged(object sender, EventArgs e) { if (this.cboClass.SelectedIndex == -1) { MessageBox.Show("请首先选择要查询的班级!", "查询提示"); return; } this.gbStat.Text = "[" + this.cboClass.Text.Trim() + "]考试成绩统计"; //展示考试成绩列表 this.dgvScoreList.AutoGenerateColumns = false; this.dgvScoreList.DataSource = objSocreService.GetScoreList(this.cboClass.Text.ToString()); //查询成绩统计结果 Dictionary <string, string> dic = objSocreService.GetScoreInfo(this.cboClass.SelectedValue.ToString()); this.lblAttendCount.Text = dic["stuCount"]; this.lblCSharpAvg.Text = dic["avgCsharp"]; this.lblCount.Text = dic["absentCount"]; //显示缺考学员 List <string> list = objSocreService.getAbsentList(this.cboClass.SelectedValue.ToString()); this.lblList.Items.Clear(); this.lblList.Items.AddRange(list.ToArray()); }
private DataSet da = null;//用来保存查询结果的数据集 public FrmScoreQuery() { InitializeComponent(); //基于DataTable绑定下拉框 this.cboClass.DataSource = studentClassService.GetAllClasses().Tables[0]; this.cboClass.DisplayMember = "ClassName"; this.cboClass.ValueMember = "ClassId"; this.cboClass.SelectedIndex = -1; //成绩列表数据绑定 da = scoreListService.GetScoreList(); this.dgvScoreList.AutoGenerateColumns = false; this.dgvScoreList.DataSource = null; this.dgvScoreList.DataSource = da.Tables[0]; DataGridViewStyle.DgvStyle3(dgvScoreList); }
//显示全部成绩 private void btnShowAll_Click(object sender, EventArgs e) { dgvScoreList.AutoGenerateColumns = false; dgvScoreList.DataSource = objScore.GetScoreList(""); }