private void btnDelete_Click(object sender, EventArgs e) { if (lvCaseMeeting.SelectedItems.Count == 1) { DAO.UDT_CounselCaseMeetingRecordDef CaseMeetingRecord = lvCaseMeeting.SelectedItems[0].Tag as DAO.UDT_CounselCaseMeetingRecordDef; if (CaseMeetingRecord != null) { DAO.LogTransfer logTransfer = new DAO.LogTransfer(); K12.Data.StudentRecord studRec = K12.Data.Student.SelectByID(PrimaryKey); StringBuilder logData = new StringBuilder(); logData.AppendLine("刪除" + Utility.ConvertString1(studRec)); // 取得 XML 解析後 Dictionary <string, string> item_AttendessDict = Utility.GetConvertCounselXMLVal_Attendees(CaseMeetingRecord.Attendees); Dictionary <string, string> item_CounselTypeDict = Utility.GetConvertCounselXMLVal_CounselType(CaseMeetingRecord.CounselType); Dictionary <string, string> item_CounselTypeKindDict = Utility.GetConvertCounselXMLVal_CounselTypeKind(CaseMeetingRecord.CounselTypeKind); if (FISCA.Presentation.Controls.MsgBox.Show("請問是否確定刪除個案會議?", "刪除個案會議", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { // log logData.AppendLine("個案編號:" + CaseMeetingRecord.CaseNo); if (CaseMeetingRecord.MeetingDate.HasValue) { logData.AppendLine("會議日期" + CaseMeetingRecord.MeetingDate.Value.ToShortDateString()); } K12.Data.TeacherRecord tRec = K12.Data.Teacher.SelectByID(CaseMeetingRecord.CounselTeacherID.ToString()); if (tRec != null) { if (string.IsNullOrEmpty(tRec.Nickname)) { logData.AppendLine("晤談老師:" + tRec.Name); } else { logData.AppendLine("晤談老師:" + tRec.Name + "(" + tRec.Nickname + ")"); } } logData.AppendLine("會議時間:" + CaseMeetingRecord.MeetigTime); logData.AppendLine("會議事由:" + CaseMeetingRecord.MeetingCause); logData.AppendLine("會議地點:" + CaseMeetingRecord.Place); logData.AppendLine("內容要點:" + CaseMeetingRecord.ContentDigest); logData.AppendLine("記錄者:" + CaseMeetingRecord.AuthorID); logData.AppendLine("記錄者姓名:" + CaseMeetingRecord.AuthorName); logData.AppendLine("參與人員:"); foreach (KeyValuePair <string, string> data in item_AttendessDict) { if (!string.IsNullOrEmpty(data.Value)) { logData.AppendLine(data.Key + ":" + data.Value); } } logData.AppendLine("輔導方式:"); foreach (KeyValuePair <string, string> data in item_CounselTypeDict) { if (!string.IsNullOrEmpty(data.Value)) { logData.AppendLine(data.Key + ":" + data.Value); } } logData.AppendLine("輔導歸類:"); foreach (KeyValuePair <string, string> data in item_CounselTypeKindDict) { if (!string.IsNullOrEmpty(data.Value)) { logData.AppendLine(data.Key + ":" + data.Value); } } _UDTTransfer.DeleteCaseMeetingRecord(CaseMeetingRecord); logTransfer.SaveLog("學生.輔導個案會議-刪除", "刪除", "student", PrimaryKey, logData); _BGRun(); } } } else { FISCA.Presentation.Controls.MsgBox.Show("請選擇資料."); } }