/// <summary> /// 開始進行志願序資料整合 /// </summary> public void 開始進行志願序資料整合() { //整理志願序資料 foreach (OnlineVolunteer each in VolunteerList) { if (StudentDic.ContainsKey(each.RefStudentId)) { //學生 OnlineStudent OnlineStud = StudentDic[each.RefStudentId]; if (!string.IsNullOrEmpty(each.Content)) { XmlElement xml = DSXmlHelper.LoadXml(each.Content); int ClubNumber = 1; foreach (XmlElement node in xml.SelectNodes("Club")) { if (node.GetAttribute("Index") == ClubNumber.ToString()) { string clubID = node.GetAttribute("Ref_Club_ID"); if (ClubDic.ContainsKey(clubID)) { //社團 OnlineClub OnlineClub = ClubDic[clubID]; if (!OnlineStud.VolunteerList.ContainsKey(ClubNumber)) { OnlineStud.VolunteerList.Add(ClubNumber, OnlineClub); } } } ClubNumber++; } } } } }
/// <summary> /// 社團初始化 /// </summary> public void AddClub(OnlineClub club) { AllClubList.Add(club); //如果是模組掛載學校,則指定為主要社團 if (club.School == _MasterSchool) { _MsaterClub = club; } //如果沒有主要社團,則以其它社團為資料來源 if (_MsaterClub == null) { _MsaterClub = club; } }
/// <summary> /// 取得指定之(學年度/學期)社團清單 /// </summary> static public Dictionary <string, OnlineClub> GetClubList(Connection me, string SchoolYear, string Semester) { Envelope rsp = me.SendRequest("_.GetClubList", new Envelope(GetRequest(SchoolYear, Semester))); XElement clubs = XElement.Parse(rsp.Body.XmlString); Dictionary <string, OnlineClub> ClubDic = new Dictionary <string, OnlineClub>(); foreach (XElement club in clubs.Elements("K12.clubrecord.universal")) { OnlineClub cr = new OnlineClub(club); cr.School = me.AccessPoint.Name; if (!ClubDic.ContainsKey(cr.UID)) { ClubDic.Add(cr.UID, cr); } } return(ClubDic); }
/// <summary> /// 進行學生的志願分配 /// </summary> private void VolunteersDistributor(OnlineStudent oStudent, int Number, bool IsStep1) { string message = ""; if (oStudent.VolunteerList.Count != 0) { //如果學生身上有此志願,無此志願則視為選社失敗 if (oStudent.VolunteerList.ContainsKey(Number)) { OnlineClub oc = oStudent.VolunteerList[Number]; if (IsStep1) //高優先權 { if (oc.ClubName == oStudent.LastClubName) { #region 如果共同資源包含本社團 if (MergerClubDic.ContainsKey(oc.ClubName)) { OnlineMergerClub Mclub = MergerClubDic[oc.ClubName]; //不符資格,將帶有錯誤訊息 oStudent.ErrorMessage = Mclub.EligibilityCheck(oStudent); //符合資格 if (string.IsNullOrEmpty(oStudent.ErrorMessage)) { //符合資格 oStudent.SuccessSetupClub(Mclub); LogAssignRecord lar = new LogAssignRecord(); if (string.IsNullOrEmpty(LoginSchoolDic[oStudent.School])) { lar.部別 = oStudent.School + "(" + LoginSchoolDic[oStudent.School] + ")"; } else { lar.部別 = oStudent.School; } lar.班級 = oStudent.ClassName; lar.姓名 = oStudent.Name; lar.座號 = oStudent.SeatNo; lar.志願 = Number.ToString(); lar.社團名稱 = Mclub.ClubName; lar.其它 = "(高優先學生)"; LogDic.Add(lar); } } #endregion } } else //第二優先權 { #region 如果共同資源包含本社團 if (MergerClubDic.ContainsKey(oc.ClubName)) { OnlineMergerClub Mclub = MergerClubDic[oc.ClubName]; //不符資格,將帶有錯誤訊息 oStudent.ErrorMessage = Mclub.EligibilityCheck(oStudent); //符合資格 if (string.IsNullOrEmpty(oStudent.ErrorMessage)) { //符合資格 oStudent.SuccessSetupClub(Mclub); LogAssignRecord lar = new LogAssignRecord(); lar.部別 = GetSchoolName(oStudent.School); lar.班級 = oStudent.ClassName; lar.姓名 = oStudent.Name; lar.座號 = oStudent.SeatNo; lar.志願 = Number.ToString(); lar.社團名稱 = Mclub.ClubName; lar.其它 = ""; LogDic.Add(lar); } } #endregion } } } }