Exemplo n.º 1
7
 public List<NXB> getListNXB()
 {
     String sql = @"SELECT [MaNXB]
                       ,[TenNXB]
                       ,[DiaChiNXB]
                       ,[DienThoaiNXB]
                       ,[Website]
                   FROM [dbo].[NXB]";
     DataTable table = dbcnn.getdata(sql);
     List<NXB> listDG = new List<NXB>();
     foreach (DataRow row in table.Rows)
     {
         NXB newNXB = new NXB();
         newNXB.MaNXB = (int)row["MaNXB"];
         newNXB.TenNXB = (String)row["TenNXB"];
         newNXB.DiaChiNXB = (String)row["DiaChiNXB"];
         newNXB.DienThoaiNXB = (string)row["DienThoaiNXB"];
         newNXB.Website = (string)row["Website"];
         listDG.Add(newNXB);
     }
     return listDG;
 }
Exemplo n.º 2
0
 public bool insertNXB(NXB nxb)
 {
     String sql = @"INSERT INTO [dbo].[NXB]
                        ([TenNXB]
                        ,[DiaChiNXB]
                        ,[DienThoaiNXB]
                        ,[Website])
                  VALUES
                        (N'"+nxb.TenNXB+ @"'
                        ,N'" + nxb.DiaChiNXB + @"'
                        ,N'" + nxb.DienThoaiNXB + @"'
                        ,N'" + nxb.Website + @"')";
     return dbcnn.ThucThiSQL(sql);
 }
Exemplo n.º 3
0
 public NXB getNXBById(int id)
 {
     String sql = @"SELECT [MaNXB]
                       ,[TenNXB]
                       ,[DiaChiNXB]
                       ,[DienThoaiNXB]
                       ,[Website]
                   FROM [dbo].[NXB] WHERE [MaNXB]=" + id;
     DataTable table = dbcnn.getdata(sql);
     NXB newNXB = new NXB();
     if (table.Rows.Count == 1)
     {
         newNXB.MaNXB = (int)table.Rows[0]["MaNXB"];
         newNXB.TenNXB = (string)table.Rows[0]["TenNXB"];
         newNXB.DiaChiNXB = (string)table.Rows[0]["DiaChiNXB"];
         newNXB.DienThoaiNXB = (string)table.Rows[0]["DienThoaiNXB"];
         newNXB.Website = (string)table.Rows[0]["Website"];
     }
     return newNXB;
 }
Exemplo n.º 4
0
 public Sach()
 {
     nxb = new NXB();
     tacGia = new TacGia();
     theLoai = new TheLoai();
 }
Exemplo n.º 5
0
 public bool xoaNXB(NXB theLoai)
 {
     return xnbDAL.deleteNXB(theLoai);
 }
Exemplo n.º 6
0
 public bool themNXB(NXB theLoai)
 {
     return xnbDAL.insertNXB(theLoai);
 }
Exemplo n.º 7
0
 public bool suaNXB(NXB theLoai)
 {
     return xnbDAL.updateNXB(theLoai);
 }
Exemplo n.º 8
0
 public bool deleteNXB(NXB nxb)
 {
     String sql = @"DELETE FROM [dbo].[NXB]
                  WHERE [MaNXB]=" + nxb.MaNXB;
     return dbcnn.ThucThiSQL(sql);
 }
Exemplo n.º 9
0
 public bool updateNXB(NXB nxb)
 {
     String sql = @"UPDATE [dbo].[NXB]
                    SET [TenNXB] = N'" + nxb.TenNXB + @"'
                       ,[DiaChiNXB] = N'" + nxb.DiaChiNXB + @"'
                       ,[DienThoaiNXB] = N'" + nxb.DienThoaiNXB + @"'
                       ,[Website] = N'" + nxb.Website + @"'
                  WHERE [MaNXB]="+nxb.MaNXB;
     return dbcnn.ThucThiSQL(sql);
 }