/// <summary>
        /// 透過班級ID調整所屬班級學生ID
        /// </summary>
        /// <param name="ClassID"></param>
        /// <param name="OldClassComment"></param>
        /// <param name="ClassComment"></param>
        public static void UpdateUDTClassSepcByClassID(int ClassID, string ClassName, string OldClassComment, string ClassComment)
        {
            try
            {
                List <string> StudentIDList = new List <string>();
                // 取得班級學生ID,學生狀態:一般、休學、中輟
                QueryHelper qh    = new QueryHelper();
                string      query = "select id from student where student.status in(1,4,8) and ref_class_id=" + ClassID;
                DataTable   dt    = qh.Select(query);

                foreach (DataRow dr in dt.Rows)
                {
                    StudentIDList.Add(dr[0].ToString());
                }

                // 取得特殊班學生資料
                Dictionary <string, UDT_ClassSpecial> StudSpecDict = GetClassSpecStudentByIDList(StudentIDList);

                List <UDT_ClassSpecial> StudSpecDataList = new List <UDT_ClassSpecial>();

                foreach (string StudID in StudentIDList)
                {
                    if (StudSpecDict.ContainsKey(StudID))
                    {
                        StudSpecDict[StudID].OldClassID      = StudSpecDict[StudID].ClassID;
                        StudSpecDict[StudID].OldClassComment = StudSpecDict[StudID].ClassComment;
                        StudSpecDict[StudID].OldClassName    = StudSpecDict[StudID].ClassName;
                        StudSpecDict[StudID].ClassID         = ClassID;
                        StudSpecDict[StudID].ClassName       = ClassName;
                        StudSpecDict[StudID].ClassComment    = ClassComment;
                        StudSpecDataList.Add(StudSpecDict[StudID]);
                    }
                    else
                    {
                        UDT_ClassSpecial cs = new UDT_ClassSpecial();
                        cs.StudentID    = int.Parse(StudID);
                        cs.ClassID      = ClassID;
                        cs.ClassName    = ClassName;
                        cs.ClassComment = ClassComment;
                        StudSpecDataList.Add(cs);
                    }
                }
                if (StudSpecDataList.Count > 0)
                {
                    StudSpecDataList.SaveAll();
                }
            }catch (Exception ex)
            {
                FISCA.Presentation.Controls.MsgBox.Show("鎖定班級寫入資料發生錯誤," + ex.Message);
            }
        }
        /// <summary>
        /// 取得班級學生變動
        /// </summary>
        /// <param name="StudentID"></param>
        /// <returns></returns>
        public static UDT_ClassSpecial GetClassSpecStudentByStudID(string StudentID)
        {
            UDT_ClassSpecial value = new UDT_ClassSpecial();

            if (!string.IsNullOrWhiteSpace(StudentID))
            {
                value.StudentID = int.Parse(StudentID);

                AccessHelper            accHelper = new AccessHelper();
                string                  query     = "ref_student_id=" + StudentID;
                List <UDT_ClassSpecial> dataList  = accHelper.Select <UDT_ClassSpecial>(query);
                if (dataList.Count > 0)
                {
                    value = dataList[0];
                }
            }
            return(value);
        }
        /// <summary>
        /// 新增單筆學生變動資料
        /// </summary>
        /// <param name="StudentID"></param>
        /// <param name="oldClassID"></param>
        /// <param name="ClassID"></param>
        /// <param name="OldClassName"></param>
        /// <param name="ClassName"></param>
        public static UDT_ClassSpecial AddClassSpecStudent(string StudentID, string OldClassID, string ClassID, string OldClassName, string ClassName, string FirstClassName, string SecondClassName, string ThridClassName)
        {
            // 儲存班級學生變動
            UDT_ClassSpecial ClassSpecStud = GetClassSpecStudentByStudID(StudentID);

            ClassSpecStud.OldClassComment = ClassSpecStud.ClassComment;
            if (!string.IsNullOrEmpty(OldClassID))
            {
                ClassSpecStud.OldClassID = int.Parse(OldClassID);
            }

            if (!string.IsNullOrEmpty(ClassID))
            {
                ClassSpecStud.ClassID = int.Parse(ClassID);
            }
            ClassSpecStud.OldClassName = OldClassName;
            ClassSpecStud.ClassName    = ClassName;


            // 取得班級鎖定相關資料
            Dictionary <string, UDT_ClassLock> classLockDict = GetClassLockNameIDDict();

            ClassSpecStud.ClassComment = "";
            if (classLockDict.ContainsKey(ClassID))
            {
                ClassSpecStud.ClassComment = classLockDict[ClassID].Comment;
            }

            if (classLockDict.ContainsKey(OldClassID))
            {
                ClassSpecStud.OldClassComment = classLockDict[OldClassID].Comment;
            }

            XElement elmRoot = null;

            // 儲存學生班級順位名稱
            if (string.IsNullOrEmpty(ClassSpecStud.Content))
            {
                elmRoot = new XElement("Content");
            }
            else
            {
                try
                {
                    elmRoot = XElement.Parse(ClassSpecStud.Content);
                }
                catch (Exception ex) { }
            }

            if (elmRoot != null)
            {
                elmRoot.SetElementValue("FirstClassName", FirstClassName);
                elmRoot.SetElementValue("SecondClassName", SecondClassName);
                elmRoot.SetElementValue("ThridClassName", ThridClassName);
            }
            ClassSpecStud.Content = elmRoot.ToString();

            ClassSpecStud.Save();

            return(ClassSpecStud);
        }