public bool ThemTheLoai(TheLoaiSachDb tl) { try { String sql = "INSERT INTO [TheLoaiSach]([TenTheLoai]) " + " VALUES(@TenTheLoai)"; dt = dpro.GetRecordSet(sql, new DatabaseParamCls[] { new DatabaseParamCls("TenTheLoai", tl.TheLoaiSach), }); return(true); } catch (Exception e) { throw e; } return(false); }
public bool SuaTheLoai(TheLoaiSachDb tl) { try { String sql = "UPDATE [TheLoaiSach] " + " SET [TenTheLoai] = @TenTheLoai " + " WHERE TheLoai.ID = @ID"; dt = dpro.GetRecordSet(sql, new DatabaseParamCls[] { new DatabaseParamCls("TheLoaiSach", tl.TheLoaiSach), new DatabaseParamCls("ID", tl.ID) }); return(true); } catch (Exception e) { throw e; } return(false); }
public TheLoaiSachDb getTheLoaiById(int ID) { try { String sql = "Select * from TheLoaiSach tl where tl.id = @ID "; dt = dpro.GetRecordSet(sql, new DatabaseParamCls[] { new DatabaseParamCls("ID", ID) }); if (dt.Rows.Count >= 0) { var item = dt.Rows[0]; TheLoaiSachDb tl = new TheLoaiSachDb(); tl.ID = Convert.ToInt16(item["id"].ToString()); tl.TheLoaiSach = item["TenTheLoai"].ToString(); return(tl); } } catch (Exception e) { Console.WriteLine(e.Message); } return(null); }
public bool SuaTheLoai(TheLoaiSachDb tl) { return(theloaiDAL.SuaTheLoai(tl)); }
public bool ThemTheLoai(TheLoaiSachDb tl) { return(theloaiDAL.ThemTheLoai(tl)); }