private void SetData() { _insertDataList.Clear(); _updateDataList.Clear(); foreach (Control cr in this.Controls) { if (cr is TextBox && cr.Enabled == true) { UDTSingleRecordDef data = cr.Tag as UDTSingleRecordDef; if (data == null) { data = new UDTSingleRecordDef(); data.Key = cr.Name; data.StudentID = _intStudentID; } data.Data = cr.Text; if (string.IsNullOrEmpty(data.UID)) _insertDataList.Add(data); else _updateDataList.Add(data); } } UDTSingleRecordDef uDT = dtFillDate.Tag as UDTSingleRecordDef; if (uDT == null) { uDT = new UDTSingleRecordDef(); uDT.StudentID = _intStudentID; uDT.Key = dtFillDate.Name; } if (dtFillDate.IsEmpty) uDT.Data = ""; else uDT.Data = dtFillDate.Value.ToShortDateString(); if (string.IsNullOrEmpty(uDT.UID)) _insertDataList.Add(uDT); else _updateDataList.Add(uDT); }
private void SetData() { _insertDataList.Clear(); _updateDataList.Clear(); // 取得畫面資料 foreach (Control cr in this.Controls) { if (cr is TextBox) { UDTSingleRecordDef uData = cr.Tag as UDTSingleRecordDef; if (uData == null) { uData = new UDTSingleRecordDef(); uData.Key = cr.Name; uData.StudentID = _intStudentID; } uData.Data = cr.Text; if (string.IsNullOrEmpty(uData.UID)) _insertDataList.Add(uData); else _updateDataList.Add(uData); } } }
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 LoadAnswerData() { _udtMrFlp01Dict.Clear(); _udtMrFlp02Dict.Clear(); _udtSdDg01 = _udtSdDg02 = null; _udtSrFlp01 = _udtSrFlp02 = null; List<UDTSingleRecordDef> SingleRecordList = UDTTransfer.ABUDTSingleRecordSelectByStudentIDList(_StudenIDList); foreach(UDTSingleRecordDef data in SingleRecordList) { if(data.Key == enumKey.本人概況_血型.ToString()) _udtSrFlp01=data; if (data.Key == enumKey.本人概況_宗教.ToString()) _udtSrFlp02 = data; } List<UDTSemesterDataDef> SemesterDataList = UDTTransfer.ABUDTSemesterDataSelectByStudentIDList(_StudenIDList); foreach (UDTSemesterDataDef data in SemesterDataList) { if (data.Key == enumKey.本人概況_身高.ToString()) _udtSdDg01 = data; if (data.Key == enumKey.本人概況_體重.ToString()) _udtSdDg02 = data; } List<UDTMultipleRecordDef> MultipleRecordList = UDTTransfer.ABUDTMultipleRecordSelectByStudentIDList(_StudenIDList); foreach (UDTMultipleRecordDef data in MultipleRecordList) { if (data.Key == enumKey.本人概況_生理缺陷.ToString()) if (!_udtMrFlp01Dict.ContainsKey(data.Data)) _udtMrFlp01Dict.Add(data.Data, data); if (data.Key == enumKey.本人概況_曾患特殊疾病.ToString()) if (!_udtMrFlp02Dict.ContainsKey(data.Data)) _udtMrFlp02Dict.Add(data.Data, data); } }
private void SetData() { _insertDataList.Clear(); _updateDataList.Clear(); UDTSingleRecordDef uDT = txtRemark.Tag as UDTSingleRecordDef; if (uDT == null) { uDT = new UDTSingleRecordDef(); uDT.StudentID = _intStudentID; uDT.Key = NewKey; } uDT.Data = txtRemark.Text; if (string.IsNullOrEmpty(uDT.UID)) _insertDataList.Add(uDT); else _updateDataList.Add(uDT); }
void _bgWorker_DoWork(object sender, DoWorkEventArgs e) { _data = null; foreach (UDTSingleRecordDef data in UDTTransfer.ABUDTSingleRecordSelectByStudentIDList(_StudentIDList)) { if (data.Key.Contains(GroupName)||data.Key.Contains((NewKey))) _data = data; } }
/// <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); }