public List <LopHoc> GetLH(string sql) { try { SqlDataReader dr = dp.ExecReader(sql); List <LopHoc> list = new List <LopHoc>(); string malh, mamh1; DateTime tgbd, tgkt; int mahk, tinhtrang; while (dr.Read()) { malh = dr.GetString(0); mamh1 = dr.GetString(1); mahk = dr.GetInt32(2); tgbd = dr.GetDateTime(3); tgkt = dr.GetDateTime(4); tinhtrang = dr.GetInt32(5); LopHoc lh = new LopHoc(malh, mamh1, mahk, tgbd, tgkt, tinhtrang); list.Add(lh); } return(list); } catch (Exception ex) { throw ex; } finally { dp.disCon(); } }
public int Update(LopHoc l) { SqlParameter[] parm = new SqlParameter[] { new SqlParameter(PARM_MALOP, SqlDbType.Int), new SqlParameter(PARM_TENLOP, SqlDbType.NVarChar, 20), new SqlParameter(PARM_MAKHOI, SqlDbType.Int), new SqlParameter(PARM_MAGIAOVIEN, SqlDbType.Int), new SqlParameter(PARM_SISO, SqlDbType.Int), }; parm[0].Value = l.Malop; parm[1].Value = l.Tenlop; parm[2].Value = l.Makhoihoc; parm[3].Value = l.Magiaovien; parm[4].Value = l.Siso; return(DataAccessHelper.ExecuteNonQuery(DataAccessHelper.ConnectionString, CommandType.StoredProcedure, "tbl_LopHoc_Upd", parm)); }
public int SuaLH(LopHoc LH) { List <SqlParameter> list = new List <SqlParameter>(); list.Add(new SqlParameter("@malop", LH.MaLH)); list.Add(new SqlParameter("@mamh1", LH.MaMH)); list.Add(new SqlParameter("@mahk", LH.MaHK)); list.Add(new SqlParameter("@tgbatdau", LH.ThoiGianBatDau)); list.Add(new SqlParameter("@tgketthuc", LH.ThoiGianKetThuc)); list.Add(new SqlParameter("@tinhtrang", LH.TinhTrang)); try { return(dp.ExcuteNonquery("SuaLH", System.Data.CommandType.StoredProcedure, list)); } catch (Exception ex) { throw ex; } }
public LopHoc getmaLopHoc(int malop) { SqlParameter[] parm = new SqlParameter[] { new SqlParameter(PARM_MALOP, SqlDbType.Int) }; parm[0].Value = malop; LopHoc l = null; SqlDataReader dra = DataAccessHelper.ExecuteReader(DataAccessHelper.ConnectionString, CommandType.StoredProcedure, "tbl_LopHoc_Sel_ID", parm); if (dra.Read()) { l = new LopHoc( int.Parse(dra["malop"].ToString()), dra["tenlop"].ToString(), int.Parse(dra["makhoihoc"].ToString()), int.Parse(dra["magiaovien"].ToString()), int.Parse(dra["siso"].ToString())); } dra.Dispose(); return(l); }