private void btnDel_Click(object sender, EventArgs e) { if (lvInterview.SelectedItems.Count > 0) { DAO.UDT_CounselStudentInterviewRecordDef studInterviewRec = lvInterview.SelectedItems[0].Tag as DAO.UDT_CounselStudentInterviewRecordDef; if (studInterviewRec != null) { DAO.LogTransfer logTransfer = new DAO.LogTransfer(); string teacherName = lvInterview.SelectedItems[0].SubItems[colTeacherID.Index].Text; 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(studInterviewRec.Attendees); Dictionary <string, string> item_CounselTypeDict = Utility.GetConvertCounselXMLVal_CounselType(studInterviewRec.CounselType); Dictionary <string, string> item_CounselTypeKindDict = Utility.GetConvertCounselXMLVal_CounselTypeKind(studInterviewRec.CounselTypeKind); if (FISCA.Presentation.Controls.MsgBox.Show("請問是否確定是刪除晤談紀錄?", "刪除晤談紀錄", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { // log logData.AppendLine("晤談老師:" + teacherName); logData.AppendLine("晤談對象:" + studInterviewRec.IntervieweeType); logData.AppendLine("晤談方式:" + studInterviewRec.InterviewType); if (studInterviewRec.InterviewDate.HasValue) { logData.AppendLine("日期:" + studInterviewRec.InterviewDate.Value.ToShortDateString()); } logData.AppendLine("時間:" + studInterviewRec.InterviewTime); logData.AppendLine("地點:" + studInterviewRec.Place); logData.AppendLine("晤談編號:" + studInterviewRec.InterviewNo); logData.AppendLine("晤談事由:" + studInterviewRec.Cause); 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); } } logData.AppendLine("內容要點:" + studInterviewRec.ContentDigest); logData.AppendLine("記錄者:" + studInterviewRec.AuthorID); logData.AppendLine("記錄者姓名:" + studInterviewRec.AuthorName); _UDTTransfer.DeleteCounselStudentInterviewRecord(studInterviewRec); logTransfer.SaveLog("學生.輔導晤談紀錄-刪除", "刪除", "student", PrimaryKey, logData); _BGRun(); } } } else { FISCA.Presentation.Controls.MsgBox.Show("請選擇資料."); } }