private void btnDelete_Click(object sender, EventArgs e)
        {
            if (listView.SelectedItems.Count == 0)
            {
                MsgBox.Show("必須選擇一筆以上資料!!");
                return;
            }

            List <BehaviorRecord> behaviorList      = new List <BehaviorRecord>();
            List <string>         listSelectedStuID = new List <string>();

            foreach (ListViewItem item in listView.SelectedItems)
            {
                BehaviorRecord editor = item.Tag as BehaviorRecord;
                behaviorList.Add(editor);
                listSelectedStuID.Add(editor.UID);
            }


            if (MsgBox.Show($"確認刪除所選擇-[生活行為紀錄]?", "確認", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            try
            {
                string deleteSql = $"DELETE FROM  $esl.behavior_data  WHERE uid  IN ( {String.Join(",", listSelectedStuID)} ) RETURNING *";
                qp.Select(deleteSql);
            }
            catch (Exception ex)
            {
                MsgBox.Show("刪除「刪除生活行為紀錄」資料失敗" + ex.Message);
                return;
            }
            LoadingData();


            //LOG (刪除)
            StringBuilder sb = new StringBuilder();
            StudentRecord sr = K12.Data.Student.SelectByID(this.PrimaryKey);

            sb.Append("班級「" + (string.IsNullOrEmpty(sr.RefClassID) ? "" : sr.Class.Name) + "」");
            sb.Append("座號「" + (sr.SeatNo.HasValue ? sr.SeatNo.Value.ToString() : "") + "」");
            sb.AppendLine("學生「" + sr.Name + "」");
            foreach (BehaviorRecord behavior in behaviorList)
            {
                sb.AppendLine("日期「" + behavior.CreateDate + "」,生活行為紀錄已被刪除");
            }
            ApplicationLog.Log("生活行為紀錄", "刪除生活行為紀錄", "student", this.PrimaryKey, sb.ToString());
        }
        //載入資料
        private void GetStudentBehavior()
        {
            _listBehaviorReocrd.Clear();
            string queryByStudent = @"
SELECT 
	$esl.behavior_data.ref_student_id
	, $esl.behavior_data.uid
	, to_char($esl.behavior_data.create_date, 'yyyy/MM/dd') AS create_date
	, $esl.behavior_data.comment
	, $esl.behavior_data.is_good_behavior
	, $esl.behavior_data.detention
	, teacher.teacher_name
	, course.course_name
	, course.id  AS course_id
FROM  
	$esl.behavior_data
LEFT JOIN
	course
		ON course.id =	$esl.behavior_data.ref_course_id
LEFT JOIN
	teacher
		ON teacher.id =  $esl.behavior_data.ref_teacher_id
WHERE ref_student_id = {0}
ORDER BY create_date DESC

";

            queryByStudent = String.Format(queryByStudent, _RunningID);

            DataTable behaviorRecord = qp.Select(queryByStudent);

            foreach (DataRow row in behaviorRecord.Rows)
            {
                BehaviorRecord record = new BehaviorRecord();
                record.StudentID   = row.Field <string>("ref_student_id");
                record.UID         = row.Field <string>("uid");
                record.CreateDate  = row.Field <string>("create_date");
                record.Comment     = row.Field <string>("comment");
                record.Teacher     = row.Field <string>("teacher_name");
                record.Course      = row.Field <string>("course_id");
                record.Course      = row.Field <string>("course_name");
                record.IsGood      = row.Field <string>("is_good_behavior") == "true" ? true : false;
                record.IsDentetion = row.Field <string>("detention") == "true" ? true : false;
                _listBehaviorReocrd.Add(record);
            }
        }