Fast Development of Information System (3) Extraction of Data Information

xiaoxiao2021-03-06  104

In order to maintain the entire system has sufficient expansion and sufficient elasticity (can meet the use of use in the disaster WebForm and WinForm, and other database updates, such as InfoPath, and WebService, etc. in Office 2003), I will remove the entire DBFORM architecture Divided into the FormInfo class and SQLBuilder two base classes, the role of the FormInfo class and the SQLBuilder class, below, respectively.

Forminfo is mainly responsible for the capture of the Field information of the entire database, mainly including the following two methods:

/// Add the container that will be traversed,

Public Virtual Void Appendcontainer (Object ACONTAINER)

// / Add a single control

Public Virtual Void AppendControl (Object Acontrol)

/// Clear the previously configured FORM information

Public void clearforminfo ()

It mainly provides two virtual methods, an open ClearForminfo method, from the meaning of the method name, everyone can be seen clearly, the entire FormInfo can be added according to the container and separate controls, here, I need to explain my dbform The architecture is for Winform and WebForm extensions, because the following WinFormInfo classes and WebFormInfo classes are inherited from FormInfo, implementing WinForm and WebForm information extraction.

In WinformInfo and WebFormInfo, it is mainly a loop for Container and implements the AppendContainer.

/// Add a container that will be traversed

Public override void appendcontainer (Object Acontainer)

{

System.Web.ui.Control Container = (System.Web.ui.Control) acontainer;

Foreach (Control Acontrol in Container.Controls)

{

This.doappendControl (Acontrol);

}

}

In the WebQueryform and WebModifyForm below, it is extracted by the specific FORM information. Why do you use so many kinds of inheritance? I think this kind of line of sight is mainly the following benefits.

1. The FormInfo class mainly provides the most open interface, as well as some basic methods (provide a protected method for filling the analysis into the FormInfoentity (description class)

2. WinformInfo and WebFormInfo classes are mainly converting container Object to specific WinContrl and webcontrol, and calls the corresponding control information parser to implement data extraction.

3. The next MODIFORMINFO and QueryForminfo are mainly implemented by the control information parser. According to the specific controls and specific tasks (Modify or query), the information is parsed separately, such as the information that needs to be added in QueryFormInfo. (Like, =, etc.)

Below is the addition of specific controls

Private void doappendControl (System.Web.ui.Control Acontrol)

{

IF (Acontrol Is Smisnet.WebControl.Smisdropdown)

{

This.doAppendDropdownList (acontrol as smisnet.WebControl.smisdropdown);

Else IF (Acontrol Is System.Web.ui.WebControls.TextBox)

{

This.doAppendTextBox (Acontrol as smisnet.WebControl.smitbox);

}

Else IF (Acontrol Is System.Web.ui.WebControls.Listbox)

{

This.doappendListBox (System.Web.ui.WebControls.listbox);

}

}

In fact, this part of the code is not as beautiful, including DOAPPENDDROPDOWNLIST, etc. In fact, it shouldn't be like this, just because our current work is relatively simple (only these three forms, but I want to include most information system development) If you use other controls, you can consider modifying Acontrol IS XXX, Then, the process of processing itself, FormInfo supports the analysis of new controls.

The specific operation of this series of classes is implemented in the information extraction of the form data. Next, we should consider how to convert the extracted data into SQL.

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

New Post(0)