Пример #1
0
        private int GDsort(OccurClub x, OccurClub y)
        {
            string geName = x.GradeYear + x.OccurDate.ToString("yyyy/MM/dd");
            string chName = y.GradeYear + y.OccurDate.ToString("yyyy/MM/dd");

            return(geName.CompareTo(chName));
        }
Пример #2
0
        private SchoolClubRecord NowConnSchool(School school)
        {
            try
            {
                SchoolClubRecord scr = new SchoolClubRecord();
                scr.school = school;

                //取得局端登入後Greening發的Passport,並登入指定的Contract
                Connection con = new Connection();
                con.Connect(FISCA.Authentication.DSAServices.DefaultDataSource.AccessPoint, "ischool.kh.central_office.user", FISCA.Authentication.DSAServices.PassportToken);

                //取得該Contract所發的Passport
                Envelope      Response1 = con.SendRequest("DS.Base.GetPassportToken", new Envelope());
                PassportToken Passport  = new PassportToken(Response1.Body);

                //TODO:拿此Passport登入各校
                Connection conSchool = new Connection();
                conSchool.Connect(school.DSNS, "ischool.kh.central_office", Passport);

                //取得學校各年級上課時間表
                //此SQL 共用2個Service GetClubStatus,GetClubCount

                XmlHelper req = new XmlHelper("<Request/>");
                req.AddElement("Condition");
                req.AddElement("Condition", "SchoolYear", defSchoolYear);
                req.AddElement("Condition", "Semester", defSemester);

                Envelope Response2    = conSchool.SendRequest("_.GetClubStatus", new Envelope(req));
                XElement elmResponse1 = XElement.Load(new StringReader(Response2.Body.XmlString));

                //整理日期資料
                foreach (XElement elmClub in elmResponse1.Elements("OccurClub"))
                {
                    OccurClub club = new OccurClub(elmClub);
                    scr.clubList.Add(club);
                }

                //取得學校各社團清單與數量
                Envelope Response3    = conSchool.SendRequest("_.GetClubCount", new Envelope(req));
                XElement elmResponse3 = XElement.Load(new StringReader(Response3.Body.XmlString));

                //整理社團資料
                foreach (XElement elmCourse in elmResponse3.Elements("Course"))
                {
                    scr.社團數 += 1;
                    scr.clubNameList.Add(elmCourse.ElementText("CourseName"));
                }

                return(scr);
            }
            catch (Exception ex)
            {
                if (ex.Message == "Can't find service:GetClubStatus")
                {
                    MsgBox.Show("發生錯誤:\n" + school.Title + " - " + " 校端未安裝UDM(GetClubStatus)");
                }
                else
                {
                    MsgBox.Show("發生錯誤:\n" + school.Title + " - " + ex.Message);
                }
                //發生錯誤
            }
            return(null);
        }