Exemple #1
0
        static void test2()
        {
            StreamReader sr      = new StreamReader(MyBK.Lib.Data.PathData.config);
            String       logined = sr.ReadLine();

            if (logined == null)
            {
                sr.Close();
                return;
            }
            String user = sr.ReadLine();
            String pass = sr.ReadLine();

            sr.Close();

            MyBKDKMH dkmh = new MyBKDKMH(user, pass);

            String html = dkmh.getDanhSachLoaiDangKy();

            LoaiDangKy[] l = MyBK.Lib.Parser.XMLParser.getDSLoaiDangKy(html);

            StreamWriter sw = new StreamWriter("log.html", false, Encoding.UTF8);

            sw.Write(html);

            LoaiDangKy li = null;

            for (int i = 0; i < l.Length; i++)
            {
                if (l[i].tenLoaiDK.IndexOf("Kết") >= 0)
                {
                    sw.WriteLine(l[i].hocKyID + "\n" + l[i].tenLoaiDK);
                    li = l[i];
                }
            }

            html = dkmh.getDanhSachDotDK(li.hocKyID);

            DotDangKy[] d = XMLParser.getDSDotDangKy(html);

            html = dkmh.getLichDangKy(d[0].idDotDangKy, d[0].idDotDangKy);


            html = dkmh.getThongTinNhomLopMonHoc("14014");

            sw.Write(html);


            sw.Close();
            Console.WriteLine("Done");
        }
Exemple #2
0
        private void button_search_Click(object sender, EventArgs e)
        {
            // xoa control
            panel_monhoc.Controls.Clear();
            label_soTC.Text  = "";
            label_maMH.Text  = "";
            label_tenMH.Text = "";

            String msmh = textBox_msmh.Text;
            String html = dkmh.searchMonHocDangKy(msmh);

            if (html.IndexOf("tblMonHocMoLop") < 0)
            {
                Label lb = new Label();
                lb.Text = "Không có môn học mở";
                lb.Dock = DockStyle.Top;
                panel_monhoc.Controls.Add(lb);
                return;
            }

            String monhocId = XMLParser.getMonHocIdFromHtml(html);
            String soTC     = XMLParser.getSoTCMonHocIdFromHtml(html);

            html = dkmh.getThongTinNhomLopMonHoc(monhocId);

            MonHoc monhoc = XMLParser.exportMonHoc(html);

            LopHoc[] listLH = monhoc.lopHoc;

            // set thong tin mon hoc

            label_maMH.Text  = monhoc.maSoMonHoc;
            label_tenMH.Text = monhoc.tenMonHoc;
            label_soTC.Text  = soTC;


            for (int i = listLH.Length - 1; i >= 0; i--)
            {
                BuoiHoc[] bh = listLH[i].buoiHoc;
                for (int j = bh.Length - 1; j >= 0; j--)
                {
                    NgayHoc_DKMHItem itembh = new NgayHoc_DKMHItem();
                    itembh.thu.Text      = bh[j].thu;
                    itembh.tiet.Text     = bh[j].tiet;
                    itembh.phong.Text    = bh[j].phong;
                    itembh.coso.Text     = bh[j].coSo;
                    itembh.bt.Text       = bh[j].lopBT;
                    itembh.tuan_hoc.Text = bh[j].tuan;
                    itembh.Dock          = DockStyle.Top;
                    itembh.TabIndex      = i;
                    panel_monhoc.Controls.Add(itembh);
                }

                NgayHoc_DKMHItem ngayhocheader = new NgayHoc_DKMHItem();
                ngayhocheader.setHeader();
                ngayhocheader.Dock = DockStyle.Top;
                panel_monhoc.Controls.Add(ngayhocheader);

                NhomLopItem item = new NhomLopItem();
                item.nhomlop.Text     = listLH[i].nhomLop;
                item.dk_siso.Text     = listLH[i].soSVDK;
                item.ngonngu.Text     = listLH[i].ngonNgu;
                item.nhomLT.Text      = listLH[i].nhomLT;
                item.giangvienLT.Text = listLH[i].gvLT;
                item.nhomBT.Text      = listLH[i].nhomBT;
                item.giangvienBT.Text = listLH[i].gvBT;
                item.sisoLT.Text      = listLH[i].siSoLop;
                item.Dock             = DockStyle.Top;
                panel_monhoc.Controls.Add(item);
            }

            if (panel_monhoc.VerticalScroll.Visible)
            {
                panel_nhomLopHeader.VerticalScroll.Visible = true;
            }
            else
            {
                panel_nhomLopHeader.VerticalScroll.Visible = false;
            }

            panel_nhomLopHeader.VerticalScroll.Enabled = false;
        }