public static DiemThi getDiemThi(string url) { DiemThi dT = new DiemThi(); List<MonHoc> listMH = new List<MonHoc>(); HtmlWeb htmlWeb = new HtmlWeb(); HtmlDocument document = htmlWeb.Load(url); HtmlNodeCollection nodes; int k = 2; int i = 0; do { nodes = null; nodes = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_div1']/table/tr[" + k + "]/td/span"); if (nodes != null) { if (k == 2) { dT.Thoigian = nodes.First().InnerText; } else if (nodes.Count == 2) { HtmlNodeCollection node = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_div1']/table/tr[" + k + "]/td/span[2]"); i++; switch (i) { case 1: dT.DiemTBHKHM = node.First().InnerText; break; case 2: dT.DiemTBHKHB = node.First().InnerText; break; case 3: dT.DiemTBTLHM = node.First().InnerText; break; case 4: dT.DiemTBTLHB = node.First().InnerText; break; case 5: dT.SoTCD = node.First().InnerText; break; case 6: dT.SoTCTL = node.First().InnerText; break; case 7: dT.DiemRL = node.First().InnerText; break; case 8: dT.LoaiRL = node.First().InnerText; break; } } else { MonHoc mH = new MonHoc(); for (int j = 1; j <= 10; j++) { HtmlNodeCollection nodes1 = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_div1']/table/tr[" + k + "]/td[" + j + "]/span"); foreach (var node in nodes1) { switch (j) { case 2: mH.MaMH = node.InnerText; break; case 3: mH.TenMH = node.InnerText; break; case 4: mH.SoTC = node.InnerText; break; case 5: mH.PhanTramKT = node.InnerText; break; case 6: mH.PhanTramThi = node.InnerText; break; case 7: mH.DiemKT = node.InnerText; break; case 8: mH.ThiL1 = node.InnerText; break; case 9: mH.TongDiem = node.InnerText; break; case 10: mH.TongDiemChu = node.InnerText; break; } } } listMH.Add(mH); } } k++; } while (nodes != null); dT.ListMH = listMH; return dT; }
public static HocPhi getHocPhi() { HocPhi hocPhi = new HocPhi(); DiemThi dT = new DiemThi(); List <CTHocPhi> listCT = new List <CTHocPhi>(); HtmlDocument document = new HtmlDocument(); document.LoadHtml(getTrangHocPhi()); HtmlNode nodeHP = document.DocumentNode.SelectSingleNode("//*[@id='ctl00_ContentPlaceHolder1_ctl00_lblNHHKOnline']"); hocPhi.ThoiGian = nodeHP.InnerText; nodeHP = document.DocumentNode.SelectSingleNode("//*[@id='ctl00_ContentPlaceHolder1_ctl00_SoTinChiHP']"); hocPhi.TongSoTC = nodeHP.InnerText; nodeHP = document.DocumentNode.SelectSingleNode("//*[@id='ctl00_ContentPlaceHolder1_ctl00_lblphaiDong']"); hocPhi.TongSoTien = nodeHP.InnerText; nodeHP = document.DocumentNode.SelectSingleNode("//*[@id='ctl00_ContentPlaceHolder1_ctl00_lblDongLanDau1']"); hocPhi.TienDongTTLD = nodeHP.InnerText; nodeHP = document.DocumentNode.SelectSingleNode("//*[@id='ctl00_ContentPlaceHolder1_ctl00_lblDaDongHKOffline']"); hocPhi.TienDaDong = nodeHP.InnerText; nodeHP = document.DocumentNode.SelectSingleNode("//*[@id='ctl00_ContentPlaceHolder1_ctl00_lblConNoHocKy']"); hocPhi.TienConNo = nodeHP.InnerText; HtmlNodeCollection nodes; int k = 2; do { nodes = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_gvHocPhi']/tr[" + k + "]/td[3]/span"); if (nodes != null) { CTHocPhi ct = new CTHocPhi(); MonHoc monHoc = new MonHoc(); for (int j = 2; j <= 10; j++) { HtmlNodeCollection nodesChiTiet = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_gvHocPhi']/tr[" + k + "]/td[" + j + "]/span"); foreach (HtmlNode node in nodesChiTiet) { switch (j) { case 2: monHoc.MaMH = node.InnerText; break; case 3: monHoc.TenMH = node.InnerText; break; case 4: ct.MaNhom = node.InnerText; break; case 6: monHoc.SoTC = node.InnerText; break; case 8: ct.HocPhi = node.InnerText; break; case 9: ct.MienGiam = node.InnerText; break; case 10: ct.PhaiDong = node.InnerText; break; } } } ct.monHoc = monHoc; listCT.Add(ct); } k++; }while (nodes != null); hocPhi.ListCTHP = listCT; return(hocPhi); }
public static DiemThi getDiemThi(string url) { DiemThi dT = new DiemThi(); List <MonHoc> listMH = new List <MonHoc>(); HtmlWeb htmlWeb = new HtmlWeb(); HtmlDocument document = htmlWeb.Load(url); HtmlNodeCollection nodes; int k = 2; int i = 0; do { nodes = null; nodes = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_div1']/table/tr[" + k + "]/td/span"); if (nodes != null) { if (k == 2) { dT.Thoigian = nodes.First().InnerText; } else if (nodes.Count == 2) { HtmlNodeCollection node = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_div1']/table/tr[" + k + "]/td/span[2]"); i++; switch (i) { case 1: dT.DiemTBHKHM = node.First().InnerText; break; case 2: dT.DiemTBHKHB = node.First().InnerText; break; case 3: dT.DiemTBTLHM = node.First().InnerText; break; case 4: dT.DiemTBTLHB = node.First().InnerText; break; case 5: dT.SoTCD = node.First().InnerText; break; case 6: dT.SoTCTL = node.First().InnerText; break; case 7: dT.DiemRL = node.First().InnerText; break; case 8: dT.LoaiRL = node.First().InnerText; break; } } else { MonHoc mH = new MonHoc(); for (int j = 1; j <= 10; j++) { HtmlNodeCollection nodes1 = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_div1']/table/tr[" + k + "]/td[" + j + "]/span"); foreach (var node in nodes1) { switch (j) { case 2: mH.MaMH = node.InnerText; break; case 3: mH.TenMH = node.InnerText; break; case 4: mH.SoTC = node.InnerText; break; case 5: mH.PhanTramKT = node.InnerText; break; case 6: mH.PhanTramThi = node.InnerText; break; case 7: mH.DiemKT = node.InnerText; break; case 8: mH.ThiL1 = node.InnerText; break; case 9: mH.TongDiem = node.InnerText; break; case 10: mH.TongDiemChu = node.InnerText; break; } } } listMH.Add(mH); } } k++; }while (nodes != null); dT.ListMH = listMH; return(dT); }
public static HocPhi getHocPhi() { HocPhi hocPhi = new HocPhi(); DiemThi dT = new DiemThi(); List<CTHocPhi> listCT = new List<CTHocPhi>(); HtmlDocument document = new HtmlDocument(); document.LoadHtml(getTrangHocPhi()); HtmlNode nodeHP = document.DocumentNode.SelectSingleNode("//*[@id='ctl00_ContentPlaceHolder1_ctl00_lblNHHKOnline']"); hocPhi.ThoiGian = nodeHP.InnerText; nodeHP = document.DocumentNode.SelectSingleNode("//*[@id='ctl00_ContentPlaceHolder1_ctl00_SoTinChiHP']"); hocPhi.TongSoTC = nodeHP.InnerText; nodeHP = document.DocumentNode.SelectSingleNode("//*[@id='ctl00_ContentPlaceHolder1_ctl00_lblphaiDong']"); hocPhi.TongSoTien = nodeHP.InnerText; nodeHP = document.DocumentNode.SelectSingleNode("//*[@id='ctl00_ContentPlaceHolder1_ctl00_lblDongLanDau1']"); hocPhi.TienDongTTLD = nodeHP.InnerText; nodeHP = document.DocumentNode.SelectSingleNode("//*[@id='ctl00_ContentPlaceHolder1_ctl00_lblDaDongHKOffline']"); hocPhi.TienDaDong = nodeHP.InnerText; nodeHP = document.DocumentNode.SelectSingleNode("//*[@id='ctl00_ContentPlaceHolder1_ctl00_lblConNoHocKy']"); hocPhi.TienConNo = nodeHP.InnerText; HtmlNodeCollection nodes; int k = 2; do { nodes = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_gvHocPhi']/tr[" + k + "]/td[3]/span"); if (nodes != null) { CTHocPhi ct = new CTHocPhi(); MonHoc monHoc = new MonHoc(); for (int j = 2; j <= 10; j++) { HtmlNodeCollection nodesChiTiet = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_gvHocPhi']/tr[" + k + "]/td[" + j + "]/span"); foreach (HtmlNode node in nodesChiTiet) { switch (j) { case 2: monHoc.MaMH = node.InnerText; break; case 3: monHoc.TenMH = node.InnerText; break; case 4: ct.MaNhom = node.InnerText; break; case 6: monHoc.SoTC = node.InnerText; break; case 8: ct.HocPhi = node.InnerText; break; case 9: ct.MienGiam = node.InnerText; break; case 10: ct.PhaiDong = node.InnerText; break; } } } ct.monHoc = monHoc; listCT.Add(ct); } k++; } while (nodes != null); hocPhi.ListCTHP = listCT; return hocPhi; }