Esempio n. 1
0
        public static List<LichThi> getLichThi(string url)
        {
            List<LichThi> listlt = new List<LichThi>();
            HtmlWeb htmlWeb = new HtmlWeb();

            HtmlDocument document = htmlWeb.Load(url);

            HtmlNodeCollection nodes;
            int k = 2;
            do
            {
                nodes = null;
                nodes = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_gvXem']/tr[" + k + "]");

                if (nodes != null)
                {

                    LichThi lt = new LichThi();
                    for (int j = 1; j <= 12; j++)
                    {
                        HtmlNodeCollection nodes1 = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_gvXem']/tr[" + k + "]/td[" + j + "]");
                        foreach (var node in nodes1)
                        {
                            switch (j)
                            {
                                case 2:
                                    lt.MaMH = node.InnerText;
                                    break;
                                case 3:
                                    lt.TenMH = node.InnerText;
                                    break;
                                case 4:
                                    lt.GhepThi = node.InnerText;
                                    break;
                                case 5:
                                    lt.ToThi = node.InnerText;
                                    break;
                                case 6:
                                    lt.SoLuong = node.InnerText;
                                    break;

                                case 7:
                                    lt.NgayThi = node.InnerText;
                                    break;
                                case 8:
                                    lt.GioBD = node.InnerText;
                                    break;
                                case 9:
                                    lt.SoPhut = node.InnerText;
                                    break;
                                case 10:
                                    lt.Phong = node.InnerText;
                                    break;
                                case 11:
                                    lt.Phong = node.InnerText;
                                    break;

                            }
                        }
                    }
                    listlt.Add(lt);
                }
                k++;
            }
            while (nodes != null);

            return listlt;
        }
Esempio n. 2
0
        public static List <LichThi> getLichThi(string url)
        {
            List <LichThi> listlt  = new List <LichThi>();
            HtmlWeb        htmlWeb = new HtmlWeb();



            HtmlDocument document = htmlWeb.Load(url);

            HtmlNodeCollection nodes;
            int k = 2;

            do
            {
                nodes = null;
                nodes = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_gvXem']/tr[" + k + "]");

                if (nodes != null)
                {
                    LichThi lt = new LichThi();
                    for (int j = 1; j <= 12; j++)
                    {
                        HtmlNodeCollection nodes1 = document.DocumentNode.SelectNodes("//*[@id='ctl00_ContentPlaceHolder1_ctl00_gvXem']/tr[" + k + "]/td[" + j + "]");
                        foreach (var node in nodes1)
                        {
                            switch (j)
                            {
                            case 2:
                                lt.MaMH = node.InnerText;
                                break;

                            case 3:
                                lt.TenMH = node.InnerText;
                                break;

                            case 4:
                                lt.GhepThi = node.InnerText;
                                break;

                            case 5:
                                lt.ToThi = node.InnerText;
                                break;

                            case 6:
                                lt.SoLuong = node.InnerText;
                                break;

                            case 7:
                                lt.NgayThi = node.InnerText;
                                break;

                            case 8:
                                lt.GioBD = node.InnerText;
                                break;

                            case 9:
                                lt.SoPhut = node.InnerText;
                                break;

                            case 10:
                                lt.Phong = node.InnerText;
                                break;

                            case 11:
                                lt.Phong = node.InnerText;
                                break;
                            }
                        }
                    }
                    listlt.Add(lt);
                }
                k++;
            }while (nodes != null);


            return(listlt);
        }