实现.net cms系统 第三篇《大刀阔斧-核心源码》
1 using System;2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace Aspx.Web
7 {
8 public class Condition //返回数据的条件对象
9 {
10 /// <summary>
11 /// 数据表名
12 /// </summary>
13 private string _TblName = "";
14 public string TblName
15 {
16 get { return _TblName; }
17 set { _TblName = value; }
18 }
19 /// <summary>
20 /// 表中的字段名
21 /// </summary>
22 private string _Filed = "";
23 public string Field
24 {
25 get { return _Filed; }
26 set { _Filed = value; }
27 }
28 /// <summary>
29 /// 是否分页
30 /// </summary>
31 private bool _Page = false;
32 public bool Page
33 {
34 get { return _Page; }
35 set { _Page = value; }
36 }
37 /// <summary>
38 /// 每页显示行数
39 /// </summary>
40 private int _Num = 10;
41 public int Num
42 {
43 get { return _Num; }
44 set { _Num = value; }
45 }
46 /// <summary>
47 /// 排序方法
48 /// </summary>
49 private string _Sort = "";
50 public string Sort
51 {
52 get { return _Sort; }
53 set { _Sort = value; }
54 }
55 /// <summary>
56 /// 查询条件
57 /// </summary>
58 private string _Where = "";
59 public string Where
60 {
61 get { return _Where; }
62 set { _Where = value; }
63 }
64 /// <summary>
65 /// 填写当前地址栏,所传参数的名称,以便获取,交与 Where 匹配
66 /// </summary>
67 private string _GetKey = "";
68 public string GetKey
69 {
70 get { return _GetKey; }
71 set { _GetKey = value; }
72 }
73 }
74 public class _Model : Condition
75 {
76 public string Aspx(string htmlContent)
77 {
78 string html = "";
79 switch (TblName)
80 {
81 case "News": html = Html_News(htmlContent); break;
82 //扩展各个表
83 //case "About":html= Html_About(htmlContent);break;
84 default: break;
85 }
86 return html;
87 }
88 private string GetWhere()
89 {
90 string strWhere = "";
91 //封装查询条件
92 return strWhere;
93 }
94 private string GetSort()
95 {
96 string strSort = "";
97 //封装排序方法
98 return strSort;
99 }
100
101 #region News 数据
102 private string Html_News(string htmlContent)
103 {
104 
补充:Web开发 , ASP.Net ,