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
Retrieves into Authors Recordset the entire Authors domain or a single Author specified by PKId.
Public Function GetAuthors(Authors As ADODB.Recordset, _
Optional Byval PKId as Long)
VARIANT_BOOL GetAuthors (
struct _Recordset * * Authors,
long PKId );
The following columns are returned: PKId, LastName, and FirstName.
Boolean: Returns True if successful, False if not successful.
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.
Public Function GetCustomers(Customers As ADODB.Recordset, _
Optional ByVal ExpType As EXPANSION_TYPE, _
Optional ByVal PKId as Long, _
Optional ByVal Match As String)
VARIANT_BOOL GetCustomers (
struct _Recordset * * Customers,
EXPANSION_TYPE ExpType,
long PKId,
_bstr_t Match );
Boolean: Returns True if successful, False if not successful.
Retrieves into Employees Recordset the entire Employees domain or a single Employee specified either by PKId or by Alias and Password.
Public Function GetEmployees(Employees As ADODB.Recordset, _
Optional ByVal PKId as Long, _
Optional ByVal Alias As String, _
Optional ByVal Password As String)
VARIANT_BOOL GetEmployees (
struct _Recordset * * Employees,
long PKId,
_bstr_t Alias,
_bstr_t Password );
The following columns are returned: PKId, Alias, LastName, FirstName, MI, SSN, Address1, Address2, City, State, ZipCode, HomePhone, CellPhone, EmergencyContact, EmergencyPhone, HireDate, Password, and Admin.
Boolean: Returns True if successful, False if not successful.
Retrieves into Inventories Recordset the entire Inventories domain or one of the following subsets:
Inventories are expanded according to the value of ExpType.
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)
VARIANT_BOOL GetInventories (
struct _Recordset * * Inventories,
long InventoryId,
long ItemId,
long StoreId,
EXPANSION_TYPE ExpType );
Boolean: Returns True if successful, False if not successful.
Retrieves into Items Recordset, in a format specified by ItemTemplateType, the entire Items domain, or a single Item specified by a PKId.
Public Function GetItems(Items As ADODB.Recordset, _
Optional ByVal PKId as Long, _
Optional ByVal ItemTemplateType As ITEM_TEMPLATE_TYPE)
VARIANT_BOOL GetItems (
struct _Recordset * * Items,
long PKId,
ITEM_TEMPLATE_TYPE ItemTemplate );
Boolean: Returns True if successful, False if not successful.
Retrieves into ItemTypes Recordset the entire ItemTypes domain or a single ItemType specified by PKId.
Public Function GetItemTypes(ItemTypes As ADODB.Recordset, _
Byval Optional PKId as Long)
VARIANT_BOOL GetItemTypes (
struct _Recordset * * ItemTypes,
long PKId );
The following columns are returned: PKId, Code, Description, and IsBook.
Boolean: Returns True if successful, False if not successful.
Retrieves all Orders for an OrderTemplateType, a single Order specified by PKId, or all Orders for a store for an OrderTemplateType.
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)
VARIANT_BOOL GetOrders (
struct _Recordset * * Orders,
ORDER_TEMPLATE_TYPE OrderTemplate,
EXPANSION_TYPE ExpType,
long PKId,
long StoreId );
Header fields: PKId, CustomerId, EmployeeId, OtherStoreId, StoreId, SupplierId, OrderType, OrderStatus, OrderDate, PickupDate, SubTotal, ShippingHandling, Tax, Total, ShipToName, ShipToAddress1, ShipToAddress2, ShipToCity, ShipToState, ShipToZipCode, ShipToPhone, and Details.
Detail fields: PKId, OrderId, ItemId, Qty_Ordered, Qty_Received, and Notes.
Header fields: PKId, CustomerId, EmployeeId, OtherStoreId, StoreId, SupplierId, OrderType, OrderStatus, OrderDate, PickupDate, SubTotal, ShippingHandling, Tax, Total, ShipToName, ShipToAddress1, ShipToAddress2, ShipToCity, ShipToState, ShipToZipCode, ShipToPhone, and Details.
Detail fields: PKId, OrderId, ItemId, UnitPrice, Quantity, Qty_Shipped, and Notes.
Header fields: PKId, EmployeeId, OtherStoreId, StoreId, SupplierId, OrderStatus, OrderDate, SubTotal, and Details.
Detail fields: PKId, OrderId, ItemId, Qty_Ordered, Qty_Received, Notes, Qty_This_Trans, and Note_This_Trans.
Header fields: PKId, CustomerId, EmployeeId, OtherStoreId, StoreId, SupplierId, OrderType, OrderStatus, OrderDate, PickupDate, SubTotal, ShippingHandling, Tax, Total, ShipToName, ShipToAddress1, ShipToAddress2, ShipToCity, ShipToState, ShipToZipCode, ShipToPhone, and Details.
Detail fields: PKId, OrderId, ItemId, UnitPrice, Qty_Ordered, Qty_Shipped, Notes, Qty_This_Trans, and Note_This_Trans.
Boolean: Returns True if successful, False if not successful.
Retrieves the OrderStatuses domain into a Statuses Recordset.
Public Function GetOrderStatuses(OrderStatuses As ADODB.Recordset)
VARIANT_BOOL GetOrderStatuses (
struct _Recordset * * OrderStatuses );
The following columns are returned: PKId, Code, and Description.
Boolean: Returns True if successful, False if not successful.
Retrieves the OrderTypes domain into an OrderTypes Recordset.
Public Function GetOrderTypes(OrderTypes As ADODB.Recordset)
VARIANT_BOOL GetOrderTypes (
struct _Recordset * * OrderTypes );
The following columns are returned: PKId, Code, Description, and IsSale.
Boolean: Returns True if successful, False if not successful.
Retrieves into Publishers Recordset the entire Publishers domain or a single Publisher specified by PKId.
Public Function GetPublishers(Publishers As ADODB.Recordset, _
Optional ByVal PKId as Long)
VARIANT_BOOL GetPublishers (
struct _Recordset * * Publishers,
long PKId );
The following columns are returned: PKId, Name, Address1, Address2, City, State, ZipCode, ContactPerson,and PhoneNumber.
Boolean: Returns True if successful, False if not successful.
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.
Public Function GetSales(Sales As ADODB.Recordset, _
Optional ByVal ExpType As EXPANSION_TYPE, _
Optional ByVal PKId as Long, _
Optional ByVal StoreId As Long)
VARIANT_BOOL GetSales (
struct _Recordset * * Sales,
EXPANSION_TYPE ExpType,
long PKId,
long StoreId );
The following columns are returned: PKId, SaleId, ItemId, UnitPrice, and Quantity
Boolean: Returns True if successful, False if not successful.
Retrieves into Stores Recordset the entire Stores domain or a single Store specified by PKId.
Public Function GetStores(Stores As ADODB.Recordset, _
Optional ByVal PKId as Long)
VARIANT_BOOL GetStores (
struct _Recordset * * Stores,
long PKId );
The following columns are returned: PKId, Code, Name, Address1, Address2, City, State, ZipCode, Phone, Fax.
Boolean: Returns True if successful, False if not successful.
Retrieves into Suppliers Recordset the entire Suppliers domain or a single Supplier specified by PKId.
Public Function GetSuppliers(Suppliers As ADODB.Recordset, _
Optional ByVal PKId as Long)
VARIANT_BOOL GetSuppliers (
struct _Recordset * * Suppliers,
long PKId );
The following columns are returned: PKId, Name, Address1, Address2, City, State, ZipCode, ContactPerson, and PhoneNumber.
Boolean: Returns True if successful, False if not successful.
Retrieves the entire TaxRates domain or a single TaxRate specified by PKId into TaxRates Recordset.
Public Function GetTaxRates(TaxRates As ADODB.Recordset, _
Optional ByVal PKId as Long)
VARIANT_BOOL GetTaxRates (
struct _Recordset * * TaxRates,
long PKId );
The following columns are returned: PKId, Description, and TaxRate.
Boolean: Returns True if successful, False if not successful.
Inserts an Author into database for current record in Author Recordset. If insert is successful, retrieves Author as returned by GetAuthors.
Public Function InsertAuthor(Author As ADODB.Recordset)
VARIANT_BOOL InsertAuthor (
struct _Recordset * * Author );
Boolean: Returns True if successful, False if not successful.
Inserts a Customer into database for current record in Customer Recordset. If insert is successful, retrieves Customer as returned by GetCustomers.
Public Function InsertCustomer(Customer As ADODB.Recordset)
VARIANT_BOOL InsertCustomer (
struct _Recordset * * Customer );
Boolean: Returns True if successful, False if not successful.
Inserts an Employee into database for current record in Employee Recordset. If insert is successful, retrieves Employee as returned by GetEmployees.
Public Function InsertEmployee(Employee As ADODB.Recordset)
VARIANT_BOOL InsertEmployee (
struct _Recordset * * Employee );
Boolean: Returns True if successful, False if not successful.
Inserts an Inventory into database for current record in Inventory Recordset. If insert is successful, retrieves Inventory as returned by GetInventories.
Public Function InsertInventory(Inventory As ADODB.Recordset)
VARIANT_BOOL InsertInventory (
struct _Recordset * * Inventory );
Boolean: Returns True if successful, False if not successful.
Inserts an Item into database for current record in Item Recordset. If insert is successful, retrieves Item as returned by GetItems.
Public Function InsertItem(Item As ADODB.Recordset)
VARIANT_BOOL InsertItem (
struct _Recordset * * Item );
Boolean: Returns True if successful, False if not successful.
Inserts an ItemType into database for current record in ItemType Recordset. If insert is successful, retrieves ItemType as returned by GetItemTypes.
Public Function InsertItemType(ItemType As ADODB.Recordset)
VARIANT_BOOL InsertItemType (
struct _Recordset * * ItemType );
Boolean: Returns True if successful, False if not successful.
Inserts an Order into database for current record in Order Recordset. If insert is successful, retrieves Order as returned by GetOrders.
Public Function InsertOrder(Order As ADODB.Recordset) As Boolean
VARIANT_BOOL InsertOrder (
struct _Recordset * * Order );
Boolean: Returns True if successful, False if not successful.
Inserts a Publisher into database for current record in Publisher Recordset. If insert is successful, retrieves Publisher as returned by GetPublishers.
Public Function InsertPublisher(Publisher As ADODB.Recordset)
VARIANT_BOOL InsertPublisher (
struct _Recordset * * Publisher );
Boolean: Returns True if successful, False if not successful.
Inserts a Sale into database for current record in Sale Recordset. If insert is successful, retrieves Sale as returned by GetSales.
Public Function InsertSale (Sale As ADODB.Recordset)
VARIANT_BOOL InsertSale (
struct _Recordset * * Sale );
Boolean: Returns True if successful, False if not successful.
Inserts a Store into database for current record in Store Recordset. If insert is successful, retrieves Store as returned by GetStores.
Public Function InsertStore(Store As ADODB.Recordset)
VARIANT_BOOL InsertStore (
struct _Recordset * * Store );
Boolean: Returns True if successful, False if not successful.
Inserts a Supplier into database for current record in Supplier Recordset. If insert is successful, retrieves Supplier as returned by GetSuppliers.
Public Function InsertSupplier (Supplier As ADODB.Recordse)
VARIANT_BOOL InsertSupplier (
struct _Recordset * * Supplier );
Boolean: Returns True if successful, False if not successful.
Updates database for current record in Author Recordset. If update is successful, retrieves updated Author as returned by GetAuthors.
Public Function UpdateAuthor(Author As ADODB.Recordset)
VARIANT_BOOL UpdateAuthor (
struct _Recordset * * Author );
Boolean: Returns True if successful, False if not successful.
Updates database for current record in Customer Recordset. If update is successful, retrieves updated Customer as returned by GetCustomers.
Public Function UpdateCustomer(Customer As ADODB.Recordset)
VARIANT_BOOL UpdateCustomer (
struct _Recordset * * Customer );
Boolean: Returns True if successful, False if not successful.
Updates database for current record in Employee Recordset. If update is successful, retrieves updated Employee as returned by GetEmployees.
Public Function UpdateEmployee(Employee As ADODB.Recordset)
VARIANT_BOOL UpdateEmployee (
struct _Recordset * * Employee );
Boolean: Returns True if successful, False if not successful.
Updates database for current record in Inventory Recordset. If update is successful, retrieves updated Inventory as returned by GetInventories.
Public Function UpdateInventory(Inventory As ADODB.Recordset, _
Byval InventoryUpdateType As INVENTORY_UPDATE_TYPE)
VARIANT_BOOL UpdateInventory (
struct _Recordset * * Inventory,
INVENTORY_UPDATE_TYPE UpdateType );
Boolean: Returns True if successful, False if not successful.
Updates database for current record in Item Recordset. If update is successful, retrieves updated Item as returned by GetItems.
Public Function UpdateItem(Item As ADODB.Recordset)
VARIANT_BOOL UpdateItem (
struct _Recordset * * Item );
Boolean: Returns True if successful, False if not successful.
Updates database for current record in ItemType Recordset. If update is successful, retrieves updated ItemType as returned by GetItemTypes.
Public Function UpdateItemType(ItemType As ADODB.Recordset)
VARIANT_BOOL UpdateItemType (
struct _Recordset * * ItemType );
Boolean: Returns True if successful, False if not successful.
Updates database according to UpdateType for current record in Order Recordset. If update is successful, retrieves updated Order as returned by GetOrders.
Public Function UpdateOrders(Order As ADODB.Recordset, _
Byval OrderUpdateType As ORDER_UPDATE_TYPE, _
Byval Optional StatusType As ORDER_STATUS, _
Byval Optional EmployeeId As Long)
VARIANT_BOOL UpdateOrder (
struct _Recordset * * Order,
ORDER_UPDATE_TYPE UpdateType,
ORDER_STATUS StatusType,
long EmployeeId );
Order: An ADO Recordset filled with the appropriate data. The Recordset should be one returned by GetOrders.
Boolean: Returns True if successful, False if not successful.
Updates database for current record in Publisher Recordset. If update is successful, retrieves updated Publisher as returned by GetPublishers.
Public Function UpdatePublisher(Publisher As ADODB.Recordset)
VARIANT_BOOL UpdatePublisher (
struct _Recordset * * Publisher );
Boolean: Returns True if successful, False if not successful.
Updates database for current record in Store Recordset. If update is successful, retrieves updated Store as returned by GetStores.
Public Function UpdateStore(Store As ADODB.Recordset)
VARIANT_BOOL UpdateStore (
struct _Recordset * * Store );
Boolean: Returns True if successful, False if not successful.
Updates database for current record in Supplier Recordset. If update is successful, retrieves updated Supplier as returned by GetSuppliers.
Public Function UpdateSupplier(Supplier As ADODB.Recordset)
VARIANT_BOOL UpdateSupplier (
struct _Recordset * * Supplier );
Boolean: Returns True if successful, False if not successful.