Example #1
0
        public int insertVanDe(BKIT.Entities.VanDe objVanDe)
        {
            Database db = DatabaseFactory.CreateDatabase();
            string sqlCommand = "INSERT INTO VanDe(IDVanDe,Ten,IDLoaiVD,Tien,UserID,Ghichu,NgayCapNhat) " +
                "VALUES (@IDVanDe,@Ten,@IDLoaiVD,@Tien,@UserID,@Ghichu,@NgayCapNhat)";
            DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
            try
            {
                int ID = GetNextAVailableID();
                objVanDe.IDVanDe = ID;
                db.AddInParameter(dbCommand, "IDVanDe", DbType.Int32, objVanDe.IDVanDe);
                db.AddInParameter(dbCommand, "Ten", DbType.String, objVanDe.Ten);
                db.AddInParameter(dbCommand, "IDLoaiVD", DbType.Int32, objVanDe.IDLoaiVD);
                db.AddInParameter(dbCommand, "Tien", DbType.Decimal, objVanDe.Tien);
                db.AddInParameter(dbCommand, "UserID", DbType.Int32, objVanDe.UserID);
                db.AddInParameter(dbCommand, "Ghichu", DbType.String, objVanDe.GhiChu);
                db.AddInParameter(dbCommand, "NgayCapNhat", DbType.DateTime, objVanDe.NgayCapNhat);

                db.ExecuteNonQuery(dbCommand);
                dbCommand.Connection.Close();
                return ID;
            }
            catch
            {
                dbCommand.Connection.Close();
                return -1;
            }
        }
 public int insertChiTietHoaDonNhap(BKIT.Entities.ChiTietHoaDonNhap objChiTietHoaDonNhap)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "INSERT INTO ChiTietHoaDonNhap(IDChiTietHoaDonNhap,IDHoaDonNhap,IDSanPham,SoLuong,GiaNhap) " +
         "VALUES (@idchitiethoadonnhap,@idhoadonnhap,@idsanpham,@soluong,@gianhap)";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         int ID = GetNextAVailableID();
         objChiTietHoaDonNhap.IDChiTietHoaDonNhap = ID;
         db.AddInParameter(dbCommand, "idchitiethoadonnhap", DbType.Int32, objChiTietHoaDonNhap.IDChiTietHoaDonNhap);
         db.AddInParameter(dbCommand, "idhoadonnhap", DbType.Int32, objChiTietHoaDonNhap.IDHoaDonNhap);
         db.AddInParameter(dbCommand, "idsanpham", DbType.Int32, objChiTietHoaDonNhap.IDSanPham);
         db.AddInParameter(dbCommand, "soluong", DbType.Int32, objChiTietHoaDonNhap.SoLuong);
         db.AddInParameter(dbCommand, "gianhap", DbType.Decimal, objChiTietHoaDonNhap.GiaNhap);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return ID;
     }
     catch
     {
         dbCommand.Connection.Close();
         return -1;
     }
 }
Example #3
0
 public int insertKhachhang(BKIT.Entities.Khachhang objKhachhang)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "INSERT INTO Khachhang(IDKhachhang,Tongdiem,NgayBD,IDLoaiKH,Ngaysinh,SoDT,Diachi,Chucvu,Gioitinh,Ten) " +
         "VALUES (@idkhachhang,@tongdiem,@ngaybd,@idloaikh,@ngaysinh,@sodt,@diachi,@chucvu,@gioitinh,@ten)";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         int ID = GetNextAVailableID();
         objKhachhang.IDKhachhang = ID;
         db.AddInParameter(dbCommand, "idkhachhang", DbType.Int32, objKhachhang.IDKhachhang);
         db.AddInParameter(dbCommand, "tongdiem", DbType.Int32, objKhachhang.Tongdiem);
         db.AddInParameter(dbCommand, "ngaybd", DbType.DateTime, objKhachhang.NgayBD);
         db.AddInParameter(dbCommand, "idloaikh", DbType.Int32, objKhachhang.IDLoaiKH);
         db.AddInParameter(dbCommand, "ngaysinh", DbType.DateTime, objKhachhang.Ngaysinh);
         db.AddInParameter(dbCommand, "sodt", DbType.String, objKhachhang.SoDT);
         db.AddInParameter(dbCommand, "diachi", DbType.String, objKhachhang.Diachi);
         db.AddInParameter(dbCommand, "chucvu", DbType.String, objKhachhang.Chucvu);
         db.AddInParameter(dbCommand, "gioitinh", DbType.String, objKhachhang.Gioitinh);
         db.AddInParameter(dbCommand, "ten", DbType.String, objKhachhang.Ten);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return ID;
     }
     catch
     {
         dbCommand.Connection.Close();
         return -1;
     }
 }
Example #4
0
 public int insertKhuyenmai(BKIT.Entities.Khuyenmai objKhuyenmai)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "INSERT INTO Khuyenmai(IDKhuyenmai,IDNhomSP,NgayBD,NgayKT,Giam,Ghichu) " +
     "VALUES (@idkhuyenmai,@idnhomsp,@ngaybd,@ngaykt,@giam,@ghichu)";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
     int ID = GetNextAVailableID();
     objKhuyenmai.IDKhuyenmai = ID;
     db.AddInParameter(dbCommand, "idkhuyenmai", DbType.Int32, objKhuyenmai.IDKhuyenmai);
     db.AddInParameter(dbCommand, "idnhomsp", DbType.Int32, objKhuyenmai.IDNhomSP);
     db.AddInParameter(dbCommand, "ngaybd", DbType.DateTime, objKhuyenmai.NgayBD);
     db.AddInParameter(dbCommand, "ngaykt", DbType.DateTime, objKhuyenmai.NgayKT);
     db.AddInParameter(dbCommand, "giam", DbType.Int32, objKhuyenmai.Giam);
     db.AddInParameter(dbCommand, "ghichu", DbType.String, objKhuyenmai.Ghichu);
     db.ExecuteNonQuery(dbCommand);
     dbCommand.Connection.Close();
     return ID;
     }
     catch
     {
     dbCommand.Connection.Close();
     return -1;
     }
 }
Example #5
0
 public bool updateKhachhang(BKIT.Entities.Khachhang objKhachhang)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "UPDATE Khachhang SET Tongdiem = @tongdiem, NgayBD = @ngaybd, IDLoaiKH = @idloaikh, Ngaysinh = @ngaysinh, SoDT = @sodt, Diachi = @diachi, Chucvu = @chucvu, Gioitinh = @gioitinh, Ten = @ten " +
             "WHERE IDKhachhang = @idkhachhang";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         db.AddInParameter(dbCommand, "tongdiem", DbType.Int32, objKhachhang.Tongdiem);
         db.AddInParameter(dbCommand, "ngaybd", DbType.DateTime, objKhachhang.NgayBD);
         db.AddInParameter(dbCommand, "idloaikh", DbType.Int32, objKhachhang.IDLoaiKH);
         db.AddInParameter(dbCommand, "ngaysinh", DbType.DateTime, objKhachhang.Ngaysinh);
         db.AddInParameter(dbCommand, "sodt", DbType.String, objKhachhang.SoDT);
         db.AddInParameter(dbCommand, "diachi", DbType.String, objKhachhang.Diachi);
         db.AddInParameter(dbCommand, "chucvu", DbType.String, objKhachhang.Chucvu);
         db.AddInParameter(dbCommand, "gioitinh", DbType.String, objKhachhang.Gioitinh);
         db.AddInParameter(dbCommand, "ten", DbType.String, objKhachhang.Ten);
         db.AddInParameter(dbCommand, "idkhachhang", DbType.Int32, objKhachhang.IDKhachhang);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
 public int insertLoaiphongSPBandau(BKIT.Entities.LoaiphongSPBandau objLoaiphongSPBandau)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "INSERT INTO LoaiphongSPBandau(IDLPSP,IDSanPham,IDLoaiPhong,Soluong,Ghichu) " +
     "VALUES (@idlpsp,@idsanpham,@idloaiphong,@soluong,@ghichu)";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
     int ID = GetNextAVailableID();
     objLoaiphongSPBandau.IDLPSP = ID;
     db.AddInParameter(dbCommand, "idlpsp", DbType.Int32, objLoaiphongSPBandau.IDLPSP);
     db.AddInParameter(dbCommand, "idsanpham", DbType.Int32, objLoaiphongSPBandau.IDSanPham);
     db.AddInParameter(dbCommand, "idloaiphong", DbType.Int32, objLoaiphongSPBandau.IDLoaiPhong);
     db.AddInParameter(dbCommand, "soluong", DbType.Int32, objLoaiphongSPBandau.Soluong);
     db.AddInParameter(dbCommand, "ghichu", DbType.String, objLoaiphongSPBandau.Ghichu);
     db.ExecuteNonQuery(dbCommand);
     dbCommand.Connection.Close();
     return ID;
     }
     catch
     {
     dbCommand.Connection.Close();
     return -1;
     }
 }
Example #7
0
 public int insertSetting(BKIT.Entities.Setting objSetting)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "INSERT INTO Setting(IDSetting,Ngay,TenCT,Phone,Mobile,Diachi,Email,Khuyenmai,Loichao1,Loichao2,TGKetthuc,MayInBep,MayInKho,MayInHoadon) " +
         "VALUES (@idsetting,@ngay,@tenct,@phone,@mobile,@diachi,@email,@khuyenmai,@loichao1,@loichao2,@tgketthuc,@may1,@may2,@may3)";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         int ID = GetNextAVailableID();
         objSetting.IDSetting = ID;
         db.AddInParameter(dbCommand, "idsetting", DbType.Int32, objSetting.IDSetting);
         db.AddInParameter(dbCommand, "ngay", DbType.DateTime, objSetting.Ngay);
         db.AddInParameter(dbCommand, "tenct", DbType.String, objSetting.TenCT);
         db.AddInParameter(dbCommand, "phone", DbType.String, objSetting.Phone);
         db.AddInParameter(dbCommand, "mobile", DbType.String, objSetting.Mobile);
         db.AddInParameter(dbCommand, "diachi", DbType.String, objSetting.Diachi);
         db.AddInParameter(dbCommand, "email", DbType.String, objSetting.Email);
         db.AddInParameter(dbCommand, "khuyenmai", DbType.String, objSetting.Khuyenmai);
         db.AddInParameter(dbCommand, "loichao1", DbType.String, objSetting.Loichao1);
         db.AddInParameter(dbCommand, "loichao2", DbType.String, objSetting.Loichao2);
         db.AddInParameter(dbCommand, "tgketthuc", DbType.Int32, objSetting.TGKetthuc);
         db.AddInParameter(dbCommand, "may1", DbType.String, objSetting.MayInBep);
         db.AddInParameter(dbCommand, "may2", DbType.String, objSetting.MayInKho);
         db.AddInParameter(dbCommand, "may3", DbType.String, objSetting.MayInHoadon);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return ID;
     }
     catch
     {
         dbCommand.Connection.Close();
         return -1;
     }
 }
Example #8
0
 public int insertKhunggio(BKIT.Entities.Khunggio objKhunggio)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "INSERT INTO Khunggio(IDKhunggio,Ten,GioBD,GioKT,Ghichu) " +
         "VALUES (@idkhunggio,@ten,@giobd,@giokt,@ghichu)";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         int ID = GetNextAVailableID();
         objKhunggio.IDKhunggio = ID;
         db.AddInParameter(dbCommand, "idkhunggio", DbType.Int32, objKhunggio.IDKhunggio);
         db.AddInParameter(dbCommand, "ten", DbType.String, objKhunggio.Ten);
         db.AddInParameter(dbCommand, "giobd", DbType.String, objKhunggio.GioBD);
         db.AddInParameter(dbCommand, "giokt", DbType.String, objKhunggio.GioKT);
         db.AddInParameter(dbCommand, "ghichu", DbType.String, objKhunggio.Ghichu);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return ID;
     }
     catch
     {
         dbCommand.Connection.Close();
         return -1;
     }
 }
Example #9
0
 public int insertGiaXuatSP(BKIT.Entities.GiaXuatSP objGiaXuatSP)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "INSERT INTO GiaXuatSP(IDGiaXuatSP,Gia,NgayXuatSP,IDSanPham,Ghichu) " +
         "VALUES (@idgiaxuatsp,@gia,@ngayxuatsp,@idsanpham,@ghichu)";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         int ID = GetNextAVailableID();
         objGiaXuatSP.IDGiaXuatSP = ID;
         db.AddInParameter(dbCommand, "idgiaxuatsp", DbType.Int32, objGiaXuatSP.IDGiaXuatSP);
         db.AddInParameter(dbCommand, "gia", DbType.Decimal, objGiaXuatSP.Gia);
         db.AddInParameter(dbCommand, "ngayxuatsp", DbType.DateTime, objGiaXuatSP.NgayXuatSP);
         db.AddInParameter(dbCommand, "idsanpham", DbType.Int32, objGiaXuatSP.IDSanPham);
         db.AddInParameter(dbCommand, "ghichu", DbType.String, objGiaXuatSP.Ghichu);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return ID;
     }
     catch
     {
         dbCommand.Connection.Close();
         return -1;
     }
 }
 public bool deletePhieuDieuChinhTonKho(BKIT.Entities.PhieuDieuChinhTonKho objPhieuDieuChinhTonKho)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "DELETE FROM PhieuDieuChinhTonKho WHERE ID = @ID";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         db.AddInParameter(dbCommand, "ID", DbType.Int32, objPhieuDieuChinhTonKho.ID);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
 public bool deleteLoaiphongSPBandau(BKIT.Entities.LoaiphongSPBandau objLoaiphongSPBandau)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "DELETE FROM LoaiphongSPBandau WHERE IDLPSP = @idlpsp";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
     db.AddInParameter(dbCommand, "idlpsp", DbType.Int32, objLoaiphongSPBandau.IDLPSP);
     db.ExecuteNonQuery(dbCommand);
     dbCommand.Connection.Close();
     return true;
     }
     catch
     {
     return false;
     }
 }
Example #12
0
 public bool deleteHoaDonNhap(BKIT.Entities.HoaDonNhap objHoaDonNhap)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "DELETE FROM HoaDonNhap WHERE IDHoaDonNhap = @idhoadonnhap";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         db.AddInParameter(dbCommand, "idhoadonnhap", DbType.Int32, objHoaDonNhap.IDHoaDonNhap);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
Example #13
0
 public bool deleteGiaLoaiPhong(BKIT.Entities.GiaLoaiPhong objGiaLoaiPhong)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "DELETE FROM GiaLoaiPhong WHERE IDGiaLoaiPhong = @idgialoaiphong";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         db.AddInParameter(dbCommand, "idgialoaiphong", DbType.Int32, objGiaLoaiPhong.IDGiaLoaiPhong);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
Example #14
0
 public bool deleteChitietHDXuatOfHDXuat(BKIT.Entities.Hoadonxuat objHDXuat)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "DELETE FROM ChitietHDXuat WHERE IDHoadonXuat = @idhdxuat";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         db.AddInParameter(dbCommand, "idhdxuat", DbType.Int32, objHDXuat.IDHoadonXuat);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
Example #15
0
 public bool deleteVanDe(BKIT.Entities.VanDe objVanDe)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "DELETE FROM VanDe WHERE IDVanDe = @idVanDe";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         db.AddInParameter(dbCommand, "idVanDe", DbType.Int32, objVanDe.IDVanDe);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
Example #16
0
 public bool deleteSanPham(BKIT.Entities.SanPham objSanPham)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "DELETE FROM SanPham WHERE IDSanPham = @idsanpham";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         db.AddInParameter(dbCommand, "idsanpham", DbType.Int32, objSanPham.IDSanPham);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
Example #17
0
 public bool deleteNhanvien(BKIT.Entities.Nhanvien objNhanvien)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "DELETE FROM Nhanvien WHERE IDNhanvien = @idnhanvien";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         db.AddInParameter(dbCommand, "idnhanvien", DbType.Int32, objNhanvien.IDNhanvien);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
Example #18
0
 public bool deleteKhunggio(BKIT.Entities.Khunggio objKhunggio)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "DELETE FROM Khunggio WHERE IDKhunggio = @idkhunggio";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         db.AddInParameter(dbCommand, "idkhunggio", DbType.Int32, objKhunggio.IDKhunggio);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
Example #19
0
 public bool updateLoaiNhanvien(BKIT.Entities.LoaiNhanvien objLoaiNhanvien)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "UPDATE LoaiNhanvien SET TenLoaiNV = @tenloainv " +
             "WHERE IDLoaiNhanvien = @idloainhanvien";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         db.AddInParameter(dbCommand, "tenloainv", DbType.String, objLoaiNhanvien.TenLoaiNV);
         db.AddInParameter(dbCommand, "idloainhanvien", DbType.Int32, objLoaiNhanvien.IDLoaiNhanvien);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
Example #20
0
 public int insertLoaiNhanvien(BKIT.Entities.LoaiNhanvien objLoaiNhanvien)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "INSERT INTO LoaiNhanvien(IDLoaiNhanvien,TenLoaiNV) " +
         "VALUES (@idloainhanvien,@tenloainv)";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         int ID = GetNextAVailableID();
         objLoaiNhanvien.IDLoaiNhanvien = ID;
         db.AddInParameter(dbCommand, "idloainhanvien", DbType.Int32, objLoaiNhanvien.IDLoaiNhanvien);
         db.AddInParameter(dbCommand, "tenloainv", DbType.String, objLoaiNhanvien.TenLoaiNV);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return ID;
     }
     catch
     {
         dbCommand.Connection.Close();
         return -1;
     }
 }
Example #21
0
 public int insertNhomSP(BKIT.Entities.NhomSP objNhomSP)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "INSERT INTO NhomSP(IDNhomSP,TenNhomSP,Ghichu) " +
         "VALUES (@idnhomsp,@tennhomsp,@ghichu)";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         int ID = GetNextAVailableID();
         objNhomSP.IDNhomSP = ID;
         db.AddInParameter(dbCommand, "idnhomsp", DbType.Int32, objNhomSP.IDNhomSP);
         db.AddInParameter(dbCommand, "tennhomsp", DbType.String, objNhomSP.TenNhomSP);
         db.AddInParameter(dbCommand, "ghichu", DbType.String, objNhomSP.Ghichu);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return ID;
     }
     catch
     {
         dbCommand.Connection.Close();
         return -1;
     }
 }
Example #22
0
 public int insertHoaDonNhap(BKIT.Entities.HoaDonNhap objHoaDonNhap)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "INSERT INTO HoaDonNhap(IDHoaDonNhap,Ngay,Ghichu,IDNhanvien) " +
         "VALUES (@idhoadonnhap,@ngay,@ghichu,@idnhanvien)";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         int ID = GetNextAVailableID();
         objHoaDonNhap.IDHoaDonNhap = ID;
         db.AddInParameter(dbCommand, "idhoadonnhap", DbType.Int32, objHoaDonNhap.IDHoaDonNhap);
         db.AddInParameter(dbCommand, "ngay", DbType.DateTime, objHoaDonNhap.Ngay);
         db.AddInParameter(dbCommand, "ghichu", DbType.String, objHoaDonNhap.Ghichu);
         db.AddInParameter(dbCommand, "idnhanvien", DbType.Int32, objHoaDonNhap.IDNhanvien);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return ID;
     }
     catch
     {
         dbCommand.Connection.Close();
         return -1;
     }
 }
Example #23
0
        public bool updateChitietHDXuat(BKIT.Entities.ChitietHDXuat objChitietHDXuat)
        {
            Database db = DatabaseFactory.CreateDatabase();
            string sqlCommand = "UPDATE ChitietHDXuat SET IDHoadonXuat = @idhoadonxuat, IDSanpham = @idsanpham, IDGiaxuat = @idgiaxuat, Soluong = @soluong, Giam = @giam, Bep = @bep, Kho = @kho, Ghichu = @ghichu " +
                    "WHERE IDChitietHDXuat = @idchitiethdxuat";
            DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
            try
            {
                db.AddInParameter(dbCommand, "idhoadonxuat", DbType.Int32, objChitietHDXuat.IDHoadonXuat);
                db.AddInParameter(dbCommand, "idsanpham", DbType.Int32, objChitietHDXuat.IDSanpham);
                db.AddInParameter(dbCommand, "idgiaxuat", DbType.Int32, objChitietHDXuat.IDGiaxuat);
                db.AddInParameter(dbCommand, "soluong", DbType.Int32, objChitietHDXuat.Soluong);
                db.AddInParameter(dbCommand, "giam", DbType.Int32, objChitietHDXuat.Giam);
                db.AddInParameter(dbCommand, "bep", DbType.Boolean, objChitietHDXuat.Bep);
                db.AddInParameter(dbCommand, "kho", DbType.Boolean, objChitietHDXuat.Kho);
                db.AddInParameter(dbCommand, "ghichu", DbType.String, objChitietHDXuat.Ghichu);

                db.AddInParameter(dbCommand, "idchitiethdxuat", DbType.Int32, objChitietHDXuat.IDChitietHDXuat);
                db.ExecuteNonQuery(dbCommand);
                dbCommand.Connection.Close();
                return true;
            }
            catch
            {
                return false;
            }
        }
Example #24
0
 public int insertChitietHDXuat(BKIT.Entities.ChitietHDXuat objChitietHDXuat)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "INSERT INTO ChitietHDXuat(IDChitietHDXuat,IDHoadonXuat,IDSanpham,IDGiaxuat,Soluong,Giam,Bep,Kho,Ghichu) " +
         "VALUES (@idchitiethdxuat,@idhoadonxuat,@idsanpham,@idgiaxuat,@soluong,@giam,@bep,@kho,@ghichu)";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         int ID = GetNextAVailableID();
         objChitietHDXuat.IDChitietHDXuat = ID;
         db.AddInParameter(dbCommand, "idchitiethdxuat", DbType.Int32, objChitietHDXuat.IDChitietHDXuat);
         db.AddInParameter(dbCommand, "idhoadonxuat", DbType.Int32, objChitietHDXuat.IDHoadonXuat);
         db.AddInParameter(dbCommand, "idsanpham", DbType.Int32, objChitietHDXuat.IDSanpham);
         db.AddInParameter(dbCommand, "idgiaxuat", DbType.Int32, objChitietHDXuat.IDGiaxuat);
         db.AddInParameter(dbCommand, "soluong", DbType.Int32, objChitietHDXuat.Soluong);
         db.AddInParameter(dbCommand, "giam", DbType.Int32, objChitietHDXuat.Giam);
         db.AddInParameter(dbCommand, "bep", DbType.Boolean, objChitietHDXuat.Bep);
         db.AddInParameter(dbCommand, "kho", DbType.Boolean, objChitietHDXuat.Kho);
         db.AddInParameter(dbCommand, "ghichu", DbType.String, objChitietHDXuat.Ghichu);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return ID;
     }
     catch
     {
         dbCommand.Connection.Close();
         return -1;
     }
 }
Example #25
0
 public bool updateNhanvien(BKIT.Entities.Nhanvien objNhanvien)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "UPDATE Nhanvien SET Ten = @ten, Gioitinh = @gioitinh, Chucvu = @chucvu, Diachi = @diachi, SoDT = @sodt, Ngaysinh = @ngaysinh, Loai = @loai, Username = @username, [Password] = @password " +
             "WHERE IDNhanvien = @idnhanvien";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         db.AddInParameter(dbCommand, "ten", DbType.String, objNhanvien.Ten);
         db.AddInParameter(dbCommand, "gioitinh", DbType.String, objNhanvien.Gioitinh);
         db.AddInParameter(dbCommand, "chucvu", DbType.String, objNhanvien.Chucvu);
         db.AddInParameter(dbCommand, "diachi", DbType.String, objNhanvien.Diachi);
         db.AddInParameter(dbCommand, "sodt", DbType.String, objNhanvien.SoDT);
         db.AddInParameter(dbCommand, "ngaysinh", DbType.DateTime, objNhanvien.Ngaysinh);
         db.AddInParameter(dbCommand, "loai", DbType.String, objNhanvien.Loai);
         db.AddInParameter(dbCommand, "username", DbType.String, objNhanvien.Username);
         db.AddInParameter(dbCommand, "password", DbType.String, objNhanvien.Password);
         db.AddInParameter(dbCommand, "idnhanvien", DbType.Int32, objNhanvien.IDNhanvien);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
Example #26
0
 public int insertNhanvien(BKIT.Entities.Nhanvien objNhanvien)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "INSERT INTO Nhanvien(IDNhanvien,Ten,Gioitinh,Chucvu,Diachi,SoDT,Ngaysinh,Loai,Username,[Password]) " +
         "VALUES (@idnhanvien,@ten,@gioitinh,@chucvu,@diachi,@sodt,@ngaysinh,@loai,@username,@password)";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         int ID = GetNextAVailableID();
         objNhanvien.IDNhanvien = ID;
         db.AddInParameter(dbCommand, "idnhanvien", DbType.Int32, objNhanvien.IDNhanvien);
         db.AddInParameter(dbCommand, "ten", DbType.String, objNhanvien.Ten);
         db.AddInParameter(dbCommand, "gioitinh", DbType.String, objNhanvien.Gioitinh);
         db.AddInParameter(dbCommand, "chucvu", DbType.String, objNhanvien.Chucvu);
         db.AddInParameter(dbCommand, "diachi", DbType.String, objNhanvien.Diachi);
         db.AddInParameter(dbCommand, "sodt", DbType.String, objNhanvien.SoDT);
         db.AddInParameter(dbCommand, "ngaysinh", DbType.DateTime, objNhanvien.Ngaysinh);
         db.AddInParameter(dbCommand, "loai", DbType.String, objNhanvien.Loai);
         db.AddInParameter(dbCommand, "username", DbType.String, objNhanvien.Username);
         db.AddInParameter(dbCommand, "password", DbType.String, objNhanvien.Password);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return ID;
     }
     catch
     {
         dbCommand.Connection.Close();
         return -1;
     }
 }
Example #27
0
        public bool updateSanPham(BKIT.Entities.SanPham objSanPham)
        {
            Database db = DatabaseFactory.CreateDatabase();
            string sqlCommand = "UPDATE SanPham SET TenSanPham = @tensanpham, Tonkho = @tonkho,DVT = @dvt, IDNhomSP = @idnhomsp, Ghichu = @ghichu,Noixuat = @noixuat, SLCanhbao = @slcanhbao, Tukhoa = @tukhoa " +
                    "WHERE IDSanPham = @idsanpham";
            DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
            try
            {
                db.AddInParameter(dbCommand, "tensanpham", DbType.String, objSanPham.TenSanPham);
                db.AddInParameter(dbCommand, "tonkho", DbType.Int32, objSanPham.TonKho);
                db.AddInParameter(dbCommand, "dvt", DbType.String, objSanPham.DVT);

                db.AddInParameter(dbCommand, "idnhomsp", DbType.Int32, objSanPham.IDNhomSP);
                db.AddInParameter(dbCommand, "ghichu", DbType.String, objSanPham.Ghichu);
                db.AddInParameter(dbCommand, "noixuat", DbType.String, objSanPham.Noixuat);
                db.AddInParameter(dbCommand, "slcanhbao", DbType.Int32, objSanPham.SLCanhbao);
                db.AddInParameter(dbCommand, "tukhoa", DbType.String, objSanPham.Tukhoa);
                db.AddInParameter(dbCommand, "idsanpham", DbType.Int32, objSanPham.IDSanPham);

                db.ExecuteNonQuery(dbCommand);
                dbCommand.Connection.Close();
                return true;
            }
            catch
            {
                return false;
            }
        }
Example #28
0
        public int insertSanPham(BKIT.Entities.SanPham objSanPham)
        {
            Database db = DatabaseFactory.CreateDatabase();
            string sqlCommand = "INSERT INTO SanPham(IDSanPham,TenSanPham,DVT,Tonkho,Ghichu,IDNhomSP,Noixuat,SLCanhbao,Tukhoa) " +
                "VALUES (@idsanpham,@tensanpham,@dvt,@tonkho,@ghichu,@idnhomsp,@noixuat,@slcanhbao,@tukhoa)";
            DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
            try
            {
                int ID = GetNextAVailableID();
                objSanPham.IDSanPham = ID;
                db.AddInParameter(dbCommand, "idsanpham", DbType.Int32, objSanPham.IDSanPham);
                db.AddInParameter(dbCommand, "tensanpham", DbType.String, objSanPham.TenSanPham);
                db.AddInParameter(dbCommand, "dvt", DbType.String, objSanPham.DVT);
                db.AddInParameter(dbCommand, "tonkho", DbType.Int32, objSanPham.TonKho);
                db.AddInParameter(dbCommand, "ghichu", DbType.String, objSanPham.Ghichu);
                db.AddInParameter(dbCommand, "idnhomsp", DbType.Int32, objSanPham.IDNhomSP);

                db.AddInParameter(dbCommand, "noixuat", DbType.String, objSanPham.Noixuat);
                db.AddInParameter(dbCommand, "slcanhbao", DbType.Int32, objSanPham.SLCanhbao);
                db.AddInParameter(dbCommand, "tukhoa", DbType.String, objSanPham.Tukhoa);
                db.ExecuteNonQuery(dbCommand);
                dbCommand.Connection.Close();
                return ID;
            }
            catch
            {
                dbCommand.Connection.Close();
                return -1;
            }
        }
Example #29
0
 public bool updateKhunggio(BKIT.Entities.Khunggio objKhunggio)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "UPDATE Khunggio SET Ten = @ten, GioBD = @giobd, GioKT = @giokt, Ghichu = @ghichu " +
             "WHERE IDKhunggio = @idkhunggio";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
         db.AddInParameter(dbCommand, "ten", DbType.String, objKhunggio.Ten);
         db.AddInParameter(dbCommand, "giobd", DbType.String, objKhunggio.GioBD);
         db.AddInParameter(dbCommand, "giokt", DbType.String, objKhunggio.GioKT);
         db.AddInParameter(dbCommand, "ghichu", DbType.String, objKhunggio.Ghichu);
         db.AddInParameter(dbCommand, "idkhunggio", DbType.Int32, objKhunggio.IDKhunggio);
         db.ExecuteNonQuery(dbCommand);
         dbCommand.Connection.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
Example #30
0
 public bool updateKhuyenmai(BKIT.Entities.Khuyenmai objKhuyenmai)
 {
     Database db = DatabaseFactory.CreateDatabase();
     string sqlCommand = "UPDATE Khuyenmai SET IDNhomSP = @idnhomsp, NgayBD = @ngaybd, NgayKT = @ngaykt, Giam = @giam, Ghichu = @ghichu " +
         "WHERE IDKhuyenmai = @idkhuyenmai";
     DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
     try
     {
     db.AddInParameter(dbCommand, "idnhomsp", DbType.Int32, objKhuyenmai.IDNhomSP);
     db.AddInParameter(dbCommand, "ngaybd", DbType.Date, objKhuyenmai.NgayBD.Date);
     db.AddInParameter(dbCommand, "ngaykt", DbType.Date, objKhuyenmai.NgayKT.Date);
     db.AddInParameter(dbCommand, "giam", DbType.Int32, objKhuyenmai.Giam);
     db.AddInParameter(dbCommand, "ghichu", DbType.String, objKhuyenmai.Ghichu);
     db.AddInParameter(dbCommand, "idkhuyenmai", DbType.Int32, objKhuyenmai.IDKhuyenmai);
     db.ExecuteNonQuery(dbCommand);
     dbCommand.Connection.Close();
     return true;
     }
     catch
     {
      return false;
     }
 }