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;
        }
Beispiel #2
0
 void _bgWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     _StudentCaseMeetingRecordList = _UDTTransfer.GetCaseMeetingRecordListByStudentID(PrimaryKey).OrderByDescending(x => x.MeetingDate).ToList();
 }