1. engineering and project structure
In the DAL layer, we mainly control and implement data access through IBatisNet. If you are not clear about IBatisNet, you can imagine that IBatisNet is used to return a generic data list set based on the query conditions.
2. Page-based parameter passing for paging Query
In the sample code in this article, you can enter FirstName and (or) LastName to fuzzy match and query some people, and display them on a page through a GridView. The process of passing parameters is very important. after entering the parameters in the two TextBox fields, in the program, we need to analyze whether to click a button or directly click a number for paging query, therefore, the following Page Load data initialization process is very important:
01
protected
int
currentPg = 1;
02
protected
int
totalCount = 0;
03
protected
int
recordsPerPg = 10;
04
private
int
leftSize = 3;
05
private
IList<Person> listPerson =
null
;
06
protected
void
Page_Load(
object
sender, EventArgs e)
07
{
08
if
(IsPostBack ==
false
&&
string
.Compare(Request.RequestType.ToLower(),
"get"
) == 0)
09
{
10
if
(
string
.IsNullOrEmpty(Request[
"pageIndex"
]) ==
false
&& RegUtil.IsPositiveNumber(Request[
"pageIndex"
]))
11
{
12
currentPg =
int
.Parse(Request[
"pageIndex"
]);
13
}
14
if
(
string
.IsNullOrEmpty(Request[
"firstname"
]) ==
false
)
15
{
16
this
.txtFirstName.Text = Request[
<