/// <summary> /// 依據設定檔,建立Column /// </summary> private void SetColumn() { ByV = new Setup_ByV(); for (int x = 1; x <= ByV.學生選填志願數; x++) { DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn(); column.Name = "ByVColumn" + x; column.HeaderText = "社團" + x; column.Width = 100; dataGridViewX1.Columns.Add(column); } }
void BGW_Save_DoWork(object sender, DoWorkEventArgs e) { Setup_ByV ByV = (Setup_ByV)e.Argument; //全部刪除 List <ConfigRecord> DeleteList = tool._A.Select <ConfigRecord>(); tool._A.DeletedValues(DeleteList); List <ConfigRecord> InsertList = new List <ConfigRecord>(); ConfigRecord cr = new ConfigRecord(); cr.ConfigName = SetupName_1; cr.Content = ByV.學生選填志願數.ToString(); InsertList.Add(cr); cr = new ConfigRecord(); cr.ConfigName = SetupName_2; cr.Content = ByV.社團分配優先序.ToString(); InsertList.Add(cr); cr = new ConfigRecord(); cr.ConfigName = SetupName_3; if (ByV.已有社團記錄時) { cr.Content = "True"; } else { cr.Content = "False"; } InsertList.Add(cr); cr = new ConfigRecord(); cr.ConfigName = SetupName_4; cr.Content = ByV.學生可經由WEB查詢選社結果.ToString(); InsertList.Add(cr); tool._A.InsertValues(InsertList); }
void BGW_DoWork(object sender, DoWorkEventArgs e) { BGW.ReportProgress(0, "取得社團志願設定..."); By_V = new Setup_ByV(); //取得狀態合理之學生基本資料(狀態一般/延修) BGW.ReportProgress(15, "取得學生基本資料..."); StudentList = GetVolunteerData.GetStudentData(); StudentDic = GetVolunteerData.GetStudentDic(StudentList); //取得畫面可顯示的Row資料 BGW.ReportProgress(25, "建立班級學生資料..."); Dictionary <string, 社團志願分配的Row> VolClassRowDic = GetVolClassRow(StudentList); //取得學生選社物件 BGW.ReportProgress(35, "取得學生志願資料..."); Dictionary <string, VolunteerRecord> VolDic = GetVolunteerData.GetVolunteerDic(); //本學年度學期的社團清單 BGW.ReportProgress(45, "取得本期社團資料..."); CLUBDic = GetVolunteerData.GetSchoolYearClub(); //取得目前系統內Lock之學生清單 BGW.ReportProgress(53, "取得社團學生資料..."); SCJLockDic = GetVolunteerData.GetSCJDic(CLUBDic.Keys.ToList()); //社團選社限制檢查工具 BGW.ReportProgress(60, "取得社團選社限制..."); CLUBCheckDic = GetCLUBCheckDic(); Increase(CLUBCheckDic, SCJLockDic); BGW.ReportProgress(75, "建立畫面資料樣式..."); //取出班級 foreach (社團志願分配的Row each in VolClassRowDic.Values) { //取出學生 foreach (一名學生 student in each._StudentDic.Values) { //學生志願選填分配 if (VolDic.ContainsKey(student.student_id)) { each._Volunteer.Add(student.student_id, VolDic[student.student_id]); } //學生已參與社團分配 if (SCJLockDic.ContainsKey(student.student_id)) { each._SCJDic.Add(student.student_id, SCJLockDic[student.student_id]); //順便取得此社團記錄 if (CLUBDic.ContainsKey(SCJLockDic[student.student_id].RefClubID)) { CLUBRecord club = CLUBDic[SCJLockDic[student.student_id].RefClubID]; if (!each._ClubDic.ContainsKey(club.UID)) { each._ClubDic.Add(club.UID, club); } } } } } _RowList = VolClassRowDic.Values.ToList(); _RowList.Sort(SortClass); BGW.ReportProgress(100, "學生志願檢查完成!"); }
void BGW_DoWork(object sender, DoWorkEventArgs e) { Setup_ByV ByV = new Setup_ByV(); e.Result = ByV; }