示例#1
0
        public static List<LichHoc> getAll()
        {
            string query = "select * from LichHoc";
            list = new List<LichHoc>();
            DataTable db = DataProvider.LoadData(query);
            for (int i = 0; i < db.Rows.Count; i++)
            {
                LichHoc mh = new LichHoc();
                mh.Id = db.Rows[i]["Id"].ToString();

                mh.MaLop = db.Rows[i]["MaLop"].ToString();
                mh.ThoigianBD = db.Rows[i]["ThoigianBD"].ToString();
                mh.ThoigianKT = db.Rows[i]["ThoigianKT"].ToString();
                mh.NhomMH = db.Rows[i]["NhomMH"].ToString();
                mh.MonHoc = new MonHoc();
                mh.MonHoc.MaMH = db.Rows[i]["MaMH"].ToString();

                list.Add(mh);
            }
            foreach (LichHoc lh in list)
            {
                lh.Chitiet = getChiTiets(lh.Id);
                lh.MonHoc = BMonHoc.getByMaMH(lh.MonHoc.MaMH);
            }
            return list;
        }
示例#2
0
        public static List <LichHoc> getAll()
        {
            string query = "select * from LichHoc";

            list = new List <LichHoc>();
            DataTable db = DataProvider.LoadData(query);

            for (int i = 0; i < db.Rows.Count; i++)
            {
                LichHoc mh = new LichHoc();
                mh.Id = db.Rows[i]["Id"].ToString();

                mh.MaLop       = db.Rows[i]["MaLop"].ToString();
                mh.ThoigianBD  = db.Rows[i]["ThoigianBD"].ToString();
                mh.ThoigianKT  = db.Rows[i]["ThoigianKT"].ToString();
                mh.NhomMH      = db.Rows[i]["NhomMH"].ToString();
                mh.MonHoc      = new MonHoc();
                mh.MonHoc.MaMH = db.Rows[i]["MaMH"].ToString();

                list.Add(mh);
            }
            foreach (LichHoc lh in list)
            {
                lh.Chitiet = getChiTiets(lh.Id);
                lh.MonHoc  = BMonHoc.getByMaMH(lh.MonHoc.MaMH);
            }
            return(list);
        }
示例#3
0
        static void AddLH(LichHoc lh)
        {
            string query = "select * from LichHoc where MaMH='" + lh.MonHoc.MaMH + "'";

            if (DataProvider.LoadData(query).Rows.Count == 0)
            {
                string sql = string.Format("Insert into LichHoc values('{0}','{1}','{2}','{3}','{4}','{5}')", lh.Id, lh.MonHoc.MaMH, lh.NhomMH, lh.MaLop, lh.ThoigianBD, lh.ThoigianKT);
                DataProvider.Insert(sql);
                insertCT(lh.Chitiet);
            }
        }
示例#4
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);
        }
示例#5
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;
        }
示例#6
0
 static void AddLH(LichHoc lh)
 {
     string query = "select * from LichHoc where MaMH='" + lh.MonHoc.MaMH+"'";
     if (DataProvider.LoadData(query).Rows.Count==0)
     {
         string sql = string.Format("Insert into LichHoc values('{0}','{1}','{2}','{3}','{4}','{5}')", lh.Id, lh.MonHoc.MaMH, lh.NhomMH, lh.MaLop, lh.ThoigianBD, lh.ThoigianKT);
         DataProvider.Insert(sql);
         insertCT(lh.Chitiet);
     }
 }