private void btnSave_Click(object sender, EventArgs e) { // 儲存畫面資料 if (SaveData() == false) { FISCA.Presentation.Controls.MsgBox.Show("必填欄位沒有填寫,無法儲存."); return; } // Log LogData(); string studStr = "學號:" + _studRec.StudentNumber + ",姓名:" + _studRec.Name + ","; if (_accessType == AccessType.Update) { // log _LogTransfer.SaveChangeLog("學生.晤談紀錄-修改", "修改", studStr, "", "student", _studRec.ID); _UDTTransfer.UpdateCounselStudentInterviewRecord(_StudInterviewRecord); } else { // 檢查是否可已新增 日期+晤談事由 不能重複 List <DAO.UDT_CounselStudentInterviewRecordDef> dataList = _UDTTransfer.GetCounselStudentInterviewRecordByStudentID(_studRec.ID); bool pass = true; foreach (DAO.UDT_CounselStudentInterviewRecordDef data in dataList) { if (data.InterviewDate.HasValue && _StudInterviewRecord.InterviewDate.HasValue) { if (data.InterviewDate.Value.ToShortDateString() == _StudInterviewRecord.InterviewDate.Value.ToShortDateString()) { if (data.Cause == _StudInterviewRecord.Cause) { pass = false; } } } } if (pass) { // log _LogTransfer.SaveInsertLog("學生.晤談紀錄-新增", "新增", studStr, "", "student", _studRec.ID); _UDTTransfer.InstallCounselStudentInterviewRecord(_StudInterviewRecord); } else { FISCA.Presentation.Controls.MsgBox.Show("已有相同的日期與晤談事由,無法新增"); return; } } FISCA.Presentation.Controls.MsgBox.Show("儲存完成"); this.Close(); }
void _bgWorker_DoWork(object sender, DoWorkEventArgs e) { _StudentInterviewRecordList = _UDTTransfer.GetCounselStudentInterviewRecordByStudentID(PrimaryKey).OrderByDescending(x => x.InterviewDate).ToList(); _TeacherIDNameDict = Utility.GetTeacherIDNameDict(); }