public bool updateLoaiphongSPBandau(BKIT.Entities.LoaiphongSPBandau objLoaiphongSPBandau)
        {
            Database db         = DatabaseFactory.CreateDatabase();
            string   sqlCommand = "UPDATE LoaiphongSPBandau SET IDSanPham = @idsanpham, IDLoaiPhong = @idloaiphong, Soluong = @soluong, Ghichu = @ghichu " +
                                  "WHERE IDLPSP = @idlpsp";
            DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);

            try
            {
                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.AddInParameter(dbCommand, "idlpsp", DbType.Int32, objLoaiphongSPBandau.IDLPSP);

                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);
            }
        }
        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);
            }
        }