示例#1
0
 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);
 }
示例#2
0
 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);
 }
示例#3
0
 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);
 }
示例#4
0
 public bool SuaTheLoai(TheLoaiSachDb tl)
 {
     return(theloaiDAL.SuaTheLoai(tl));
 }
示例#5
0
 public bool ThemTheLoai(TheLoaiSachDb tl)
 {
     return(theloaiDAL.ThemTheLoai(tl));
 }