1. business logic and system structure 1.1. Business Logic
The business logic of the store system mainly includes the following:
- It is used based on multiple stores.
- Inventory = purchase warehouse receiving-purchase return-Sales retail + sales return
- Gross profit = (retail price-purchase price) * retail quantity
The length is limited. Here I just briefly list the common business logic in convenience store management. The details of the complexity are not here.
1.2. System Structure
In this case, the store system adopts a domain-driven design, which consists of four layers: presentation layer, application service layer, domain layer, and infrastructure layer.
The presentation layer consists of Windows Forms and hidden code files. Windows forms only provide user operations and interface layout, while code hidden files enable event handling of various controls.
The application service layer is a WCF Service, mainly to provide external APIs so that external systems can interact and expand with the system through the provided APIs.
The domain layer mainly defines the entity attributes of the business domain;
The infrastructure layer provides specific implementation of repository and ORM for the entire application.
The entire system architecture can be described as follows:
It should be noted that the presentation layer (winapp) in is dependent on the repository interface and domain model ). Repository depends on the domain model and repository interfaces. The store system uses dependency injection to inject the repository (repository) into the presentation layer (winapp). Therefore, the presentation layer (winapp) does not depend on the specific implementation method of the repository.
Visual Studio 2008Solution Structure
The store system has six projects under the Microsoft Visual Studio 2008 solution: cntosoft. winapp. store, cntosoft. domain. store, cntosoft. services. store, cntosoft. repositories. store, cntosoft. repositories. store. test and cntosoft. library. As follows:
- Cntosoft. winapp. Store: Provides user interfaces and interactive interfaces.
- Cntosoft. domain. Store: The domain model project, including the domain model and some business logic of the store system, is also the core of this case.
- Cntosoft. Services. Store: temporarily available.
- Cntosoft. repositories. Store: The specific implementation project of warehousing. This project only includes the warehousing implementation for nhibernat.