Technical Specifications for Tissue System under .NET (2)

zhaozj2021-02-16  49

Fives. Project hierarchical definition and coding specifications

1. Data entity layer definition and coding specifications

This layer mainly defines the XML architecture (XSD) of type data sets. It is the memory representation of the database, and the establishment of architectural postcodes are automatically generated by the system.

1) Add a data set: Add à Add a new item à data set;

2) Define the data sheet architecture:

(1) Single form: From the Server Explorer, drag the single table to the design interface, the system will automatically generate the table structure;

(2) Multi-table form:

Method 1. Generate multiple tables in the above method, then manually add an intervalcular association (if any);

Method 2. Generate a basic table according to the above method, then manually add other related fields, form a table;

And his XML format is this:

XML Version = "1.0" encoding = "UTF-8"?>

AttributeformDefault = "qualified" xmlns = "http://tempuri.org/addressData.xsd" xmlns: mstns = "http://tempuri.org/addressData.xsd"

XMLns: xs = "http://www.w3.org/2001/xmlschema" XMLns: msdata = "URN: Schemas-Microsoft-COM: XML-MSDATA">

TYPE = "xs: string" minoccurs = "0" />

XS: Sequence>

XS: ComplexType>

XS: Element>

......

2. Definition and coding specifications for SQL layers

This layer defines the SQL statement used to interact with the database.

This layer is responsible for generating a SQL statement for operating a database. Depending on the data entity layer to be operated, the method to be implemented separately, in this item group, we generally only need to define the SQL statement you want to select the query.

The work made here is all SQL statements that assembles a function of the required function. Such as:

Public static string strgetlogonlog = "Select logonlog. * from logonlog";

Public static string getlogonlogbyusername (String Username)

{

Return strgetlogonlog

"Where (username = n '" usrname ")";

}

3. Data Access Layer Definition and Code Specification

This layer is responsible for operating the database.

This layer is responsible for performing various operations on the database. The method to be implemented according to the data entity layer to be operated, in this system, generally include methods of reading data and how to update data back to the database.

On this layer, the data will possibly there are two flows: if this module has a business rule, the data will flow to the business rule layer; if this module does not have a business rule, the data will flow to the business interface layer.

The code example is, for example,:

Public Menudata getMenu ()

{

Menudata ds = new menudata ();

DatabaseExecute Dbexec = New DatabaseExecute ();

Dbexec.getdata (DS.MENU, MENUSQL.STRGETMENU);

Return DS;

}

Public void UpdateMenu (Menudata DS)

{

DataTableExtend DT = New DataTableExtend (DS.MENU, "MENU");

DatabaseExecute Dbexec = New DatabaseExecute ();

Dbexec.ModifyDatabase (DT);

}

4. Definition and coding specifications for business rules

The business rules is responsible for achieving business logic, and there will be different implementations according to different business logic requirements.

The code development specification of the business rules layer is no longer described, and only the following points should be noted:

1) All business rules are implemented at this layer.

2) The calculation formula that is worth the field value for the calculating field to distinguish the field.

3) The interface should be as clear as possible.

For example, as follows:

Public Static ContractPaidListData CalculateFirstPAID (String ContractGUID)

{

Contracts contracts = new contracts ();

ContractData.Contractrow Contract = Contracts.getContractByguid1 (ContractGUID) .Contract [0]; ContractChargeDetAildata ContractchargeDetAildTaildata ();

Contractchargedetails ContractchargeDetails = New ContractchargeDetails ();

ContractchargeDetails = ContractchargeDetails.getContractchargeDetailbyContractGuidAndonefee (ContractGUID);

Foreach (ContractCharGedetAildata.ContractchargeDetailrow Contractcharge in contractchargedetail ).ContractchargeDetail)

{

Decimal price;

INT AMOUNT = 1;

IF (! Contractcharge.isRealPricenull ())

{

Price = contractcharge.realprice * amount;

}

Else if (! contractcharge.isdiscountnull ())

{

Price = contractcharge.standardprice * contractcharge.discount / 100 * amount;

}

Else

{

Price = contractcharge.standardprice * amount;

}

ContractPAIDListData ContractPAIDLS = New ContractPAIDListData ();

......

5. Definition and coding specifications for business interface layers

This layer provides an interface between the interface and the intermediate layer.

Under this layer, the data will possibly two flows: If this module has a business rule, the data will flow to the business rule layer; if this module does not have a business rule, the data will flow to the business interface layer.

This layer is responsible for providing a data interface for the interface layer. According to the method of the interface function to be provided, the method to be implemented, including, INSERTXXX (Dataset), Updatexxx (Data Set), DELETEXXX (Dataset), LOADXXX () (for returning a data set), LOADXXXBYXX (Field 1, Field 2 ...) (for returning a data set according to a field or multiple fields).

This layer is very small, just a definition of interface and delivery of data. If this module has a business rule, first instantiate the corresponding class in the business rule layer and call it to the corresponding method; if this module does not have a business rule, first instantiate an entity to access the layer corresponding to the class and call it. method.

Examples are as follows:

Public SqlDataAdapter getCountry ()

{

Try

{

Countrys countrys = new countrys ();

SqlDataAdapter M_SQL = countrys.getcountry ();

Return M_SQL;

}

Catch (Exception E)

{

Throw e;

}

}

6. Definition and coding specifications of interface layers

The interface layer provides a user interface and handles user operations.

This layer should be separated from the background, that is, the role of interface code should be mainly to process user operations rather than business logic. Its purpose is to make future convenient replacement interfaces or even change the platform, such as turning from C / S to B / S or wants to be reversed.

It works on this is the synchronization of the interface and the data entity, such as displaying data on the interface or synchronizing the interface data to the data entity: public void initcontrol ()

{

Try

{

IF (getRequest () == NULL)

{

Title.Text = "Add:";

THIS.SETTEXTNULL ();

Btndel.visible = false;

}

Else

{

Title.Text = "Modify, Delete:";

Btnsubmit.Value = "OK";

btnreset.visible = false;

CityData cityds = new citydata ();

CITYF.GETCITIESBYGUID (GetRequest ()). Fill (Cityds.cities);

CityData.city city = cityds.cities [0];

TXTCITYNAME.TEXT = city.cityname;

......

Private void btnsubmit_serverclick (Object Sender, System.EventArgs E)

{

Try

{

IF (! page.issalid)

{

THIS.VALIDATEMESSAGE ();

}

Else

{

IF (getRequest () == NULL)

{

CityData cityds = new citydata ();

CityData.city city = cityds.cities.newcity ();

City.guid = guidgenerator.getnewguid ();

City.cityname = txtcityname.text.trim ();

......

six. Interface of the exposed projects

1. SQL layer interface

The exposed interface is mainly a variety of operation SQL statements provided for the data access layer, such as queries, new, modified, deleted SQL, and more.

For parameters in the incoming method, the GET method is incoming one or several parameters that need to be used, the string value, INSERT, UPDATE, and DELETE methods are not passed to any parameters; and for return values, all methods are all returned A string.

E.g:

Public static system.string deletecity ()

Public static system.string getcities ()

Public static system.string getcitiesByabbr (System.String CityName)

Public static system.string insertcity ()

Public static system.string updateCity ()

However, in this project group, only write a GET method.

2. Data Access Layer interface

This layer of exposure is to make up calls to do various operations for the database.

For the LOAD method, first get the database connection and open, then use the method defined in the SQL definition layer and the just database connection to instantiate a SQLDataAdapter and return it as the return value. The data connection is turned off before returning;

For Update methods, first get the database connection and open, and then operate the data in the type data set. In operation, use the method defined in the SQL definition layer and the just database connection to instantiate a SQLCommand, and then assign the corresponding data value to the parameter and execute SQLCommand. The Boolean value is returned if the operation is completed. The data connection is turned off before returning. E.g:

Public static system.data.sqlclient.sqldataAdapter getcities ()

Public static system.data.sqlclient.sqldataAdapter getcitiesByabbr (System.String CityName)

Public Static System.Boolean Updatecities (CapitalNet_Mis.common.EntityDefinitions.cityData CityDs)

3. Business rule layer interface

The interface of the business rules layer does not have a unified specification, depending on the actual needs.

E.g:

public static Capitalnet_MIS.Common.EntityDefinitions.ContractPaidListData CalculateContractAmount (System.DateTime date1, System.DateTime date2, System.Decimal total, System.Decimal paidTotal, System.Decimal unPaidTotal)

Public Static CapitalNet_Mis.comMon.EntityDefinitions.ContractPaidListData CalculateFirstPaId (System.String ContractGUID)

4. Interface of the business interface

The interface of this layer is critical because this layer is a connection interface layer and an intermediate layer.

For parameters in the incoming method, the GET method is incorporated into one or several parameters that need to be used, the string value, the UPDATE method is passed into a strong type of data set; for the return value, the Load method returns a type The data set, the UPDATE method returns a Boolean value.

E.g:

Public static system.data.sqlclient.sqldataAdapter getcities ()

Public static system.data.sqlclient.sqldataAdapter getcitiesByabbr (System.String CityName)

Public Static System.Boolean Updatecities (CapitalNet_Mis.common.EntityDefinitions.cityData CityDs)

Seven. Interface logic

The interface logic is shown below:

转载请注明原文地址:https://www.9cbs.com/read-24279.html

New Post(0)