public StudABCard_YearlyForm_TextDropDown(UDTYearlyDataDef data)
        {
            InitializeComponent();
            _data = data;
            _TextBoxDropDownDic = new Dictionary<string, TextBoxDropDown>();
            foreach (Control cr in this.panelEx1.Controls)
                if (cr is TextBoxDropDown)
                {
                    TextBoxDropDown dd = cr as TextBoxDropDown;
                    _TextBoxDropDownDic.Add(cr.Name,dd);
                }

            foreach(string key in _TextBoxDropDownDic.Keys)
             {
                CheckedListBox itm = new CheckedListBox();
                itm.Name = key;
                itm.LostFocus += new EventHandler(itm_LostFocus);
                _CheckList.Add(itm);
            }
        }
        private void SetData()
        {
            _insertDataList.Clear();
            _updateDataList.Clear();
            foreach (DataGridViewColumn drc in dgData.Columns)
            {
                string key = GroupName + "_" + drc.HeaderText;
                if (_ColumIndexDict.ContainsKey(key))
                {
                    UDTYearlyDataDef data = drc.Tag as UDTYearlyDataDef;
                    if (data == null)
                    {
                        data = new UDTYearlyDataDef();
                        data.StudentID = _intStudentID;
                    }
                    data.Key = key;

                    foreach (KeyValuePair<string, int> rowDa in _RowIndexDict)
                    {
                        if (rowDa.Key == "一年級")
                        {
                            if (dgData.Rows[rowDa.Value].Cells[drc.Index].Value != null)
                                data.G1 = dgData.Rows[rowDa.Value].Cells[drc.Index].Value.ToString();
                            else
                                data.G1 = "";
                        }

                        if (rowDa.Key == "二年級")
                        {
                            if (dgData.Rows[rowDa.Value].Cells[drc.Index].Value != null)
                                data.G2 = dgData.Rows[rowDa.Value].Cells[drc.Index].Value.ToString();
                            else
                                data.G2 = "";
                        }

                        if (rowDa.Key == "三年級")
                        {
                            if (dgData.Rows[rowDa.Value].Cells[drc.Index].Value != null)
                                data.G3 = dgData.Rows[rowDa.Value].Cells[drc.Index].Value.ToString();
                            else
                                data.G3 = "";
                        }

                        if (rowDa.Key == "四年級")
                        {
                            if (dgData.Rows[rowDa.Value].Cells[drc.Index].Value != null)
                                data.G4 = dgData.Rows[rowDa.Value].Cells[drc.Index].Value.ToString();
                            else
                                data.G4 = "";
                        }

                        if (rowDa.Key == "五年級")
                        {
                            if (dgData.Rows[rowDa.Value].Cells[drc.Index].Value != null)
                                data.G5 = dgData.Rows[rowDa.Value].Cells[drc.Index].Value.ToString();
                            else
                                data.G5 = "";
                        }

                        if (rowDa.Key == "六年級")
                        {
                            if (dgData.Rows[rowDa.Value].Cells[drc.Index].Value != null)
                                data.G6 = dgData.Rows[rowDa.Value].Cells[drc.Index].Value.ToString();
                            else
                                data.G6 = "";
                        }
                    }
                    if (string.IsNullOrEmpty(data.UID))
                        _insertDataList.Add(data);
                    else
                        _updateDataList.Add(data);
                }
            }
        }
 public StudABCard_YearlyForm_Combo(UDTYearlyDataDef data)
 {
     InitializeComponent();
     _data = data;
 }
Example #4
0
        /// <summary>
        /// 報表用解析輔導綜合紀錄學年型
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static string Counsel_Yearly_Parse2(UDTYearlyDataDef data,int gr)
        {
            string retVal = "";
            if (data != null)
            {
                if (gr==1 && !string.IsNullOrWhiteSpace(data.G1))
                    retVal= data.G1;

                if (gr==2 && !string.IsNullOrWhiteSpace(data.G2))
                    retVal= data.G2;

                if (gr==3 && !string.IsNullOrWhiteSpace(data.G3))
                    retVal= data.G3;

                if (gr==4 && !string.IsNullOrWhiteSpace(data.G4))
                    retVal= data.G4;

                if (gr==5 && !string.IsNullOrWhiteSpace(data.G5))
                    retVal= data.G5;

                if (gr==6 && !string.IsNullOrWhiteSpace(data.G6))
                    retVal= data.G6;
            }
            return retVal;
        }
Example #5
0
        /// <summary>
        /// 報表用解析輔導綜合紀錄學年型 一:;二:;..
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static string Counsel_Yearly_Parse1(UDTYearlyDataDef data)
        {
            List<string> retVal = new List<string>();
            if (data != null)
            {
                if (!string.IsNullOrWhiteSpace(data.G1))
                    retVal.Add("一:"+data.G1);

                if (!string.IsNullOrWhiteSpace(data.G2))
                    retVal.Add("二:"+data.G2);

                if (!string.IsNullOrWhiteSpace(data.G3))
                    retVal.Add("三:"+data.G3);

                if (!string.IsNullOrWhiteSpace(data.G4))
                    retVal.Add("四:"+data.G4);

                if (!string.IsNullOrWhiteSpace(data.G5))
                    retVal.Add("五:"+data.G5);

                if (!string.IsNullOrWhiteSpace(data.G6))
                    retVal.Add("六:"+data.G6);
            }
            return string.Join(";", retVal.ToArray());
        }
        void _bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            if (_reloadQuestion)
                _QuestionDataDict = _QDMang.GetQuestionDataByGroupName(GroupName);

                _YearlyDataDict.Clear();
                foreach (UDTYearlyDataDef data in UDTTransfer.ABUDTYearlyDataSelectByStudentIDList(_StudentIDList))
                {
                    if (_ColumIndexDict.ContainsKey(data.Key))
                        if (!_YearlyDataDict.ContainsKey(data.Key))
                            _YearlyDataDict.Add(data.Key, data);
                }

                // 檢查資料是否完整,沒有資料補資料
                foreach (string str in _ColumIndexDict.Keys)
                {
                    if (!_YearlyDataDict.ContainsKey(str))
                    {
                        UDTYearlyDataDef data = new UDTYearlyDataDef();
                        data.Key = str;
                        data.StudentID = _intStudentID;
                        data.G1 = data.G2 = data.G3 = data.G4 = data.G5 = data.G6 = "";
                        _YearlyDataDict.Add(str, data);
                    }
                }

                // 社團與班級幹部
                _SemesterDataDict.Clear();
                foreach (UDTSemesterDataDef data in UDTTransfer.ABUDTSemesterDataSelectByStudentIDList(_StudentIDList))
                {
                    if (_SemesterDataKeyList.Contains(data.Key))
                        if (!_SemesterDataDict.ContainsKey(data.Key))
                            _SemesterDataDict.Add(data.Key, data);
                }

                // 初始值檢查,沒有建立初始值
                foreach (string str in _SemesterDataKeyList)
                {
                    if (!_SemesterDataDict.ContainsKey(str))
                    {
                        UDTSemesterDataDef data1 = new UDTSemesterDataDef();
                        data1.Key = str;
                        data1.StudentID = _intStudentID;
                        data1.S1a = data1.S1b = data1.S2a = data1.S2b = data1.S3a = data1.S3b = data1.S4a = data1.S4b = data1.S5a = data1.S5b = data1.S6a = data1.S6b = "";
                        _SemesterDataDict.Add(str, data1);
                    }
                }
        }
        // 取得資料
        private string GetItemString(UDTYearlyDataDef data)
        {
            string retVal = "";

            switch (_GradeYear)
            {
                case 1: retVal = data.G1; break;
                case 2: retVal = data.G2; break;
                case 3: retVal = data.G3; break;
                case 4: retVal = data.G4; break;
                case 5: retVal = data.G5; break;
                case 6: retVal = data.G6; break;
            }
            return retVal;
        }
        /// <summary>
        /// 儲存其它資料
        /// </summary>
        private void SaveYearlyData()
        {
            List<UDTYearlyDataDef> insertDataList = new List<UDTYearlyDataDef>();
            List<UDTYearlyDataDef> updateDataList = new List<UDTYearlyDataDef>();

            foreach (DataGridViewColumn drc in dgYearly.Columns)
            {
                string name = drc.HeaderText.Replace("(元)","");
                string key = GroupName + "_" + name;
                if (_ColumIndexDict.ContainsKey(key))
                {
                    UDTYearlyDataDef data = drc.Tag as UDTYearlyDataDef;
                    if (data == null)
                    {
                        data = new UDTYearlyDataDef();
                        data.StudentID = _intStudentID;
                    }
                    data.Key = key;

                    foreach (KeyValuePair<string, int> rowDa in _RowIndexDict)
                    {
                        if (rowDa.Key == "一年級")
                        {
                            if (dgYearly.Rows[rowDa.Value].Cells[drc.Index].Value != null)
                                data.G1 = dgYearly.Rows[rowDa.Value].Cells[drc.Index].Value.ToString();
                            else
                                data.G1 = "";
                        }

                        if (rowDa.Key == "二年級")
                        {
                            if (dgYearly.Rows[rowDa.Value].Cells[drc.Index].Value != null)
                                data.G2 = dgYearly.Rows[rowDa.Value].Cells[drc.Index].Value.ToString();
                            else
                                data.G2 = "";
                        }

                        if (rowDa.Key == "三年級")
                        {
                            if (dgYearly.Rows[rowDa.Value].Cells[drc.Index].Value != null)
                                data.G3 = dgYearly.Rows[rowDa.Value].Cells[drc.Index].Value.ToString();
                            else
                                data.G3 = "";
                        }

                        if (rowDa.Key == "四年級")
                        {
                            if (dgYearly.Rows[rowDa.Value].Cells[drc.Index].Value != null)
                                data.G4 = dgYearly.Rows[rowDa.Value].Cells[drc.Index].Value.ToString();
                            else
                                data.G4 = "";
                        }

                        if (rowDa.Key == "五年級")
                        {
                            if (dgYearly.Rows[rowDa.Value].Cells[drc.Index].Value != null)
                                data.G5 = dgYearly.Rows[rowDa.Value].Cells[drc.Index].Value.ToString();
                            else
                                data.G5 = "";
                        }

                        if (rowDa.Key == "六年級")
                        {
                            if (dgYearly.Rows[rowDa.Value].Cells[drc.Index].Value != null)
                                data.G6 = dgYearly.Rows[rowDa.Value].Cells[drc.Index].Value.ToString();
                            else
                                data.G6 = "";
                        }
                    }
                    if (string.IsNullOrEmpty(data.UID))
                        insertDataList.Add(data);
                    else
                        updateDataList.Add(data);
                }
            }

            if (insertDataList.Count > 0)
                UDTTransfer.ABUDTYearlyDataInsert(insertDataList);

            if (updateDataList.Count > 0)
                UDTTransfer.ABUDTYearlyDataUpdate(updateDataList);
        }