Exemplo n.º 1
0
        private void btnViewClub_Click(object sender, EventArgs e)
        {
            SchoolClubRecord club = (SchoolClubRecord)dataGridViewX1.CurrentRow.Tag;
            frmClubDetail    fCD  = new frmClubDetail(club);

            fCD.ShowDialog();
        }
Exemplo n.º 2
0
 private void dataGridViewX1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.ColumnIndex != -1 && e.RowIndex != -1)
     {
         SchoolClubRecord club = (SchoolClubRecord)dataGridViewX1.Rows[e.RowIndex].Tag;
         frmClubDetail    fCD  = new frmClubDetail(club);
         fCD.ShowDialog();
     }
 }
Exemplo n.º 3
0
        public frmClubDetail(SchoolClubRecord club)
        {
            InitializeComponent();

            _club = club;

            labelX1.Text = string.Format("第{0}學年度 第{1}學期 社團清單", _club.SchoolYear, _club.Semester);

            //社團清單
            _club.clubNameList.Sort();
            foreach (string each in _club.clubNameList)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(dataGridViewX1);
                row.Cells[0].Value = each;

                dataGridViewX1.Rows.Add(row);
            }


            _club.clubList.Sort(GDsort);
            foreach (OccurClub each in _club.clubList)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(dataGridViewX2);
                row.Cells[0].Value = each.GradeYear;

                if (each.OccurDate != null)
                {
                    row.Cells[1].Value = each.OccurDate.ToString("yyyy/MM/dd");
                }

                row.Cells[2].Value = each.Week;
                row.Cells[3].Value = each.Period;
                dataGridViewX2.Rows.Add(row);
            }
        }
Exemplo n.º 4
0
        private void _bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            //儲存查詢資料
            cd["DefSchoolYear"] = defSchoolYear;
            cd["DefSemester"]   = defSemester;
            cd.Save();

            //選擇的學校
            List <string> schoolIDList = (List <string>)e.Argument;

            List <School> schoolList = tool._a.Select <School>(schoolIDList);

            List <SchoolClubRecord> SUMRecordList = new List <SchoolClubRecord>();
            int schoolCount = 0;

            _bgWorker.ReportProgress(schoolCount, "開始取得資料");

            foreach (School school in schoolList)
            {
                SchoolClubRecord schoolClub = NowConnSchool(school);
                if (schoolClub != null)
                {
                    schoolClub.SchoolYear = defSchoolYear;
                    schoolClub.Semester   = defSemester;
                    SUMRecordList.Add(schoolClub);
                }

                if (schoolCount <= 100)
                {
                    schoolCount++;
                    _bgWorker.ReportProgress(schoolCount, "取得資料中");
                }
            }

            _bgWorker.ReportProgress(schoolCount, "完成");
            e.Result = SUMRecordList;
        }
Exemplo n.º 5
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);
        }