/// <summary>
        /// 取得單筆學生UDT資料,並轉換成 dic
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public static Dictionary<string, DAL.UserDefData> GetDataFromUDTDict(string ID)
        {
            // 回傳資料
            Dictionary<string, DAL.UserDefData> retValue = new Dictionary<string, DAL.UserDefData>();

            // 刪除可能多餘資料
            List<DAL.UserDefData> DeleteList = new List<DAL.UserDefData>();

            // 取得 UDT 內
            foreach (DAL.UserDefData ud in GetDataFromUDT(ID))
                if (!retValue.ContainsKey(ud.FieldName))
                {
                    ud.isNull = false;
                    retValue.Add(ud.FieldName, ud);
                }
                else
                {
                    ud.Deleted = true;
                    DeleteList.Add(ud);
                }

            if (DeleteList.Count > 0)
                DeleteDataToUDT(DeleteList);

            // 取得自訂欄位設定,沒有使用空白
            foreach (string FName in Global.GetUserConfigData().Keys)
                if (!retValue.ContainsKey(FName))
                {
                    DAL.UserDefData ud = new DAL.UserDefData();
                    ud.RefID = ID;
                    ud.FieldName = FName;
                    ud.Value = "";
                    retValue.Add(FName, ud);
                }
            return retValue;
        }
        /// <summary>
        /// 按下儲存
        /// </summary>
        /// <param name="e"></param>
        protected override void OnSaveButtonClick(EventArgs e)
        {
            try
            {

                // 刪除舊資料 UDT
                if (_DeleteDataList.Count > 0)
                {
                    // 真實刪除
                    foreach (DAL.UserDefData ud in _DeleteDataList)
                        ud.Deleted = true;
                    UDTTransfer.DeleteDataToUDT(_DeleteDataList);
                }
                _InsertDataList.Clear();

                // 儲存資料到 UDT
                foreach (DataGridViewRow row in dgv.Rows)
                {
                    if (row.IsNewRow)
                        continue;
                    DAL.UserDefData udd = new DAL.UserDefData ();
                    // 資料轉型
                    if(row.Tag != null )
                        udd = (DAL.UserDefData)row.Tag;
                    if (row.Cells[Value.Index].Value != null)
                        udd.Value = row.Cells[Value.Index].Value.ToString();
                    udd.RefID = PrimaryKey;

                    string key=string.Empty ;
                    if (row.Cells[FieldName.Index].Value != null)
                    {
                        key = row.Cells[FieldName.Index].Value.ToString();
                        udd.FieldName = key;
                    }

                    prlp.SetAfterSaveText(key + "欄位名稱", key);
                    prlp.SetAfterSaveText(key + "值", udd.Value);

                    _InsertDataList.Add(udd);
                }

                // 新增至 UDT
                UDTTransfer.InsertDataToUDT(_InsertDataList);

                //if (LoadManager.GetSystemType() == SystemType.國中)
                //{
                    prlp.SetActionBy("學生", "自訂資料欄位");
                    prlp.SetAction("修改自訂資料欄位");
                    JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey);
                    prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ",");
                    prlp.SaveLog("", "", "student", PrimaryKey);
                //}

                this.CancelButtonVisible = false;
                this.SaveButtonVisible = false;
            }
            catch (Exception ex)
            {
                FISCA.Presentation.Controls.MsgBox.Show("儲存失敗!");
            }
        }