private void ShowEmpty() { List <StuAndPenalty> stus = new List <StuAndPenalty>(); StuAndPenalty sap = new StuAndPenalty(); sap.Name = "해당 사항 없음"; stus.Add(sap); MainDataGrid.DataContext = stus; ToExcel.IsEnabled = false; }
private void ProcessData(DataTable dataToProcess) { mStuPenaltyList = new List <StuAndPenalty>(); foreach (DataRow row in dataToProcess.Rows) { AttOfDay attOfDay = new AttOfDay((DateTime)row["일자"]); for (int period = 0; period <= 8; ++period) { AttEnum attEnum = (AttEnum)row[$"{period}교시"]; attOfDay.Add(attEnum); } if (attOfDay.HasFaults) { StuAndPenalty sap = null; for (int i = 0; i < mStuPenaltyList.Count; ++i) { if (mStuPenaltyList[i].Name == row["성명"].ToString()) { sap = mStuPenaltyList[i]; break; } } if (sap == null) { sap = new StuAndPenalty(row["학년"].ToString(), row["반"].ToString(), row["번호"].ToString(), row["성명"].ToString(), attOfDay.PenaltyPoints); mStuPenaltyList.Add(sap); } else { sap.Penalty += attOfDay.PenaltyPoints; } } } }