private void ChangeSelection() { _dirty = false; if (!_initialized) { return; } List <ActivityRecordItem> arItems = ActivityRecordDAL.GetActivityRecordItems(cboSchoolYear.Text, cboSemester.Text, "社團幹部", cboGroup.Text); dgEditor.Rows.Clear(); foreach (MappingItem item in _mappingItems) { for (int i = 0; i < item.Count; i++) { int rowIndex = dgEditor.Rows.Add(); DataGridViewRow row = dgEditor.Rows[rowIndex]; row.Cells[colItem.Index].Value = item.Item; } } foreach (ActivityRecordItem ari in arItems) { StudentRecord student = Student.Instance[ari.StudentID]; foreach (DataGridViewRow row in dgEditor.Rows) { if (row.Cells[colItem.Name].Value.ToString() == ari.Item && row.Tag == null && student != null) { FillStudentRow(row, student); break; } } } }
private void ChangeSelection() { _dirty = false; if (!_initialized) { return; } List <ActivityRecordItem> arItems = ActivityRecordDAL.GetActivityRecordItems(cboSchoolYear.Text, cboSemester.Text, "競賽項目", string.Empty); dgEditor.Rows.Clear(); foreach (ActivityRecordItem ari in arItems) { StudentRecord student = Student.Instance[ari.StudentID]; if (student != null) { int rowIndex = dgEditor.Rows.Add(); DataGridViewRow row = dgEditor.Rows[rowIndex]; row.Cells[colClass.Name].Value = student.Class.Name; row.Cells[colStudentNumber.Name].Value = student.StudentNumber; row.Cells[colSeatNo.Name].Value = student.SeatNo; row.Cells[colName.Name].Value = student.Name; row.Cells[colItem.Name].Value = ari.Item; row.Tag = student; } } }