Web Layer
The web layer provides applications for the client.Program. This layer is implemented as a web project in the duwamish. sln solution file. The web layer consists of ASP. NET web forms andCodeHidden file composition. Web forms only use HTML to provide user operations, while code hidden files implement event processing for various controls.
Business appearance Layer
The business appearance layer provides an interface for the web layer to process accounts, category browsing, and book purchases. This layer is implemented as the businessfacade project in the duwamish. sln solution file. The business appearance layer is used as the isolation layer, which isolates the user interface from the implementation of various business functions. Except for low-level systems and support functions, all calls to the database server are performed through this assembly.
Business Rule Layer
The business rule layer is implemented as the businessrules project in the duwamish. sln solution file. It contains the implementation of various business rules and logic. Business Rules complete tasks such as verifying customer accounts and book orders.
Data access layer
The data access layer provides data services for the business rule layer. This layer is implemented as the dataaccess project in the duwamish. sln solution file.
Sample Code:
The following is a sample code for two different processing paths:
Get product catalog
The presentation layer calls the business appearance layer:
Productsystem = new productsystem ();
Categoryset = productsystem. getcategories (categoryid );
The business appearance layer directly calls the data layer:
Public categorydata getcategories (INT categoryid)
{
If (dscommand = NULL)
{
Throw new system. objectdisposedexception (GetType (). fullname );
}
Return fillcategorydata ("getcategories", "@ categoryid", categoryid );
}
Add order
The presentation layer calls the business appearance layer:
Public void addorder ()
{
Applicationassert. checkcondition (cartorderdata! = NULL, "Order requires data", applicationassert. linenumber );
Applicationlog. writetrace ("duwamish7.web. Cart. addorder: \ r \ ncustomerid:" +
Cartorderdata. Tables [orderdata. customer_table]. Rows [0] [orderdata. pkid_field]. tostring ());
Cartorderdata = (New ordersystem (). addorder (cartorderdata );
}
The business appearance layer calls the business rule layer:
Public orderdata addorder (orderdata order)
{
Applicationassert. checkcondition (order! = NULL, "order is required", applicationassert. linenumber );
(New businessrules. Order (). insertorder (order );
Return order;
}
The business rule layer calls the data layer:
Public bool insertorder (orderdata order)
{
// The complex processing logic is omitted here
If (isvalid)
{
Using (dataaccess. Orders ordersdataaccess = new dataaccess. Orders ())
{
Return (ordersdataaccess. insertorderdetail (Order)> 0;
}
}
Else
Return false;
}