Ejemplo n.º 1
0
        public static List <DiemMon> getDiemMon(int namhoc, int hocky)
        {
            List <DiemMon> listct = new List <DiemMon>();
            string         query  = "select * from DiemMon where NamHoc=" + namhoc + " and HocKy=" + hocky;
            DataTable      db     = DataProvider.LoadData(query);

            for (int i = 0; i < db.Rows.Count; i++)
            {
                DiemMon dm = new DiemMon();
                dm.Hocky  = hocky;
                dm.NamHoc = namhoc;

                dm.DiemKT      = db.Rows[i]["DiemKT"].ToString();
                dm.DiemThi     = db.Rows[i]["DiemThi"].ToString();
                dm.DiemTK10    = db.Rows[i]["DiemTK10"].ToString();
                dm.DiemChu     = db.Rows[i]["DiemChu"].ToString();
                dm.MonHoc.MaMH = db.Rows[i]["MaMH"].ToString();

                listct.Add(dm);
            }
            foreach (DiemMon dm in listct)
            {
                dm.MonHoc = BMonHoc.getByMaMH(dm.MonHoc.MaMH);
            }
            return(listct);
        }
Ejemplo n.º 2
0
        public static List<DiemMon> getDiemMon(int namhoc, int hocky)
        {
            List<DiemMon> listct = new List<DiemMon>();
            string query = "select * from DiemMon where NamHoc=" + namhoc + " and HocKy=" + hocky;
            DataTable db = DataProvider.LoadData(query);
            for (int i = 0; i < db.Rows.Count; i++)
            {
                DiemMon dm = new DiemMon();
                dm.Hocky = hocky;
                dm.NamHoc = namhoc;

                dm.DiemKT=db.Rows[i]["DiemKT"].ToString();
                dm.DiemThi = db.Rows[i]["DiemThi"].ToString();
                dm.DiemTK10 = db.Rows[i]["DiemTK10"].ToString();
                dm.DiemChu = db.Rows[i]["DiemChu"].ToString();
                dm.MonHoc.MaMH = db.Rows[i]["MaMH"].ToString();

                listct.Add(dm);
            }
            foreach (DiemMon dm in listct)
            {
                dm.MonHoc = BMonHoc.getByMaMH(dm.MonHoc.MaMH);
            }
            return listct;
        }
Ejemplo n.º 3
0
        static void AddDiemMon(DiemMon dm)
        {
            string query = string.Format("select * from DiemMon where MaMH='{0}' and NamHoc={1} and HocKy={2}", dm.MonHoc.MaMH, dm.NamHoc, dm.Hocky);

            if (DataProvider.LoadData(query).Rows.Count == 0)
            {
                string sql = string.Format("Insert into DiemMon values('{0}','{1}','{2}','{3}','{4}',{5},{6})", dm.MonHoc.MaMH, dm.DiemKT, dm.DiemThi, dm.DiemTK10, dm.DiemChu, dm.Hocky, dm.NamHoc);
                DataProvider.Insert(sql);
            }
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
0
 static void AddDiemMon(DiemMon dm)
 {
     string query = string.Format("select * from DiemMon where MaMH='{0}' and NamHoc={1} and HocKy={2}", dm.MonHoc.MaMH, dm.NamHoc, dm.Hocky);
     if (DataProvider.LoadData(query).Rows.Count==0)
     {
         string sql = string.Format("Insert into DiemMon values('{0}','{1}','{2}','{3}','{4}',{5},{6})", dm.MonHoc.MaMH, dm.DiemKT,dm.DiemThi,dm.DiemTK10,dm.DiemChu, dm.Hocky, dm.NamHoc);
         DataProvider.Insert(sql);
     }
 }