private void btnSave_Click(object sender, EventArgs e) { if (CheckData() == false) { Utility.ShowCannotSaveMessage(); return; } SaveFormDataToUDTDef(); // log LogData(); string studStr = "學號:" + _studRec.StudentNumber + ",姓名:" + _studRec.Name + ","; if (_accessType == accessType.Insert) { // 檢查是否可以新增 (立案日期+個案類別 不能重複) List <DAO.UDT_CounselCareRecordDef> CareRecList = _UDTTransfer.GetCareRecordsByStudentID(_studRec.ID); bool pass = true; foreach (DAO.UDT_CounselCareRecordDef rec in CareRecList) { if (rec.FileDate.HasValue && _CounselCareRecord.FileDate.HasValue) { if (rec.FileDate.Value.ToShortDateString() == _CounselCareRecord.FileDate.Value.ToShortDateString()) { if (rec.CaseCategory == _CounselCareRecord.CaseCategory) { pass = false; } } } } if (pass) { // log _LogTransfer.SaveInsertLog("學生.優先關懷紀錄-新增", "新增", studStr, "", "student", _studRec.ID); _UDTTransfer.InsertCareRecord(_CounselCareRecord); } else { FISCA.Presentation.Controls.MsgBox.Show("已有相同的立案日期與個案類別,無法新增。"); return; } } else { // log _LogTransfer.SaveChangeLog("學生.優先關懷紀錄-修改", "修改", studStr, "", "student", _studRec.ID); _UDTTransfer.UpdateCareRecord(_CounselCareRecord); } Utility.ShowSavedMessage(); this.DialogResult = System.Windows.Forms.DialogResult.OK; }
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(); }
private void btnSave_Click(object sender, EventArgs e) { if (SaveFormDataToUDTDef() == false) { Utility.ShowCannotSaveMessage(); return; } // log LogData(); string studStr = "學號:" + _studRec.StudentNumber + ",姓名:" + _studRec.Name + ","; if (_accessType == accessType.Insert) { // 檢查是否可以新增 會議日期+會議事由 不能重複 List <DAO.UDT_CounselCaseMeetingRecordDef> dataList = _UDTTransfer.GetCaseMeetingRecordListByStudentID(_studRec.ID); bool pass = true; foreach (DAO.UDT_CounselCaseMeetingRecordDef data in dataList) { if (data.MeetingDate.HasValue && _CounselCaseMeetingRecord.MeetingDate.HasValue) { if (data.MeetingDate.Value.ToShortDateString() == _CounselCaseMeetingRecord.MeetingDate.Value.ToShortDateString()) { if (data.MeetingCause == _CounselCaseMeetingRecord.MeetingCause) { pass = false; } } } } if (pass) { // log _LogTransfer.SaveInsertLog("學生.個案會議-新增", "新增", studStr, "", "student", _studRec.ID); _UDTTransfer.InsertCaseMeetingRecord(_CounselCaseMeetingRecord); } else { FISCA.Presentation.Controls.MsgBox.Show("已有相同的會議日與會議事由,無法新增。"); return; } } else { // log _LogTransfer.SaveChangeLog("學生.個案會議-修改", "修改", studStr, "", "student", _studRec.ID); _UDTTransfer.UpdateCaseMeetingRecord(_CounselCaseMeetingRecord); } Utility.ShowSavedMessage(); this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(cbxQuizName.Text)) { FISCA.Presentation.Controls.MsgBox.Show("請選擇測驗名稱."); return; } if (dtAnalysisDate.IsEmpty) { FISCA.Presentation.Controls.MsgBox.Show("請輸入解析日期."); return; } if (dtImplementationDate.IsEmpty) { FISCA.Presentation.Controls.MsgBox.Show("請輸入實施日期."); return; } foreach (DataGridViewRow dr in dgQuizData.Rows) { int errCot = 0; if (dr.Cells[colDataField.Index].ErrorText != "") { errCot++; } if (errCot > 0) { FISCA.Presentation.Controls.MsgBox.Show("資料有錯誤無法儲存."); return; } } LogData(); if (_StudQuizData == null) { _StudQuizData = new DAO.UDT_StudQuizDataDef(); } _StudQuizData.StudentID = int.Parse(_StudentID); _StudQuizData.ImplementationDate = dtImplementationDate.Value; _StudQuizData.AnalysisDate = dtAnalysisDate.Value; List <XElement> xmlList = new List <XElement>(); foreach (DataGridViewRow dgvr in dgQuizData.Rows) { if (dgvr.IsNewRow) { continue; } XElement elm = new XElement("Item"); if (dgvr.Cells[colDataField.Index].Value != null) { elm.SetAttributeValue("name", dgvr.Cells[colDataField.Index].Value.ToString()); } if (dgvr.Cells[colDataValue.Index].Value != null) { elm.SetAttributeValue("value", dgvr.Cells[colDataValue.Index].Value.ToString()); } xmlList.Add(elm); } _StudQuizData.Content = Utility.ConvertXmlListToString1(xmlList); if (_EditMode == EditMode.Edit) { _UDTTransfer.UpdateStudQuizData(_StudQuizData); // log _LogTransfer.SaveChangeLog("學生.輔導測驗相關-修改", "修改", _LogStudentName + ",修改測驗名稱:" + cbxQuizName.Text + "\n", "", "student", _StudentID); } else { // 取得所選測驗ID foreach (DAO.UDT_QuizDef data in _AllQuiz.Where(x => x.QuizName == cbxQuizName.Text)) { _StudQuizData.QuizID = int.Parse(data.UID); } // 檢查學生測驗是否有名稱id if (_StudQuizData.QuizID < 1) { FISCA.Presentation.Controls.MsgBox.Show("測驗名稱無法對應."); return; } bool pass = true; // 檢查學生測驗資料是否有相同:測驗名稱 if (_StudQuizDataList == null) { _StudQuizDataList = new List <DAO.UDT_StudQuizDataDef>(); } foreach (DAO.UDT_StudQuizDataDef data in _StudQuizDataList.Where(x => x.QuizID == _StudQuizData.QuizID)) { pass = false; } if (pass == false) { FISCA.Presentation.Controls.MsgBox.Show("已有相同測驗名稱無法新增."); return; } if (pass) { _UDTTransfer.InsertStudQuizData(_StudQuizData); _LogTransfer.SaveInsertLog("學生.輔導相關測驗-新增", "新增", _LogStudentName + ",新增測驗名稱:" + cbxQuizName.Text + "\n", "", "student", _StudentID); } } _LogTransfer.Clear(); LogData(); this.Close(); }