Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 4
0
 public bool SuaTheLoai(TheLoaiSachDb tl)
 {
     return(theloaiDAL.SuaTheLoai(tl));
 }
Exemplo n.º 5
0
 public bool ThemTheLoai(TheLoaiSachDb tl)
 {
     return(theloaiDAL.ThemTheLoai(tl));
 }