public void ExecuteAutoCorrect(IEnumerable <string> EntityIDs) { try { if (!K12.Data.Utility.Utility.IsNullOrEmpty(EntityIDs)) { if (MsgBox.Show("自動修正將依照檢查結果建議值進行修正總共" + EntityIDs.Count() + "筆,強烈建議您務必將檢查結果匯出備份,是否進行自動修正?", "您是否要進行自動修正?", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { StringBuilder strBuilder = new StringBuilder(1024 * 1024); List <string> LogValues = new List <string>(); strBuilder.AppendLine("學號,狀態,學年度,學期" + Environment.NewLine); foreach (JHSemesterScoreRecord sems in CorrectableRecs) { if (EntityIDs.Contains(sems.ID)) { LogValues.Add(sems.Student.StudentNumber); LogValues.Add(sems.Student.StatusStr); LogValues.Add("" + sems.SchoolYear); LogValues.Add("" + sems.Semester); strBuilder.AppendLine(string.Join(",", LogValues.ToArray())); LogValues.Clear(); } } FISCA.LogAgent.ApplicationLog.Log("資料合理性檢查.學生學期科目與領域成績有空值", "刪除學生學期科目與領域成績有空值", strBuilder.ToString()); JHSemesterScore.Delete(EntityIDs); MsgBox.Show("已自動修正完成!"); } } } catch (Exception e) { SmartSchool.ErrorReporting.ReportingService.ReportException(e); MsgBox.Show(e.Message); } }
//刪除 private void btnDelete_Click(object sender, EventArgs e) { if (listView.SelectedItems.Count <= 0) { return; } ListViewItem item = listView.SelectedItems[0]; string info = string.Format("{0}學年度 第{1}學期", item.SubItems[0].Text, item.SubItems[1].Text); if (Framework.MsgBox.Show("您確定要刪除「" + item.SubItems[0].Text + "學年度 第" + item.SubItems[1].Text + "學期」的學期成績嗎?", MessageBoxButtons.YesNo) == DialogResult.Yes) { JHSemesterScoreRecord record = item.Tag as JHSemesterScoreRecord; JHSemesterScore.Delete(record); FISCA.LogAgent.ApplicationLog.Log("成績系統.學期成績", "刪除學期成績", "student", PrimaryKey, string.Format("{0},刪除「{1}」的學期成績", StudentInfoConvertor.GetInfoWithClass(_student), info)); listView.Items.Remove(listView.SelectedItems[0]); listView.Refresh(); } listView.Focus(); }