Introduction
In the previous article, we talked about how to configure the solution generated in "agileeas. NET platform development instance-pharmacy system-Prepare the development environment (I. This article will introduce the following content: how to solve the problem based on the existing
To build a testable running environment, and create a simple example to illustrate how to develop a new function module.
1. Add the UI Layer
2. Add the "BLL" layer class library
After adding it, we can proceed with the relevant subsequent work.
Outline
1. Create a bll-layer business logic Service
2. Create a UI Layer Module
3. Configure the test environment.
4. Run the test module.
Create a service in the business logic layer
We have added the UI and BLL layer projects above. Let's take a look at how to attribute the business logic layer. First, this layer can be integrated with the common service layer. How can this be understood? Next let's talk about
Ming Xia:
1. Write common or distributed business logic in the following format. Otherwise, if you want to perform distributed migration, the configuration file cannot be used for seamless switching.
A. Do not use the common business logic layer of the agileeas. NET platform:
Here we add a class "drug Dictionary" entity. This business logic returns all rows, which we may write in the usual way.
Is to use the anemia model, in the business logic layer to process the real business logic of the entity, and then the service layer to complete the object data persistence.
B. Use the business logic layer of agileeas. net.
First, add the followingProgramSet Reference.
Next, we will create a service to query the drug dictionary:
Basic Data Access Component
Build your own business logic services based on basic business logic service components:
Again, we have completed the query service for Entity Data. Other related methods are similar, such as processing complex business logic and transactions at the business logic layer. In the module code
Specific case writing.
Finally, after writing the basic service layer logic, let's take a look at how to write a module, which can also be understood as a plug-in. This module is used to access data in an object.
Create a UI Module
The content of the service layer (business logic layer) is provided above. Of course, we do not specifically split the service logic layer from the service layer, for example, separating the service layer separately, or separate the business logic layer
Strictly divide. The business logic layer here can be understood as the service layer for distributed access. Of course, if split, we can write the business logic layer, provide the service layer above the business logic layer, and then the service layer is
Real distributed service.
Next we will build a new module
1. Add related Assembly references:
2. Create a "drug Dictionary" maintenance page
3. Add a user control:
4. After adding the user control, open the interface designer and drag a toolbar control.
5. Drag a toolstrip to the control, and then drag a dview control to display the related "drug Dictionary" information.
6. The interface after adding several buttons is as follows:
7. Select a data source and click the drop-down box:
8. Select Add Project Data source:
9. Based on the selected object, load the attribute columns in the object:
10. We chose drugdict as our data source object:
11. Check the object and click "finish":
12. Set the button on the right of the datagridview control:
13. Click Edit to set the description for each column:
14. The final result is as follows:
Now that the interface has been designed, we will start coding.
1. The following functions may be used on all common pages:
A. Print.
B. Focus control.
C. System Time.
D. Other public parts.
So how do we implement these functions? You may have thought about how to use a base class to promote the functions required by each subclass to a common parent class. This is also a lot of refactoringCodeOne of the skills in.
The following defines a user control base class "baseusercontrol ":
The specific code is as follows:
Report related:
Print form:
For more information about other code in the base class, seeSource code.
2. module definition and tag information related to the Writing module:
3. Functions of modulestart:
4. Through the above mark, our module has been able to identify this module on the Resource Manager platform. For specific business methods and usage, we will continue to explain and explain in the subsequent modules.
Build a test environment.
Summary
This article describes how to design the BLL layer and UI Layer modules. In the next article, we will explain how to build the test environment, in addition, we can display the data of our drug dictionary, and we will continue
Complete the add, edit, and delete functions. Quickly develop function modules in a short time.
Pharmacy system source code
More communication
Official blog: http://www.smarteas.net/
Http://www.agilelab.cn/
if you have any questions about using the agileeas. NET development platform, use the following contact methods or communication methods.
1. Telephone-Email:
He gozhou: hegezhou_hot@163.com Mobile: 18691480181 blog: http://www.cnblogs.com/hegezhou_hot/
2. QQ chat group:
308961614 Network Name: h.o. T