protected override void OnSaveButtonClick(EventArgs e) { SetData(); if (_insertDataList.Count > 0) { UDTTransfer.ABUDTSingleRecordInsert(_insertDataList); } if (_updateDataList.Count > 0) { UDTTransfer.ABUDTSingleRecordUpdate(_updateDataList); } this.CancelButtonVisible = this.SaveButtonVisible = false; cbxGradeYear.Enabled = true; }
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 (_udtSrFlp05 == null) { _udtSrFlp05 = new UDTSingleRecordDef(); _udtSrFlp05.StudentID = _intStudentID; } _udtSrFlp05.Key = enumKey.本人概況_原住民血統.ToString(); if (radioButton1.Checked) { _udtSrFlp05.Data = radioButton1.Text; _udtSrFlp05.Remark = txtParents.Text + "_" + txtGroupName.Text; } else { _udtSrFlp05.Data = radioButton2.Text; _udtSrFlp05.Remark = ""; } if (string.IsNullOrEmpty(_udtSrFlp05.UID)) { iDataList.Add(_udtSrFlp05); } else { uDataList.Add(_udtSrFlp05); } // 血型 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 SaveGuardianData() { List <UDTSingleRecordDef> i_dataList = new List <UDTSingleRecordDef>(); List <UDTSingleRecordDef> u_dataList = new List <UDTSingleRecordDef>(); string saveKey1 = GroupName + "_監護人_"; // 儲存監護人資料 if (_UDTSingleRecordDict.ContainsKey("姓名")) { _UDTSingleRecordDict["姓名"].Data = txtName.Text; u_dataList.Add(_UDTSingleRecordDict["姓名"]); } else { UDTSingleRecordDef newData = new UDTSingleRecordDef(); newData.Key = saveKey1 + "姓名"; newData.StudentID = _intStudentID; newData.Data = txtName.Text; i_dataList.Add(newData); } if (_UDTSingleRecordDict.ContainsKey("性別")) { _UDTSingleRecordDict["性別"].Data = txtGender.Text; u_dataList.Add(_UDTSingleRecordDict["性別"]); } else { UDTSingleRecordDef newData = new UDTSingleRecordDef(); newData.Key = saveKey1 + "性別"; newData.StudentID = _intStudentID; newData.Data = txtGender.Text; i_dataList.Add(newData); } if (_UDTSingleRecordDict.ContainsKey("關係")) { _UDTSingleRecordDict["關係"].Data = txtRelationship.Text; u_dataList.Add(_UDTSingleRecordDict["關係"]); } else { UDTSingleRecordDef newData = new UDTSingleRecordDef(); newData.Key = saveKey1 + "關係"; newData.StudentID = _intStudentID; newData.Data = txtRelationship.Text; i_dataList.Add(newData); } if (_UDTSingleRecordDict.ContainsKey("電話")) { _UDTSingleRecordDict["電話"].Data = txtPhone.Text; u_dataList.Add(_UDTSingleRecordDict["電話"]); } else { UDTSingleRecordDef newData = new UDTSingleRecordDef(); newData.Key = saveKey1 + "電話"; newData.StudentID = _intStudentID; newData.Data = txtPhone.Text; i_dataList.Add(newData); } if (_UDTSingleRecordDict.ContainsKey("通訊地址")) { _UDTSingleRecordDict["通訊地址"].Data = txtMailingAddress.Text; u_dataList.Add(_UDTSingleRecordDict["通訊地址"]); } else { UDTSingleRecordDef newData = new UDTSingleRecordDef(); newData.Key = saveKey1 + "通訊地址"; newData.StudentID = _intStudentID; newData.Data = txtMailingAddress.Text; i_dataList.Add(newData); } // 家庭狀況_兄弟姊妹_排行 if (_UDTSingleRecordDict.ContainsKey(KeySiblingNoStr)) { _UDTSingleRecordDict[KeySiblingNoStr].Data = txtSiblingNo.Text; u_dataList.Add(_UDTSingleRecordDict[KeySiblingNoStr]); } else { UDTSingleRecordDef newData = new UDTSingleRecordDef(); newData.Key = KeySiblingNoStr; newData.StudentID = _intStudentID; newData.Data = txtSiblingNo.Text; i_dataList.Add(newData); } if (i_dataList.Count > 0) { UDTTransfer.ABUDTSingleRecordInsert(i_dataList); } if (u_dataList.Count > 0) { UDTTransfer.ABUDTSingleRecordUpdate(u_dataList); } }