private void LoadRecordAvgData() { SchoolRecordInfoDAC dac = new SchoolRecordInfoDAC(); DataSet ds = dac.GetMockRecordAvg(lblStudentID.Text); RecordGrid.DataSource = ds.Tables[0]; RecordGrid.ClearSelection(); dac.Dispose(); }
private void BtnSearch_Click(object sender, EventArgs e) { if (radiobtnSchool.Checked == true) //내신성적 { if (cmbGrade.SelectedItem is null) { MaterialMessageBox.Show("학년을 선택해주세요.", "경고", MessageBoxButtons.OK); return; } if (cmbSemester.SelectedItem is null) { MaterialMessageBox.Show("학기 선택해주세요.", "경고", MessageBoxButtons.OK); return; } //성적 데이터그리드뷰 RecordGrid.Columns.Clear(); RecordGrid.ClearSelection(); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "이름", "std_name", true, 80); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "국어", "sch_korean", true, 100); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "영어", "sch_english", true, 100); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "수학", "sch_math", true, 100); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "평균", "avg", true, 100); RecordGrid.Columns[4].DefaultCellStyle.BackColor = Color.Yellow; //평균 컬럼은 노란색으로 SchoolRecordInfoDAC DAC = new SchoolRecordInfoDAC(); DataSet ds = DAC.GetSchoolRecordByScore(cmbGrade.SelectedItem.ToString(), cmbSemester.SelectedItem.ToString()); RecordGrid.DataSource = ds.Tables[0]; DAC.Dispose(); } else if (radiobtnMock.Checked == true) //모의고사성적 { if (cmbGrade.SelectedItem is null) { MaterialMessageBox.Show("학년을 선택해주세요.", "경고", MessageBoxButtons.OK); return; } if (cmbSemester.SelectedItem is null) { MaterialMessageBox.Show("월을 선택해주세요.", "경고", MessageBoxButtons.OK); return; } RecordGrid.Columns.Clear(); RecordGrid.ClearSelection(); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "이름", "std_name", true, 70); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "국어", "sch_korean", true, 60); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "영어", "sch_english", true, 60); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "수학", "sch_math", true, 60); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "사회/과학1", "side_choice1", true, 85); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "사회/과학2", "side_choice2", true, 85); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "제2외국어", "more_foreign", true, 80); UtilityClass.AddNewColumnToDataGridView(RecordGrid, "평균", "avg", true, 80); RecordGrid.Columns[7].DefaultCellStyle.BackColor = Color.Yellow; SchoolRecordInfoDAC DAC = new SchoolRecordInfoDAC(); DataSet ds = DAC.GetMockRecordByScore(cmbGrade.SelectedItem.ToString(), cmbSemester.SelectedItem.ToString()); RecordGrid.DataSource = ds.Tables[0]; DAC.Dispose(); } }