public static void AddMon(MonHoc mh) { string sql; string query = string.Format("select * from MonHoc Where MaMH='{0}'", mh.MaMH); if (DataProvider.LoadData(query).Rows.Count == 0) { sql = string.Format(@"Insert into MonHoc values('{0}','{1}',{2},{3})", mh.MaMH, mh.TenMH, mh.SoTC, mh.TileThi); DataProvider.Insert(sql); } }
public static void UpdateMH(MonHoc mh) { try { string query = string.Format("update MonHoc set TileThi={0} where MaMH='{1}'", mh.TileThi, mh.MaMH); DataProvider.ExecuteQuery(query); } catch { } }
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); }
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); }
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; }
public static MonHoc getByMaMH(string maMH) { MonHoc mh = new MonHoc(); string query = string.Format("select * from MonHoc Where MaMH='{0}'", maMH); DataTable db = DataProvider.LoadData(query); if (db.Rows.Count >0) { mh.MaMH = db.Rows[0]["MaMH"].ToString(); mh.TenMH = db.Rows[0]["TenMH"].ToString(); mh.SoTC = int.Parse(db.Rows[0]["SoTC"].ToString()); mh.TileThi = int.Parse(db.Rows[0]["TileThi"].ToString()); } return mh; }
public static MonHoc getByMaMH(string maMH) { MonHoc mh = new MonHoc(); string query = string.Format("select * from MonHoc Where MaMH='{0}'", maMH); DataTable db = DataProvider.LoadData(query); if (db.Rows.Count > 0) { mh.MaMH = db.Rows[0]["MaMH"].ToString(); mh.TenMH = db.Rows[0]["TenMH"].ToString(); mh.SoTC = int.Parse(db.Rows[0]["SoTC"].ToString()); mh.TileThi = int.Parse(db.Rows[0]["TileThi"].ToString()); } return(mh); }
public List<MonHoc> GetAll() { string sql="Select * from MonHoc"; list = new List<MonHoc>(); DataTable db=DataProvider.LoadData(sql); for (int i=0;i<db.Rows.Count;i++) { MonHoc mh = new MonHoc(); mh.MaMH = db.Rows[i]["MaMH"].ToString(); mh.TenMH = db.Rows[i]["TenMH"].ToString(); mh.SoTC = int.Parse(db.Rows[i]["SoTC"].ToString()); mh.TileThi = int.Parse(db.Rows[i]["TileThi"].ToString()); list.Add(mh); } return list; }
public static List <MonHoc> GetAll() { string sql = "Select * from MonHoc"; list = new List <MonHoc>(); DataTable db = DataProvider.LoadData(sql); for (int i = 0; i < db.Rows.Count; i++) { MonHoc mh = new MonHoc(); mh.MaMH = db.Rows[i]["MaMH"].ToString(); mh.TenMH = db.Rows[i]["TenMH"].ToString(); mh.SoTC = int.Parse(db.Rows[i]["SoTC"].ToString()); mh.TileThi = int.Parse(db.Rows[i]["TileThi"].ToString()); list.Add(mh); } return(list); }
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; }
public void AddMon(MonHoc mh) { string sql; sql=string.Format("Insert into MonHoc values('{0}'.'{1}',{2},{3}",mh.MaMH,mh.TenMH,mh.SoTC,mh.TileThi); DataProvider.Insert(sql); }