Beispiel #1
0
        private void SaveDgDataToUDT()
        {
            _insertSemesterDataList.Clear();
            _updateSemesterDataList.Clear();
            foreach (DataGridViewRow dr in dgData.Rows)
            {
                UDTSemesterDataDef data = dr.Tag as UDTSemesterDataDef;
                data.S1a = GetCellValue(dr.Cells[col01.Index]);
                data.S1b = GetCellValue(dr.Cells[col02.Index]);
                data.S2a = GetCellValue(dr.Cells[col03.Index]);
                data.S2b = GetCellValue(dr.Cells[col04.Index]);
                data.S3a = GetCellValue(dr.Cells[col05.Index]);
                data.S3b = GetCellValue(dr.Cells[col06.Index]);
                data.S4a = GetCellValue(dr.Cells[col07.Index]);
                data.S4b = GetCellValue(dr.Cells[col08.Index]);
                data.S5a = GetCellValue(dr.Cells[col09.Index]);
                data.S5b = GetCellValue(dr.Cells[col10.Index]);
                data.S6a = GetCellValue(dr.Cells[col11.Index]);
                data.S6b = GetCellValue(dr.Cells[col12.Index]);
                if (string.IsNullOrEmpty(data.UID))
                {
                    _insertSemesterDataList.Add(data);
                }
                else
                {
                    _updateSemesterDataList.Add(data);
                }
            }

            if (_insertSemesterDataList.Count > 0)
            {
                UDTTransfer.ABUDTSemesterDataInsert(_insertSemesterDataList);
            }

            if (_updateSemesterDataList.Count > 0)
            {
                UDTTransfer.ABUDTSemesterDataUpdate(_updateSemesterDataList);
            }
        }
Beispiel #2
0
        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);
            }
        }