The Duwamish Books Business Logic Layer API Reference

Steve Kirk
Microsoft Development Network

September 1998

This reference documents the methods of the Business Logic Layer (BLL) component of the Duwamish Books, Phase 3 sample application. For an-depth discussion of the design of this component, see "Abstracting Business Transactions."

November 1998 update: This BLL API reference is extended to document C++ signatures, as exposed to a BLL client when it uses the Visual C++ #import directive. These methods are designed to throw a _com_error exception whenever the method return value is VARIANT_FALSE. Note that these signatures incorporate the effects of the "argnames.h" include file, resulting in Visual Basic-friendly parameter names ("Migrating a Visual Basic 5.0 Component to Visual C++ 5.0" explains this symbol renaming technique.)

For additional API detail, the BLL C++ source code header file BusLogic.h documents the purpose, parameters, and assumptions in greater detail

GetAuthors

Description

Retrieves into Authors Recordset the entire Authors domain or a single Author specified by PKId.

Visual Basic signature

Public Function GetAuthors(Authors As ADODB.Recordset, _
                           Optional Byval PKId as Long)

Visual C++ signature

VARIANT_BOOL GetAuthors (
        struct _Recordset * * Authors,
        long PKId );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetCustomers

Description

Retrieves into Customers Recordset the entire Customers domain or a single Customer specified by PKId, or by nickname. The Customers Recordset is expanded according to the value of ExpType.

Visual Basic signature

Public Function GetCustomers(Customers As ADODB.Recordset, _
                        Optional ByVal ExpType As EXPANSION_TYPE, _
                        Optional ByVal PKId as Long, _
                        Optional ByVal Match As String)

Visual C++ signature

VARIANT_BOOL GetCustomers (
        struct _Recordset * * Customers,
        EXPANSION_TYPE ExpType,
        long PKId,
        _bstr_t Match );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetEmployees

Description

Retrieves into Employees Recordset the entire Employees domain or a single Employee specified either by PKId or by Alias and Password.

Visual Basic signature

Public Function GetEmployees(Employees As ADODB.Recordset, _
                              Optional ByVal PKId as Long, _
                              Optional ByVal Alias As String, _
                              Optional ByVal Password As String)

Visual C++ signature

VARIANT_BOOL GetEmployees (
        struct _Recordset * * Employees,
        long PKId,
        _bstr_t Alias,
        _bstr_t Password );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetInventories

Description

Retrieves into Inventories Recordset the entire Inventories domain or one of the following subsets:

Inventories are expanded according to the value of ExpType.

Visual Basic signature

Public Function GetInventories(Inventories As ADODB.Recordset, _
                        Optional ByVal PKId as Long, _
                        Optional ByVal ItemId As Long, _
                        Optional ByVal StoreId As Long, _
                        Optional ByVal ExpType As EXPANSION_TYPE)

Visual C++ signature

VARIANT_BOOL GetInventories (
        struct _Recordset * * Inventories,
        long InventoryId,
        long ItemId,
        long StoreId,
        EXPANSION_TYPE ExpType );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetItems

Description

Retrieves into Items Recordset, in a format specified by ItemTemplateType, the entire Items domain, or a single Item specified by a PKId.

Visual Basic signature

Public Function GetItems(Items As ADODB.Recordset, _
      Optional ByVal PKId as Long, _
      Optional ByVal ItemTemplateType As ITEM_TEMPLATE_TYPE)

Visual C++ signature

VARIANT_BOOL GetItems (
        struct _Recordset * * Items,
        long PKId,
        ITEM_TEMPLATE_TYPE ItemTemplate );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetItemTypes

Description

Retrieves into ItemTypes Recordset the entire ItemTypes domain or a single ItemType specified by PKId.

Visual Basic signature

Public Function GetItemTypes(ItemTypes As ADODB.Recordset, _
                              Byval Optional PKId as Long)

Visual C++ signature

VARIANT_BOOL GetItemTypes (
        struct _Recordset * * ItemTypes,
        long PKId );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetOrders

Description

Retrieves all Orders for an OrderTemplateType, a single Order specified by PKId, or all Orders for a store for an OrderTemplateType.

Visual Basic signature

Public Function GetOrders(Orders As ADODB.Recordset, _
                        OrderTemplateTypeAs ORDER_TEMPLATE_TYPE, _
                        Optional ByVal ExpType As EXPANSION_TYPE, _
                        Optional ByVal PKId as Long, _
                        Optional ByVal StoreId as Long)

Visual C++ signature

VARIANT_BOOL GetOrders (
        struct _Recordset * * Orders,
        ORDER_TEMPLATE_TYPE OrderTemplate,
        EXPANSION_TYPE ExpType,
        long PKId,
        long StoreId );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetOrderStatuses

Description

Retrieves the OrderStatuses domain into a Statuses Recordset.

Visual Basic signature

Public Function GetOrderStatuses(OrderStatuses As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL GetOrderStatuses (
        struct _Recordset * * OrderStatuses );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetOrderTypes

Description

Retrieves the OrderTypes domain into an OrderTypes Recordset.

Visual Basic signature

Public Function GetOrderTypes(OrderTypes As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL GetOrderTypes (
        struct _Recordset * * OrderTypes );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetPublishers

Description

Retrieves into Publishers Recordset the entire Publishers domain or a single Publisher specified by PKId.

Visual Basic signature

Public Function GetPublishers(Publishers As ADODB.Recordset, _
                  Optional ByVal PKId as Long)

Visual C++ signature

VARIANT_BOOL GetPublishers (
        struct _Recordset * * Publishers,
        long PKId );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetSales

Description

Retrieves into Sales Recordset the entire Sales domain, a single Sale specified by a PKId, or Sales for a store specified by StoreId. Expands Sales as specified by ExpType.

Visual Basic signature

Public Function GetSales(Sales As ADODB.Recordset, _
                        Optional ByVal ExpType As EXPANSION_TYPE, _
                        Optional ByVal PKId as Long, _
                        Optional ByVal StoreId As Long)

Visual C++ signature

VARIANT_BOOL GetSales (
        struct _Recordset * * Sales,
        EXPANSION_TYPE ExpType,
        long PKId,
        long StoreId );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetStores

Description

Retrieves into Stores Recordset the entire Stores domain or a single Store specified by PKId.

Visual Basic signature

Public Function GetStores(Stores As ADODB.Recordset, _
                           Optional ByVal PKId as Long)

Visual C++ signature

VARIANT_BOOL GetStores (
        struct _Recordset * * Stores,
        long PKId );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetSuppliers

Description

Retrieves into Suppliers Recordset the entire Suppliers domain or a single Supplier specified by PKId.

Visual Basic signature

Public Function GetSuppliers(Suppliers As ADODB.Recordset, _
                           Optional ByVal PKId as Long)

Visual C++ signature

VARIANT_BOOL GetSuppliers (
        struct _Recordset * * Suppliers,
        long PKId );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

GetTaxRates

Description

Retrieves the entire TaxRates domain or a single TaxRate specified by PKId into TaxRates Recordset.

Visual Basic signature

Public Function GetTaxRates(TaxRates As ADODB.Recordset, _
                           Optional ByVal PKId as Long)

Visual C++ signature

VARIANT_BOOL GetTaxRates (
        struct _Recordset * * TaxRates,
        long PKId );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

InsertAuthor

Description

Inserts an Author into database for current record in Author Recordset. If insert is successful, retrieves Author as returned by GetAuthors.

Visual Basic signature

Public Function InsertAuthor(Author As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL InsertAuthor (
        struct _Recordset * * Author );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

InsertCustomer

Description

Inserts a Customer into database for current record in Customer Recordset. If insert is successful, retrieves Customer as returned by GetCustomers.

Visual Basic signature

Public Function InsertCustomer(Customer As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL InsertCustomer (
        struct _Recordset * * Customer );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

InsertEmployee

Description

Inserts an Employee into database for current record in Employee Recordset. If insert is successful, retrieves Employee as returned by GetEmployees.

Visual Basic signature

Public Function InsertEmployee(Employee As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL InsertEmployee (
        struct _Recordset * * Employee );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

InsertInventory

Description

Inserts an Inventory into database for current record in Inventory Recordset. If insert is successful, retrieves Inventory as returned by GetInventories.

Visual Basic signature

Public Function InsertInventory(Inventory As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL InsertInventory (
        struct _Recordset * * Inventory );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

InsertItem

Description

Inserts an Item into database for current record in Item Recordset. If insert is successful, retrieves Item as returned by GetItems.

Visual Basic signature

Public Function InsertItem(Item As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL InsertItem (
        struct _Recordset * * Item );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

InsertItemType

Description

Inserts an ItemType into database for current record in ItemType Recordset. If insert is successful, retrieves ItemType as returned by GetItemTypes.

Visual Basic signature

Public Function InsertItemType(ItemType As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL InsertItemType (
        struct _Recordset * * ItemType );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

InsertOrder

Description

Inserts an Order into database for current record in Order Recordset. If insert is successful, retrieves Order as returned by GetOrders.

Visual Basic signature

Public Function InsertOrder(Order As ADODB.Recordset) As Boolean

Visual C++ signature

VARIANT_BOOL InsertOrder (
        struct _Recordset * * Order );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

InsertPublisher

Description

Inserts a Publisher into database for current record in Publisher Recordset. If insert is successful, retrieves Publisher as returned by GetPublishers.

Visual Basic signature

Public Function InsertPublisher(Publisher As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL InsertPublisher (
        struct _Recordset * * Publisher );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

InsertSale

Description

Inserts a Sale into database for current record in Sale Recordset. If insert is successful, retrieves Sale as returned by GetSales.

Visual Basic signature

Public Function InsertSale (Sale As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL InsertSale (
        struct _Recordset * * Sale );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

InsertStore

Description

Inserts a Store into database for current record in Store Recordset. If insert is successful, retrieves Store as returned by GetStores.

Visual Basic signature

Public Function InsertStore(Store As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL InsertStore (
        struct _Recordset * * Store );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

InsertSupplier

Description

Inserts a Supplier into database for current record in Supplier Recordset. If insert is successful, retrieves Supplier as returned by GetSuppliers.

Visual Basic signature

Public Function InsertSupplier (Supplier As ADODB.Recordse)

Visual C++ signature

VARIANT_BOOL InsertSupplier (
        struct _Recordset * * Supplier );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

UpdateAuthor

Description

Updates database for current record in Author Recordset. If update is successful, retrieves updated Author as returned by GetAuthors.

Visual Basic signature

Public Function UpdateAuthor(Author As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL UpdateAuthor (
        struct _Recordset * * Author );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

UpdateCustomer

Description

Updates database for current record in Customer Recordset. If update is successful, retrieves updated Customer as returned by GetCustomers.

Visual Basic signature

Public Function UpdateCustomer(Customer As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL UpdateCustomer (
        struct _Recordset * * Customer );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

UpdateEmployee

Description

Updates database for current record in Employee Recordset. If update is successful, retrieves updated Employee as returned by GetEmployees.

Visual Basic signature

Public Function UpdateEmployee(Employee As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL UpdateEmployee (
        struct _Recordset * * Employee );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

UpdateInventory

Description

Updates database for current record in Inventory Recordset. If update is successful, retrieves updated Inventory as returned by GetInventories.

Visual Basic signature

Public Function UpdateInventory(Inventory As ADODB.Recordset, _
                  Byval InventoryUpdateType As INVENTORY_UPDATE_TYPE)

Visual C++ signature

VARIANT_BOOL UpdateInventory (
        struct _Recordset * * Inventory,
        INVENTORY_UPDATE_TYPE UpdateType );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

UpdateItem

Description

Updates database for current record in Item Recordset. If update is successful, retrieves updated Item as returned by GetItems.

Visual Basic signature

Public Function UpdateItem(Item As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL UpdateItem (
        struct _Recordset * * Item );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

UpdateItemType

Description

Updates database for current record in ItemType Recordset. If update is successful, retrieves updated ItemType as returned by GetItemTypes.

Visual Basic signature

Public Function UpdateItemType(ItemType As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL UpdateItemType (
        struct _Recordset * * ItemType );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

UpdateOrder

Description

Updates database according to UpdateType for current record in Order Recordset. If update is successful, retrieves updated Order as returned by GetOrders.

Visual Basic signature

Public Function UpdateOrders(Order As ADODB.Recordset, _
                        Byval OrderUpdateType As ORDER_UPDATE_TYPE, _
                        Byval Optional StatusType As ORDER_STATUS, _
                        Byval Optional EmployeeId As Long)

Visual C++ signature

VARIANT_BOOL UpdateOrder (
        struct _Recordset * * Order,
        ORDER_UPDATE_TYPE UpdateType,
        ORDER_STATUS StatusType,
        long EmployeeId );

Parameters

Order: An ADO Recordset filled with the appropriate data. The Recordset should be one returned by GetOrders.

Return type

Boolean: Returns True if successful, False if not successful.

UpdatePublisher

Description

Updates database for current record in Publisher Recordset. If update is successful, retrieves updated Publisher as returned by GetPublishers.

Visual Basic signature

Public Function UpdatePublisher(Publisher As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL UpdatePublisher (
        struct _Recordset * * Publisher );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

UpdateStore

Description

Updates database for current record in Store Recordset. If update is successful, retrieves updated Store as returned by GetStores.

Visual Basic signature

Public Function UpdateStore(Store As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL UpdateStore (
        struct _Recordset * * Store );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.

UpdateSupplier

Description

Updates database for current record in Supplier Recordset. If update is successful, retrieves updated Supplier as returned by GetSuppliers.

Visual Basic signature

Public Function UpdateSupplier(Supplier As ADODB.Recordset)

Visual C++ signature

VARIANT_BOOL UpdateSupplier (
        struct _Recordset * * Supplier );

Parameters

Return type

Boolean: Returns True if successful, False if not successful.