public override string GetValidateRule() { //依據使用者設定的志願序數量 //來產生志願序的驗證數量 學生選填志願數 = GetVolunteerData.GetVolumnteerCount(); StringBuilder sb = new StringBuilder(); sb.AppendLine("<?xml version='1.0' encoding='utf-8' ?>"); sb.AppendLine("<?xml-stylesheet type='text/xsl' href='format.xsl' ?>"); DSXmlHelper dsx = new DSXmlHelper(); dsx.Load(Properties.Resources.ImportVolunteerRecordValRule); for (int x = 1; x <= 學生選填志願數; x++) { XmlElement Xmle = dsx.AddElement("./FieldList", "Field"); Xmle.SetAttribute("Required", "True"); Xmle.SetAttribute("Name", "志願" + x); Xmle.SetAttribute("EmptyAlsoValidate", "False"); Xmle.SetAttribute("Description", "學生的志願項目"); } StringBuilder Rule = new StringBuilder(); Rule.Append(sb); Rule.Append(dsx.BaseElement.OuterXml); return(Rule.ToString()); }
public CLUBVolunteerNameCheck() { ClubDic = new Dictionary <string, CLUBRecord>(); List <CLUBRecord> CLUBList = tool._A.Select <CLUBRecord>(); foreach (CLUBRecord each in CLUBList) { string CourseKey = each.SchoolYear + "," + each.Semester + "," + each.ClubName; if (!ClubDic.ContainsKey(CourseKey)) { ClubDic.Add(CourseKey, each); } } 學生選填志願數 = GetVolunteerData.GetVolumnteerCount(); }
public GetVolunteer() { VolDic = new Dictionary <string, VolunteerRecord>(); //取得學生本期所有的志願序內容 StringBuilder sb = new StringBuilder(); sb.AppendFormat("school_year={0} and semester={1}", School.DefaultSchoolYear, School.DefaultSemester); VolList = tool._A.Select <VolunteerRecord>(sb.ToString()); foreach (VolunteerRecord each in VolList) { if (!VolDic.ContainsKey(each.RefStudentID)) { VolDic.Add(each.RefStudentID, each); } } #region 整理出相關聯的學生與社團資料 List <string> StudentIDList = new List <string>(); List <string> ClubIDList = new List <string>(); foreach (VolunteerRecord vr in VolList) { if (!StudentIDList.Contains(vr.RefStudentID)) { StudentIDList.Add(vr.RefStudentID); } XmlElement xml = XmlHelper.LoadXml(vr.Content); foreach (XmlElement each in xml.SelectNodes("Club")) { if (!ClubIDList.Contains(each.GetAttribute("Ref_Club_ID"))) { ClubIDList.Add(each.GetAttribute("Ref_Club_ID")); } } } #endregion StudentDic = GetVolunteerData.GetStudent(StudentIDList); ClubDic = tool.GetClub(ClubIDList); }
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, "學生志願檢查完成!"); }
public CLUBNotBeRepeatedFill() { 學生選填志願數 = GetVolunteerData.GetVolumnteerCount(); }