Пример #1
0
        private void AddRow(SchoolClassRecord classR, OccurClass each)
        {
            DataGridViewRow row = new DataGridViewRow();

            row.CreateCells(dataGridViewX1);
            row.Cells[0].Value = classR.school.Title;
            row.Cells[1].Value = each.GradeYear;
            row.Cells[2].Value = each.ClassName;
            row.Cells[3].Value = each.TeacherName;
            row.Tag            = each;
            dataGridViewX1.Rows.Add(row);
        }
Пример #2
0
        private SchoolClassRecord NowConnSchool(School school)
        {
            try
            {
                SchoolClassRecord scr = new SchoolClassRecord();
                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);

                //取得學校無班導師清單
                Envelope Response2    = conSchool.SendRequest("_.GetClassTeacherStatus", new Envelope());
                XElement elmResponse1 = XElement.Load(new StringReader(Response2.Body.XmlString));

                //整理日期資料
                foreach (XElement elmClub in elmResponse1.Elements("ClassRecord"))
                {
                    OccurClass classRecord = new OccurClass(elmClub);
                    scr.classList.Add(classRecord);
                }

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