Example #1
0
        private int SortLogRecord(LogAssignRecord lar1, LogAssignRecord lar2)
        {
            string Name1 = lar1.部別.PadLeft(20, '0');

            Name1 += lar1.班級.PadLeft(10, '0');
            Name1 += lar1.座號.PadLeft(3, '0');

            string Name2 = lar2.部別.PadLeft(20, '0');

            Name2 += lar2.班級.PadLeft(10, '0');
            Name2 += lar2.座號.PadLeft(3, '0');

            return(Name1.CompareTo(Name2));
        }
Example #2
0
        /// <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
                    }
                }
            }
        }