private void SaveAnswerToUDT()
        {
            List<UDTSingleRecordDef> iDataList = new List<UDTSingleRecordDef>();
            List<UDTSingleRecordDef> uDataList = new List<UDTSingleRecordDef>();
            List<UDTSemesterDataDef> isDataList = new List<UDTSemesterDataDef>();
            List<UDTSemesterDataDef> usDataList = new List<UDTSemesterDataDef>();

            // 血型
            if (_udtSrFlp01 == null)
            {
                _udtSrFlp01 = new UDTSingleRecordDef();
                _udtSrFlp01.StudentID = _intStudentID;
            }
            _udtSrFlp01.Key = enumKey.本人概況_血型.ToString();
            foreach (Control c in flp01.Controls)
            {
                if (c is RadioButton)
                {
                    _udtSrFlp01.Remark = "";
                    RadioButton rb = c as RadioButton;
                    if (rb.Checked)
                    {
                        _udtSrFlp01.Data = rb.Name;

                        foreach(Control cr in flp01.Controls)
                            if (cr is TextBox)
                                if (cr.Name == rb.Name)
                                    _udtSrFlp01.Remark = cr.Text;
                    }
                }
            }
            if (string.IsNullOrEmpty(_udtSrFlp01.UID))
                iDataList.Add(_udtSrFlp01);
            else
               uDataList.Add(_udtSrFlp01);

            // 宗教
            if (_udtSrFlp02 == null)
            {
                _udtSrFlp02 = new UDTSingleRecordDef();
                _udtSrFlp02.StudentID = _intStudentID;
            }

            _udtSrFlp02.Key = enumKey.本人概況_宗教.ToString();
            foreach (Control c in flp02.Controls)
            {
                if (c is RadioButton)
                {
                    _udtSrFlp02.Remark = "";
                    RadioButton rb = c as RadioButton;
                    if (rb.Checked)
                    {
                        _udtSrFlp02.Data = rb.Name;

                        foreach (Control cr in flp02.Controls)
                            if (cr is TextBox)
                                if (cr.Name == rb.Name)
                                    _udtSrFlp02.Remark = cr.Text;

                    }
                }

            }
            if (string.IsNullOrEmpty(_udtSrFlp02.UID))
                iDataList.Add(_udtSrFlp02);
            else
                uDataList.Add(_udtSrFlp02);

            if (iDataList.Count > 0)
                UDTTransfer.ABUDTSingleRecordInsert(iDataList);

            if (uDataList.Count > 0)
                UDTTransfer.ABUDTSingleRecordUpdate(uDataList);

            // 寫入 身高
            if (_udtSdDg01 == null)
            {
                _udtSdDg01 = new UDTSemesterDataDef();
                _udtSdDg01.StudentID = _intStudentID;
                _udtSdDg01.Key = enumKey.本人概況_身高.ToString();
            }
            List<string> tmpData1 = new List<string>();
            for (int i = 1; i <= 12; i++)
            {
                if (dg01.Rows[_Dg01RowIdx].Cells[i].Value != null)
                    tmpData1.Add(dg01.Rows[_Dg01RowIdx].Cells[i].Value.ToString());
                else
                    tmpData1.Add("");
            }
            _udtSdDg01.S1a = tmpData1[0];
            _udtSdDg01.S1b = tmpData1[1];
            _udtSdDg01.S2a = tmpData1[2];
            _udtSdDg01.S2b = tmpData1[3];
            _udtSdDg01.S3a = tmpData1[4];
            _udtSdDg01.S3b = tmpData1[5];
            _udtSdDg01.S4a = tmpData1[6];
            _udtSdDg01.S4b = tmpData1[7];
            _udtSdDg01.S5a = tmpData1[8];
            _udtSdDg01.S5b = tmpData1[9];
            _udtSdDg01.S6a = tmpData1[10];
            _udtSdDg01.S6b = tmpData1[11];

            if (string.IsNullOrEmpty(_udtSdDg01.UID))
                isDataList.Add(_udtSdDg01);
            else
                usDataList.Add(_udtSdDg01);

            // 體重
            if (_udtSdDg02 == null)
            {
                _udtSdDg02 = new UDTSemesterDataDef();
                _udtSdDg02.StudentID = _intStudentID;
                _udtSdDg02.Key = enumKey.本人概況_體重.ToString();
            }
            List<string> tmpData2 = new List<string>();
            for (int i = 1; i <= 12; i++)
            {
                if (dg01.Rows[_Dg02RowIdx].Cells[i].Value != null)
                    tmpData2.Add(dg01.Rows[_Dg02RowIdx].Cells[i].Value.ToString());
                else
                    tmpData2.Add("");
            }
            _udtSdDg02.S1a = tmpData2[0];
            _udtSdDg02.S1b = tmpData2[1];
            _udtSdDg02.S2a = tmpData2[2];
            _udtSdDg02.S2b = tmpData2[3];
            _udtSdDg02.S3a = tmpData2[4];
            _udtSdDg02.S3b = tmpData2[5];
            _udtSdDg02.S4a = tmpData2[6];
            _udtSdDg02.S4b = tmpData2[7];
            _udtSdDg02.S5a = tmpData2[8];
            _udtSdDg02.S5b = tmpData2[9];
            _udtSdDg02.S6a = tmpData2[10];
            _udtSdDg02.S6b = tmpData2[11];

            if (string.IsNullOrEmpty(_udtSdDg02.UID))
                isDataList.Add(_udtSdDg02);
            else
                usDataList.Add(_udtSdDg02);

            if (isDataList.Count > 0)
                UDTTransfer.ABUDTSemesterDataInsert(isDataList);

            if (usDataList.Count > 0)
                UDTTransfer.ABUDTSemesterDataUpdate(usDataList);

            List<UDTMultipleRecordDef> delData = new List<UDTMultipleRecordDef>();
            List<UDTMultipleRecordDef> InsertData = new List<UDTMultipleRecordDef>();

            delData = _udtMrFlp01Dict.Values.ToList();

            if (delData.Count > 0)
                UDTTransfer.ABUDTMultipleRecordDelete(delData);

            foreach (Control c in flp03.Controls)
            {
                if (c is CheckBox)
                {
                    CheckBox cb = c as CheckBox;
                    if (cb.Checked)
                    {
                        UDTMultipleRecordDef data = new UDTMultipleRecordDef();
                        data.StudentID = _intStudentID;
                        data.Key = enumKey.本人概況_生理缺陷.ToString();
                        data.Data = cb.Name;
                        data.Remark = "";
                        foreach (Control cr in flp03.Controls)
                            if (cr is TextBox)
                                if (cr.Name == cb.Name)
                                    data.Remark = cr.Text;

                        InsertData.Add(data);
                    }
                }
            }
            if (InsertData.Count > 0)
                UDTTransfer.ABUDTMultipleRecordInsert(InsertData);

            delData.Clear();
            InsertData.Clear();

            delData = _udtMrFlp02Dict.Values.ToList();

            if (delData.Count > 0)
                UDTTransfer.ABUDTMultipleRecordDelete(delData);

            foreach (Control c in flp04.Controls)
            {
                if (c is CheckBox)
                {
                    CheckBox cb = c as CheckBox;
                    if (cb.Checked)
                    {
                        UDTMultipleRecordDef data = new UDTMultipleRecordDef();
                        data.StudentID = _intStudentID;
                        data.Key = enumKey.本人概況_曾患特殊疾病.ToString();
                        data.Data = cb.Name;
                        data.Remark = "";

                        foreach (Control cr in flp04.Controls)
                            if (cr is TextBox)
                                if (cr.Name == cb.Name)
                                    data.Remark = cr.Text;

                        InsertData.Add(data);
                    }
                }
            }
            if (InsertData.Count > 0)
                UDTTransfer.ABUDTMultipleRecordInsert(InsertData);
        }
        /// <summary>
        /// 設定儲存資料
        /// </summary>
        private void SetData()
        {
            // 刪除舊資料
            _deleteMultipleRecordList = _dataMDict.Values.ToList();
            UDTTransfer.ABUDTMultipleRecordDelete(_deleteMultipleRecordList);
            _InsertMultipleRecordDict.Clear();

            // 儲存資料
            for (int idx = 0; idx < 4; idx++)
            {
                FlowLayoutPanel flp = _flpList[idx];
                string KeyName = _KeyNameList[idx];

                foreach (Control cr in flp.Controls)
                {
                    if (cr is CheckBox)
                    {
                        CheckBox cb = cr as CheckBox;
                        if (cb.Checked)
                        {
                            UDTMultipleRecordDef data1 = new UDTMultipleRecordDef();
                            data1.StudentID = _intStudentID;
                            data1.Key = GroupName + "_" + KeyName;
                            data1.Data = cb.Name;
                            data1.Remark = "";

                            // 處理備註資料
                            foreach (Control t in flp.Controls)
                                if (t is TextBox)
                                    if (t.Name == cb.Name)
                                        data1.Remark = t.Text;

                            string insertKey = data1.Key + "_" + cb.Name;
                            if (!_InsertMultipleRecordDict.ContainsKey(insertKey))
                                _InsertMultipleRecordDict.Add(insertKey, data1);
                        }
                    }
                }
            }

            // 新增至 UDT
            if (_InsertMultipleRecordDict.Count > 0)
                UDTTransfer.ABUDTMultipleRecordInsert(_InsertMultipleRecordDict.Values.ToList());

            // 讀存資料
            List<UDTPriorityDataDef> insertData = new List<UDTPriorityDataDef>();
            List<UDTPriorityDataDef> updateData = new List<UDTPriorityDataDef>();

            // 將來就業
            UDTPriorityDataDef p1 = dgPriority.Columns[1].Tag as UDTPriorityDataDef;
            if (p1 == null)
            {
                p1 = new UDTPriorityDataDef();
                p1.Key = GroupName + "_" + _keyName5;
                p1.StudentID = _intStudentID;
            }
            if (dgPriority.Rows[0].Cells[1].Value != null)
                p1.P1 = dgPriority.Rows[0].Cells[1].Value.ToString();
            else
                p1.P1 = "";
            if (dgPriority.Rows[1].Cells[1].Value != null)
                p1.P2 = dgPriority.Rows[1].Cells[1].Value.ToString();
            else
                p1.P2 = "";
            if (dgPriority.Rows[2].Cells[1].Value != null)
                p1.P3 = dgPriority.Rows[2].Cells[1].Value.ToString();
            else
                p1.P3 = "";

            if (string.IsNullOrEmpty(p1.UID))
                insertData.Add(p1);
            else
                updateData.Add(p1);

            // 就業地區
            UDTPriorityDataDef p2 = dgPriority.Columns[2].Tag as UDTPriorityDataDef;
            if (p2 == null)
            {
                p2 = new UDTPriorityDataDef();
                p2.Key = GroupName+"_"+_keyName6;
                p2.StudentID = _intStudentID;
            }
            if (dgPriority.Rows[0].Cells[2].Value != null)
                p2.P1 = dgPriority.Rows[0].Cells[2].Value.ToString();
            else
                p2.P1 = "";
            if (dgPriority.Rows[1].Cells[2].Value != null)
                p2.P2 = dgPriority.Rows[1].Cells[2].Value.ToString();
            else
                p2.P2 = "";
            if (dgPriority.Rows[2].Cells[2].Value != null)
                p2.P3 = dgPriority.Rows[2].Cells[2].Value.ToString();
            else
                p2.P3 = "";

            if (string.IsNullOrEmpty(p2.UID))
                insertData.Add(p2);
            else
                updateData.Add(p2);

            if (insertData.Count > 0)
                UDTTransfer.ABUDTPriorityDataInsert(insertData);

            if (updateData.Count > 0)
                UDTTransfer.ABUDTPriorityDataUpdate(updateData);
        }