Ejemplo n.º 1
0
 static void _bgWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     UDTTransfer.UDTEnrolmentExcessCreditsSelect();
     UDTTransfer.UDTEnrolmentExcessInputDateSelect();
 }
Ejemplo n.º 2
0
        void _bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            // 取得三年級學生一般生
            _StudentExcessCreditDict = QueryTransfer.GetStudentExcessCreditDict();

            // 取得比序資料
            List <UDT_EnrolmentExcessCredits> EnrolmentExcessCreditsList = UDTTransfer.UDTEnrolmentExcessCreditsSelect();

            _EnrolmentExcessCreditsDict.Clear();
            foreach (UDT_EnrolmentExcessCredits data in EnrolmentExcessCreditsList)
            {
                if (!_EnrolmentExcessCreditsDict.ContainsKey(data.StudentID))
                {
                    _EnrolmentExcessCreditsDict.Add(data.StudentID, data);
                }
            }

            // 比對資料放入DataTable
            _dtTable.Clear();
            _dtTableNonPass.Clear();
            List <string> nameList = new List <string>();

            nameList.Add("學號");
            nameList.Add("班級");
            nameList.Add("座號");

            List <string> ColNameList = new List <string>();

            ColNameList.Add("均衡學習");
            ColNameList.Add("服務學習");
            ColNameList.Add("體適能");
            ColNameList.Add("競賽表現");
            ColNameList.Add("檢定證照");
            ColNameList.Add("獎勵紀錄");
            ColNameList.Add("幹部任期");

            foreach (string name in ColNameList)
            {
                nameList.Add(name);
            }

            // 填入 DataTable
            foreach (string name in nameList)
            {
                _dtTable.Columns.Add(name);
                _dtTableNonPass.Columns.Add(name);
            }

            _TotalCount = _passCount = _noPassCount = 0;
            foreach (int sid in _StudentExcessCreditDict.Keys)
            {
                DataRow dr = _dtTable.NewRow();
                dr["學號"] = _StudentExcessCreditDict[sid].StudentNumber;
                dr["班級"] = _StudentExcessCreditDict[sid].ClassName;
                dr["座號"] = _StudentExcessCreditDict[sid].SeatNo;

                // 填入比序資料
                if (_EnrolmentExcessCreditsDict.ContainsKey(sid))
                {
                    UDT_EnrolmentExcessCredits udata = _EnrolmentExcessCreditsDict[sid];
                    foreach (string colName in ColNameList)
                    {
                        switch (colName)
                        {
                        case "均衡學習":
                            _StudentExcessCreditDict[sid].ExcessCreditDict.Add(colName, udata.Balanced);
                            dr[colName] = udata.Balanced;
                            break;

                        case "服務學習":
                            _StudentExcessCreditDict[sid].ExcessCreditDict.Add(colName, udata.Services);
                            dr[colName] = udata.Services;
                            break;

                        case "體適能":
                            _StudentExcessCreditDict[sid].ExcessCreditDict.Add(colName, udata.Fitness);
                            dr[colName] = udata.Fitness;
                            break;

                        case "競賽表現":
                            _StudentExcessCreditDict[sid].ExcessCreditDict.Add(colName, udata.Competition);
                            dr[colName] = udata.Competition;
                            break;

                        case "檢定證照":
                            _StudentExcessCreditDict[sid].ExcessCreditDict.Add(colName, udata.Verification);
                            dr[colName] = udata.Verification;
                            break;

                        case "獎勵紀錄":
                            _StudentExcessCreditDict[sid].ExcessCreditDict.Add(colName, udata.Merit);
                            dr[colName] = udata.Merit;
                            break;

                        case "幹部任期":
                            _StudentExcessCreditDict[sid].ExcessCreditDict.Add(colName, udata.Term);
                            dr[colName] = udata.Term;
                            break;
                        }
                    }

                    bool pass = true;

                    // 檢查是否有全部輸入
                    foreach (string str in _StudentExcessCreditDict[sid].ExcessCreditDict.Values)
                    {
                        if (string.IsNullOrEmpty(str))
                        {
                            pass = false;
                            break;
                        }
                    }
                    _StudentExcessCreditDict[sid].InputPass = pass;

                    if (pass)
                    {
                        _passCount++;
                    }
                    else
                    {
                        _noPassCount++;
                    }
                }
                _TotalCount++;

                if (_StudentExcessCreditDict[sid].InputPass == false)
                {
                    DataRow dr1 = _dtTableNonPass.NewRow();
                    foreach (string name in nameList)
                    {
                        dr1[name] = dr[name];
                    }
                    _dtTableNonPass.Rows.Add(dr1);
                }

                _dtTable.Rows.Add(dr);
            }
        }