Ejemplo n.º 1
0
        public static List <LichThi> LoadDataFromSV(string id)
        {
            list = new List <LichThi>();
            XmlDocument doc = new XmlDocument();

            doc.Load("http://localhost:56715/api/lichthi/" + id);
            XmlElement root = doc.DocumentElement;



            foreach (XmlNode node in root.ChildNodes)
            {
                LichThi lt = new LichThi();
                lt.GhepThi      = node.ChildNodes[0].InnerText.Trim();
                lt.GioBD        = node.ChildNodes[1].InnerText.Trim();
                lt.MonHoc       = new MonHoc();
                lt.MonHoc.MaMH  = node.ChildNodes[3].InnerText.Trim();
                lt.MonHoc.TenMH = node.ChildNodes[8].InnerText.Trim();
                lt.NgayThi      = node.ChildNodes[4].InnerText.Trim();
                lt.PhongThi     = node.ChildNodes[5].InnerText.Trim();
                lt.SoLuong      = int.Parse(node.ChildNodes[6].InnerText.Trim());
                lt.SoPhut       = int.Parse(node.ChildNodes[7].InnerText.Trim());
                lt.ToThi        = node.ChildNodes[9].InnerText.Trim();
                list.Add(lt);
                BMonHoc.AddMon(lt.MonHoc);
                AddLT(lt);
            }

            return(list);
        }
Ejemplo n.º 2
0
        public static List <LichHoc> LoadDataFromSV(string id)
        {
            list = new List <LichHoc>();
            XmlDocument doc = new XmlDocument();

            doc.Load("http://localhost:56715/api/thoikhoabieu/" + id);
            XmlElement root = doc.DocumentElement;



            int k = getID();

            foreach (XmlNode node in root.ChildNodes)
            {
                LichHoc lh = new LichHoc();
                MonHoc  mh = new MonHoc();
                lh.Id          = k.ToString();
                lh.MonHoc      = new MonHoc();
                lh.MonHoc.MaMH = node.ChildNodes[2].InnerText.Trim();
                lh.MaLop       = node.ChildNodes[1].InnerText.Trim();
                lh.NhomMH      = node.ChildNodes[3].InnerText.Trim();
                mh.MaMH        = lh.MonHoc.MaMH;
                mh.TenMH       = node.ChildNodes[7].InnerText.Trim();
                mh.SoTC        = int.Parse(node.ChildNodes[5].InnerText.Trim());
                mh.TileThi     = 0;
                lh.ThoigianBD  = node.ChildNodes[10].InnerText.Trim().Substring(0, 10);
                lh.ThoigianKT  = node.ChildNodes[10].InnerText.Trim().Substring(12);
                List <chiTietLH> listct = new List <chiTietLH>();
                // constant
                int one  = 1;
                int five = 5;
                for (int i = 0; i < node.ChildNodes[8].InnerText.Trim().Length; i++)
                {
                    chiTietLH ct = new chiTietLH();
                    ct.Id = k.ToString();
                    string magv = node.ChildNodes[0].InnerText.Trim().Substring(i * five, five);
                    ct.CBGD       = BUser.getUser(magv).Hoten;
                    ct.Phong      = node.ChildNodes[4].InnerText.Trim().Substring(i * 6, 6);
                    ct.Thu        = node.ChildNodes[8].InnerText.Trim().Substring(i * one, one);
                    ct.TietBatDau = node.ChildNodes[9].InnerText.Trim().Substring(i * one, one);//tiet bat dau = 10

                    ct.SoTiet = node.ChildNodes[6].InnerText.Trim()[i].ToString();
                    listct.Add(ct);
                }
                lh.Chitiet = listct;
                list.Add(lh);
                AddLH(lh);
                BMonHoc.AddMon(mh);
                k++;
            }

            return(list);
        }
Ejemplo n.º 3
0
        public static List <DiemThi> LoadDataFromSV(string id)
        {
            list = new List <DiemThi>();
            XmlDocument doc = new XmlDocument();

            doc.Load("http://localhost:56715/api/diemthi/" + id);
            XmlElement root = doc.DocumentElement;



            foreach (XmlNode node in root.ChildNodes)
            {
                DiemThi lt = new DiemThi();
                lt.DiemRL   = node.ChildNodes[0].InnerText.Trim();
                lt.DiemMons = new List <DiemMon>();
                foreach (XmlNode nod in node.ChildNodes[5].ChildNodes)
                {
                    DiemMon dm = new DiemMon();
                    MonHoc  mh = new MonHoc();
                    dm.Hocky       = int.Parse(node.ChildNodes[9].InnerText.Trim()[7].ToString());
                    dm.NamHoc      = int.Parse(node.ChildNodes[9].InnerText.Trim().Substring(17));
                    dm.DiemKT      = nod.ChildNodes[0].InnerText;
                    dm.MonHoc      = new MonHoc();
                    dm.MonHoc.MaMH = nod.ChildNodes[1].InnerText;
                    mh.MaMH        = dm.MonHoc.MaMH;
                    mh.TenMH       = nod.ChildNodes[5].InnerText;
                    mh.SoTC        = int.Parse(nod.ChildNodes[4].InnerText);
                    mh.TileThi     = int.Parse(nod.ChildNodes[3].InnerText.ToString());
                    dm.DiemThi     = nod.ChildNodes[6].InnerText;
                    dm.DiemTK10    = nod.ChildNodes[7].InnerText;
                    dm.DiemChu     = nod.ChildNodes[8].InnerText;
                    lt.DiemMons.Add(dm);
                    AddDiemMon(dm);
                    BMonHoc.AddMon(mh);
                    BMonHoc.UpdateMH(mh);
                }
                lt.DiemTB4    = node.ChildNodes[1].InnerText.Trim();
                lt.DiemTB10   = node.ChildNodes[2].InnerText.Trim();
                lt.DiemTBTL4  = node.ChildNodes[3].InnerText.Trim();
                lt.DiemTBTL10 = node.ChildNodes[4].InnerText.Trim();
                lt.LoaiRL     = node.ChildNodes[6].InnerText.Trim();
                lt.SoTCDat    = node.ChildNodes[7].InnerText.Trim();
                lt.SoTCTL     = node.ChildNodes[8].InnerText.Trim();
                lt.NamHoc     = int.Parse(node.ChildNodes[9].InnerText.Trim().Substring(17));
                lt.Hocky      = int.Parse(node.ChildNodes[9].InnerText.Trim()[7].ToString());

                AddDiemThi(lt);
                list.Add(lt);
            }

            return(list);
        }