예제 #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;
 }
예제 #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);
 }
예제 #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;
 }
예제 #4
0
파일: Sach.cs 프로젝트: hoangtuxuam/ThuVien
 public Sach()
 {
     nxb = new NXB();
     tacGia = new TacGia();
     theLoai = new TheLoai();
 }
예제 #5
0
 public bool xoaNXB(NXB theLoai)
 {
     return xnbDAL.deleteNXB(theLoai);
 }
예제 #6
0
 public bool themNXB(NXB theLoai)
 {
     return xnbDAL.insertNXB(theLoai);
 }
예제 #7
0
 public bool suaNXB(NXB theLoai)
 {
     return xnbDAL.updateNXB(theLoai);
 }
예제 #8
0
 public bool deleteNXB(NXB nxb)
 {
     String sql = @"DELETE FROM [dbo].[NXB]
                  WHERE [MaNXB]=" + nxb.MaNXB;
     return dbcnn.ThucThiSQL(sql);
 }
예제 #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);
 }