基于WF的意见征集2(浅析)
后台按照常规的李天平的代码生成器来生成的后台(如果是平台开发,可用其他形式,有时间再论)
先看数据访问层(DAL)
项目名:DAL
DLHTHuiFu.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Maticsoft.DBUtility;
6using System.Data;
7using IClass;
8using System.Data.SqlClient;
9
10namespace DAL
11{
12 public class DLHTHuiFu
13 {
14 成员方法#region 成员方法
15 /**//// <summary>
16 /// 是否存在该记录
17 /// </summary>
18 public bool Exists(int HfId)
19 {
20 StringBuilder strSql = new StringBuilder();
21 strSql.Append("select count(1) from HTHuiFu");
22 strSql.Append(" where HfId=@HfId ");
23 SqlParameter[] parameters = {
24 new SqlParameter("@HfId", SqlDbType.Int,4)};
25 parameters[0].Value = HfId;
26
27 return DbHelperSQL.Exists(strSql.ToString(), parameters);
28 }
29
30
31 /**//// <summary>
32 /// 增加一条数据
33 /// </summary>
34 public int Add(HTHuiFu model)
35 {
36 StringBuilder strSql = new StringBuilder();
37 strSql.Append("insert into HTHuiFu(");
38 strSql.Append("FBRenName,FanKuiNeiRong,HTId)");
39 strSql.Append(" values (");
40 strSql.Append("@FBRenName,@FanKuiNeiRong,@HTId)");
41 strSql.Append(";select @@IDENTITY");
42 SqlParameter[] parameters = {
43 new SqlParameter("@FBRenName", SqlDbType.VarChar,500),
44 new SqlParameter("@FanKuiNeiRong", SqlDbType.VarChar,5003),
45 new SqlParameter("@HTId",SqlDbType.Int) };
46 parameters[0].Value = model.FBRenName1;
47 parameters[1].Value = model.FanKuiNeiRong1;
48 parameters[2].Value = model.HTId1;
49
50 object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
51 if (obj == null)
52 {
53 return 1;
54 }
55 else
56 {
57 return Convert.ToInt32(obj);
58 }
59 }
60 /**//// <summary>
61 /// 更新一条数据
62 /// </summary>
63 public void Update(HTHuiFu model)
64 {
65 StringBuilder strSql = new StringBuilder();
66 strSql.Append("update HTHuiFu set ");
67 strSql.Append("FBRenName=@FBRenName,");
68 strSql.Append("FanKuiNeiRong=@FanKuiNeiRong");
69 strSql.Append(" where HfId=@HfId ");
70 SqlParameter[] parameters = {
71 new SqlParameter("@HfId", SqlDbType.Int,4),
72 new SqlParameter("@FBRenName", SqlDbType.VarChar,500),
73 new SqlParameter("@FanKuiNeiRong", SqlDbType.VarChar,5003)};
74 parameters[0].Value = model.HfId1;
75 parameters[1].Value = model.FBRenName1;
76 parameters[2].Value = model.FanKuiNeiRong1;
77
78 DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
79 }
80
81 /**//// <summary>
82 /// 删除一条数据
83 /// </summary>
84 public void Delete(int HfId)
85 {
86
87 StringBuilder strSql = new StringBuilder();
88 strSql.Append("delete HTHuiFu ");
89 strSql.Append(" where HfId=@HfId ");
90 SqlParameter[] parameters = {
91 new SqlParameter("@HfId", SqlDbType.Int,4)};
92 parameters[0].Value = HfId;
93
94 DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
95 }
96
97
98 /**//// <summary>
99 /// 得到一个对象实体
100 /// </summary>
101 public HTHuiFu GetModel(int HfId)
102 {
103
104 StringBuilder strSql = new StringBuilder();
105 strSql.Append("select top 1 HfId,FBRenName,FanKuiNeiRong,HTId from HTHuiFu ");
106 strSql.Append(" where HfId=@HfId ");
107 SqlParameter[] parameters = {
108 new SqlParameter("@HfId", SqlDbType.Int,4)};
109 parameters[0].Value = HfId;
110
111 HTHuiFu model = new HTHuiFu();
112 DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
113 if (ds.Tables[0].Rows.Count > 0)
114 {
115 if (ds.Tables[0].Rows[0]["HfId"].ToString() != "")
116 {
117 model.HfId1 = int.Parse(ds.Tables[0].Rows[0]["HfId"].ToString());
118 }
119 model.FBRenName1 = ds.Tables[0].Rows[0]["FBRenName"].ToString();
120 model.FanKuiNeiRong1 = ds.Tables[0].Rows[0]["FanKuiNeiRong"].ToString();
121 model.HTId1 = Convert.ToInt32(ds.Tables[0].Rows[0]["HTId"].ToString());
122 return model;
123 }
124 else
125 {
126 return null;
127 }
128 }
129
130 /**//// <summary>
131 /// 获得数据列表
132 /// </summary>
133 public DataSet GetList(string strWhere)
134 {
135 StringBuilder strSql = new StringBuilder();
136 strSql.Append("select HfId,FBRenName,FanKuiNeiRong,HTId ");
137 strSql.Append(" FROM HTHuiFu ");
138 if (strWhere.Trim() != "")
139 {
140 strSql.Append(" where " + strWhere);
141 }
142 return DbHelperSQL.Query(strSql.ToString());
143 }
144
145 #endregion 成员方法
146
147 }
148}
149
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Maticsoft.DBUtility;
6using System.Data;
7using IClass;
8using System.Data.SqlClient;
9
10namespace DAL
11{
12 public class DLHTHuiFu
13 {
14 成员方法#region 成员方法
15 /**//// <summary>
16 /// 是否存在该记录
17 /// </summary>
18 public bool Exists(int HfId)
19 {
20 StringBuilder strSql = new StringBuilder();
21 strSql.Append("select count(1) from HTHuiFu");
22 strSql.Append(" where HfId=@HfId ");
23 SqlParameter[] parameters = {
24 new SqlParameter("@HfId", SqlDbType.Int,4)};
25 parameters[0].Value = HfId;
26
27 return DbHelperSQL.Exists(strSql.ToString(), parameters);
28 }
29
30
31 /**//// <summary>
32 /// 增加一条数据
33 /// </summary>
34 public int Add(HTHuiFu model)
35 {
36 StringBuilder strSql = new StringBuilder();
37 strSql.Append("insert into HTHuiFu(");
38 strSql.Append("FBRenName,FanKuiNeiRong,HTId)");
39 strSql.Append(" values (");
40 strSql.Append("@FBRenName,@FanKuiNeiRong,@HTId)");
41 strSql.Append(";select @@IDENTITY");
42 SqlParameter[] parameters = {
43 new SqlParameter("@FBRenName", SqlDbType.VarChar,500),
44 new SqlParameter("@FanKuiNeiRong", SqlDbType.VarChar,5003),
45 new SqlParameter("@HTId",SqlDbType.Int) };
46 parameters[0].Value = model.FBRenName1;
47 parameters[1].Value = model.FanKuiNeiRong1;
48 parameters[2].Value = model.HTId1;
49
50 object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
51 if (obj == null)
52 {
53 return 1;
54 }
55 else
56 {
57 return Convert.ToInt32(obj);
58 }
59 }
60 /**//// <summary>
61 /// 更新一条数据
62 /// </summary>
63 public void Update(HTHuiFu model)
64 {
65 StringBuilder strSql = new StringBuilder();
66 strSql.Append("update HTHuiFu set ");
67 strSql.Append("FBRenName=@FBRenName,");
68 strSql.Append("FanKuiNeiRong=@FanKuiNeiRong");
69 strSql.Append(" where HfId=@HfId ");
70 SqlParameter[] parameters = {
71 new SqlParameter("@HfId", SqlDbType.Int,4),
72 new SqlParameter("@FBRenName", SqlDbType.VarChar,500),
73 new SqlParameter("@FanKuiNeiRong", SqlDbType.VarChar,5003)};
74 parameters[0].Value = model.HfId1;
75 parameters[1].Value = model.FBRenName1;
76 parameters[2].Value = model.FanKuiNeiRong1;
77
78 DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
79 }
80
81 /**//// <summary>
82 /// 删除一条数据
83 /// </summary>
84 public void Delete(int HfId)
85 {
86
87 StringBuilder strSql = new StringBuilder();
88 strSql.Append("delete HTHuiFu ");
89 strSql.Append(" where HfId=@HfId ");
90 SqlParameter[] parameters = {
91 new SqlParameter("@HfId", SqlDbType.Int,4)};
92 parameters[0].Value = HfId;
93
94 DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
95 }
96
97
98 /**//// <summary>
99 /// 得到一个对象实体
100 /// </summary>
101 public HTHuiFu GetModel(int HfId)
102 {
103
104 StringBuilder strSql = new StringBuilder();
105 strSql.Append("select top 1 HfId,FBRenName,FanKuiNeiRong,HTId from HTHuiFu ");
106 strSql.Append(" where HfId=@HfId ");
107 SqlParameter[] parameters = {
108 new SqlParameter("@HfId", SqlDbType.Int,4)};
109 parameters[0].Value = HfId;
110
111 HTHuiFu model = new HTHuiFu();
112 DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
113 if (ds.Tables[0].Rows.Count > 0)
114 {
115 if (ds.Tables[0].Rows[0]["HfId"].ToString() != "")
116 {
117 model.HfId1 = int.Parse(ds.Tables[0].Rows[0]["HfId"].ToString());
118 }
119 model.FBRenName1 = ds.Tables[0].Rows[0]["FBRenName"].ToString();
120 model.FanKuiNeiRong1 = ds.Tables[0].Rows[0]["FanKuiNeiRong"].ToString();
121 model.HTId1 = Convert.ToInt32(ds.Tables[0].Rows[0]["HTId"].ToString());
122 return model;
123 }
124 else
125 {
126 return null;
127 }
128 }
129
130 /**//// <summary>
131 /// 获得数据列表
132 /// </summary>
133 public DataSet GetList(string strWhere)
134 {
135 StringBuilder strSql = new StringBuilder();
136 strSql.Append("select HfId,FBRenName,FanKuiNeiRong,HTId ");
137 strSql.Append(" FROM HTHuiFu ");
138 if (strWhere.Trim() != "")
139 {
140 strSql.Append(" where " + strWhere);
141 }
142 return DbHelperSQL.Query(strSql.ToString());
143 }
144
145 #endregion 成员方法
146
147 }
148}
149
DLMaster.cs
1using System;
2using System.Data;
3using System.Text;
4using System.Data.SqlClient;
5using Maticsoft.DBUtility;
6using IClass;
7
8namespace DAL
9{
10 /**//// <summary>
11 /// 数据访问类Master。
12 /// </summary>
13 public class DLMaster
14 {
15 public DLMaster()
16 { }
17 成员方法#region 成员方法
18
19 /**//// <summary>
20 /// 增加一条数据
21 /// </summary>
22 public void Add(IClass.Master model)
23 {
24 StringBuilder strSql = new StringBuilder();
25 strSql.Append("insert into Master(");
26 strSql.Append("id,bl,flage)");
27 strSql.Append(" values (");
28 strSql.Append("@id,@bl,@flage)");
29 SqlParameter[] parameters = {
30 new SqlParameter("@id", SqlDbType.VarChar,500),
31 new SqlParameter("@bl", SqlDbType.VarChar,500),
32 new SqlParameter("@flage", SqlDbType.VarChar,500)};
33 parameters[0].Value = model.Id;
34 parameters[1].Value = model.Bl;
35 parameters[2].Value = model.Flage;
36
37 DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
38 }
39 /**//// <summary>
40 /// 删除一条数据
41 /// </summary>
42 public void Delete(string id)
43 {
44
45 StringBuilder strSql = new StringBuilder();
46 strSql.Append("delete Master ");
47 strSql.Append(" where id=@id ");
48 SqlParameter[] parameters = {
49 new SqlParameter("@id", SqlDbType.VarChar,50)};
50 parameters[0].Value = id;
51
52 DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
53 }
54
55
56 /**//// <summary>
57 /// 得到一个对象实体
58 /// </summary>
59 public Master GetModel(string id)
60 {
61
62 StringBuilder strSql = new StringBuilder();
63 strSql.Append("select top 1 id,bl,flage from Master ");
64 strSql.Append(" where id=@id ");
65 SqlParameter[] parameters = {
66 new SqlParameter("@id", SqlDbType.VarChar,50)};
67 parameters[0].Value = id;
68
69 Master model = new Master();
70 DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
71 if (ds.Tables[0].Rows.Count > 0)
72 {
73 model.Id = ds.Tables[0].Rows[0]["id"].ToString();
74 model.Bl = Convert.ToBoolean(ds.Tables[0].Rows[0]["bl"].ToString());
75 model.Flage = ds.Tables[0].Rows[0]["flage"].ToString();
76 return model;
77 }
78 else
79 {
80 return null;
81 }
82 }
83
84 /**//// <summary>
85 /// 获得数据列表
86 /// </summary>
87 public DataSet GetList(string strWhere)
88 {
89 StringBuilder strSql = new StringBuilder();
90 strSql.Append("select id,bl,flage ");
91 strSql.Append(" FROM Master ");
92 if (strWhere.Trim() != "")
93 {
94 strSql.Append(" where " + strWhere);
95 }
96 return DbHelperSQL.Query(strSql.ToString());
97 }
98
99 /**//*
100 /// <summary>
101 /// 分页获取数据列表
102 /// </summary>
103 public DataSet GetList(int PageSize,int PageIndex,string strWhere)
104 {
105 SqlParameter[] parameters = {
106 new SqlParameter("@tblName", SqlDbType.VarChar, 255),
107 new SqlParameter("@fldName", SqlDbType.VarChar, 255),
108 new SqlParameter("@PageSize", SqlDbType.Int),
109 new SqlParameter("@PageIndex", SqlDbType.Int),
110 new SqlParameter("@IsReCount", SqlDbType.Bit),
111 new SqlParameter("@OrderType", SqlDbType.Bit),
112 new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
113 };
114 parameters[0].Value = "Master";
115 parameters[1].Value = "ID";
116 parameters[2].Value = PageSize;
117 parameters[3].Value = PageIndex;
118 parameters[4].Value = 0;
119 parameters[5].Value = 0;
120 parameters[6].Value = strWhere;
121 return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
122 }*/
123
124 #endregion 成员方法
125 }
126}
127
1using System;
2using System.Data;
3using System.Text;
4using System.Data.SqlClient;
5using Maticsoft.DBUtility;
6using IClass;
7
8namespace DAL
9{
10 /**//// <summary>
11 /// 数据访问类Master。
12 /// </summary>
13 public class DLMaster
14 {
15 public DLMaster()
16 { }
17 成员方法#region 成员方法
18
19 /**//// <summary>
20 /// 增加一条数据
21 /// </summary>
22 public void Add(IClass.Master model)
23 {
24 StringBuilder strSql = new StringBuilder();
25 strSql.Append("insert into Master(");
26 strSql.Append("id,bl,flage)");
27 strSql.Append(" values (");
28 strSql.Append("@id,@bl,@flage)");
29 SqlParameter[] parameters = {
30 new SqlParameter("@id", SqlDbType.VarChar,500),
31 new SqlParameter("@bl", SqlDbType.VarChar,500),
32 new SqlParameter("@flage", SqlDbType.VarChar,500)};
33 parameters[0].Value = model.Id;
34 parameters[1].Value = model.Bl;
35 parameters[2].Value = model.Flage;
36
37 DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
38 }
39 /**//// <summary>
40 /// 删除一条数据
41 /// </summary>
42 public void Delete(string id)
43 {
44
45 StringBuilder strSql = new StringBuilder();
46 strSql.Append("delete Master ");
47 strSql.Append(" where id=@id ");
48 SqlParameter[] parameters = {
49 new SqlParameter("@id", SqlDbType.VarChar,50)};
50 parameters[0].Value = id;
51
52 DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
53 }
54
55
56 /**//// <summary>
57 /// 得到一个对象实体
58 /// </summary>
59 public Master GetModel(string id)
60 {
61
62 StringBuilder strSql = new StringBuilder();
63 strSql.Append("select top 1 id,bl,flage from Master ");
64 strSql.Append(" where id=@id ");
65 SqlParameter[] parameters = {
66 new SqlParameter("@id", SqlDbType.VarChar,50)};
67 parameters[0].Value = id;
68
69 Master model = new Master();
70 DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
71 if (ds.Tables[0].Rows.Count > 0)
72 {
73 model.Id = ds.Tables[0].Rows[0]["id"].ToString();
74 model.Bl = Convert.ToBoolean(ds.Tables[0].Rows[0]["bl"].ToString());
75 model.Flage = ds.Tables[0].Rows[0]["flage"].ToString();
76 return model;
77 }
78 else
79 {
80 return null;
81 }
82 }
83
84 /**//// <summary>
85 /// 获得数据列表
86 /// </summary>
87 public DataSet GetList(string strWhere)
88 {
89 StringBuilder strSql = new StringBuilder();
90 strSql.Append("select id,bl,flage ");
91 strSql.Append(" FROM Master ");
92 if (strWhere.Trim() != "")
93 {
94 strSql.Append(" where " + strWhere);
95 }
96 return DbHelperSQL.Query(strSql.ToString());
97 }
98
99 /**//*
100 /// <summary>
101 /// 分页获取数据列表
102 /// </summary>
103 public DataSet GetList(int PageSize,int PageIndex,string strWhere)
104 {
105 SqlParameter[] parameters = {
106 new SqlParameter("@tblName", SqlDbType.VarChar, 255),
107 new SqlParameter("@fldName", SqlDbType.VarChar, 255),
108 new SqlParameter("@PageSize", SqlDbType.Int),
109 new SqlParameter("@PageIndex", SqlDbType.Int),
110 new SqlParameter("@IsReCount", SqlDbType.Bit),
111 new SqlParameter("@OrderType", SqlDbType.Bit),
112 new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
113 };
114 parameters[0].Value = "Master";
115 parameters[1].Value = "ID";
116 parameters[2].Value = PageSize;
117 parameters[3].Value = PageIndex;
118 parameters[4].Value = 0;
119 parameters[5].Value = 0;
120 parameters[6].Value = strWhere;
121 return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
122 }*/
123
124 #endregion 成员方法
125 }
126}
127
DLHuaTi.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using IClass;
6using Maticsoft.DBUtility;
7using System.Data;
8using System.Data.SqlClient;
9
10namespace DAL
11{
12 public class DLHuaTi
13 {
14 成员方法#region 成员方法
15 /**//// <summary>
16 /// 是否存在该记录
17 /// </summary>
18 public bool Exists(int HTID)
19 {
20 StringBuilder strSql = new StringBuilder();
21 strSql.Append("select count(1) from HuaTi");
22 strSql.Append(" where HTID=@HTID ");
23 SqlParameter[] parameters = {
24 new SqlParameter("@HTID", SqlDbType.Int,4)};
25 parameters[0].Value = HTID;
26
27 return DbHelperSQL.Exists(strSql.ToString(), parameters);
28 }
29
30
31 /**//// <summary>
32 /// 增加一条数据
33 /// </summary>
34 public int Add(HuaTi model)
35 {
36 StringBuilder strSql = new StringBuilder();
37 strSql.Append("insert into HuaTi(");
38 strSql.Append("HTName,HTNeiRong,State,dt)");
39 strSql.Append(" values (");
40 strSql.Append("@HTName,@HTNeiRong,@State,@dt)");
41 strSql.Append(";select @@IDENTITY");
42 SqlParameter[] parameters = {
43 new SqlParameter("@HTName", SqlDbType.VarChar,500),
44 new SqlParameter("@HTNeiRong", SqlDbType.VarChar,5000),
45 new SqlParameter("@State", SqlDbType.Int,4),
46 new SqlParameter("@dt", SqlDbType.DateTime)};
47 parameters[0].Value = model.HTName1;
48 parameters[1].Value = model.HTNeiRong1;
49 parameters[2].Value = model.State1;
50 parameters[3].Value = model.Dt;
51
52 object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
53 if (obj == null)
54 {
55 return 1;
56 }
57 else
58 {
59 return Convert.ToInt32(obj);
60 }
61 }
62 /**//// <summary>
63 /// 更新一条数据
64 /// </summary>
65 public void Update(HuaTi model)
66 {
67 StringBuilder strSql = new StringBuilder();
68 strSql.Append("update HuaTi set ");
69 strSql.Append("HTName=@HTName,");
70 strSql.Append("HTNeiRong=@HTNeiRong,");
71 strSql.Append("State=@State,");
72 strSql.Append("dt=@dt");
73 strSql.Append(" where HTID=@HTID ");
74 SqlParameter[] parameters = {
75 new SqlParameter("@HTID", SqlDbType.Int,4),
76 new SqlParameter("@HTName", SqlDbType.VarChar,500),
77 new SqlParameter("@HTNeiRong", SqlDbType.VarChar,500),
78 new SqlParameter("@State", SqlDbType.Int,4),
79 new SqlParameter("@dt", SqlDbType.DateTime)};
80 parameters[0].Value = model.HTID1;
81 parameters[1].Value = model.HTName1;
82 parameters[2].Value = model.HTNeiRong1;
83 parameters[3].Value = model.State1;
84 parameters[4].Value = model.Dt;
85
86 DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
87 }
88
89 /**//// <summary>
90 /// 删除一条数据
91 /// </summary>
92 public void Delete(int HTID)
93 {
94
95 StringBuilder strSql = new StringBuilder();
96 strSql.Append("delete HuaTi ");
97 strSql.Append(" where HTID=@HTID ");
98 SqlParameter[] parameters = {
99 new SqlParameter("@HTID", SqlDbType.Int,4)};
100 parameters[0].Value = HTID;
101
102 DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
103 }
104
105
106 /**//// <summary>
107 /// 得到一个对象实体
108 /// </summary>
109 public HuaTi GetModel(int HTID)
110 {
111
112 StringBuilder strSql = new StringBuilder();
113 strSql.Append("select top 1 HTID,HTName,HTNeiRong,State,dt from HuaTi ");
114 strSql.Append(" where HTID=@HTID ");
115 SqlParameter[] parameters = {
116 new SqlParameter("@HTID", SqlDbType.Int,4)};
117 parameters[0].Value = HTID;
118
119 HuaTi model = new HuaTi();
120 DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
121 if (ds.Tables[0].Rows.Count > 0)
122 {
123 if (ds.Tables[0].Rows[0]["HTID"].ToString() != "")
124 {
125 model.HTID1 = int.Parse(ds.Tables[0].Rows[0]["HTID"].ToString());
126 }
127 model.HTName1 = ds.Tables[0].Rows[0]["HTName"].ToString();
128 model.HTNeiRong1 = ds.Tables[0].Rows[0]["HTNeiRong"].ToString();
129 if (ds.Tables[0].Rows[0]["State"].ToString() != "")
130 {
131 model.State1 = int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
132 }
133 if (ds.Tables[0].Rows[0]["dt"].ToString() != "")
134 {
135 model.Dt = DateTime.Parse(ds.Tables[0].Rows[0]["dt"].ToString());
136 }
137 return model;
138 }
139 else
140 {
141 return null;
142 }
143 }
144
145 /**//// <summary>
146 /// 获得数据列表
147 /// </summary>
148 public DataSet GetList(string strWhere)
149 {
150 StringBuilder strSql = new StringBuilder();
151 strSql.Append("select HTID,HTName,HTNeiRong,State,dt ");
152 strSql.Append(" FROM HuaTi ");
153 if (strWhere.Trim() != "")
154 {
155 strSql.Append(" where " + strWhere);
156 }
157 return DbHelperSQL.Query(strSql.ToString());
158 }
159
160 #endregion 成员方法
161 }
162}
163
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using IClass;
6using Maticsoft.DBUtility;
7using System.Data;
8using System.Data.SqlClient;
9
10namespace DAL
11{
12 public class DLHuaTi
13 {
14 成员方法#region 成员方法
15 /**//// <summary>
16 /// 是否存在该记录
17 /// </summary>
18 public bool Exists(int HTID)
19 {
20 StringBuilder strSql = new StringBuilder();
21 strSql.Append("select count(1) from HuaTi");
22 strSql.Append(" where HTID=@HTID ");
23 SqlParameter[] parameters = {
24 new SqlParameter("@HTID", SqlDbType.Int,4)};
25 parameters[0].Value = HTID;
26
27 return DbHelperSQL.Exists(strSql.ToString(), parameters);
28 }
29
30
31 /**//// <summary>
32 /// 增加一条数据
33 /// </summary>
34 public int Add(HuaTi model)
35 {
36 StringBuilder strSql = new StringBuilder();
37 strSql.Append("insert into HuaTi(");
38 strSql.Append("HTName,HTNeiRong,State,dt)");
39 strSql.Append(" values (");
40 strSql.Append("@HTName,@HTNeiRong,@State,@dt)");
41 strSql.Append(";select @@IDENTITY");
42 SqlParameter[] parameters = {
43 new SqlParameter("@HTName", SqlDbType.VarChar,500),
44 new SqlParameter("@HTNeiRong", SqlDbType.VarChar,5000),
45 new SqlParameter("@State", SqlDbType.Int,4),
46 new SqlParameter("@dt", SqlDbType.DateTime)};
47 parameters[0].Value = model.HTName1;
48 parameters[1].Value = model.HTNeiRong1;
49 parameters[2].Value = model.State1;
50 parameters[3].Value = model.Dt;
51
52 object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
53 if (obj == null)
54 {
55 return 1;
56 }
57 else
58 {
59 return Convert.ToInt32(obj);
60 }
61 }
62 /**//// <summary>
63 /// 更新一条数据
64 /// </summary>
65 public void Update(HuaTi model)
66 {
67 StringBuilder strSql = new StringBuilder();
68 strSql.Append("update HuaTi set ");
69 strSql.Append("HTName=@HTName,");
70 strSql.Append("HTNeiRong=@HTNeiRong,");
71 strSql.Append("State=@State,");
72 strSql.Append("dt=@dt");
73 strSql.Append(" where HTID=@HTID ");
74 SqlParameter[] parameters = {
75 new SqlParameter("@HTID", SqlDbType.Int,4),
76 new SqlParameter("@HTName", SqlDbType.VarChar,500),
77 new SqlParameter("@HTNeiRong", SqlDbType.VarChar,500),
78 new SqlParameter("@State", SqlDbType.Int,4),
79 new SqlParameter("@dt", SqlDbType.DateTime)};
80 parameters[0].Value = model.HTID1;
81 parameters[1].Value = model.HTName1;
82 parameters[2].Value = model.HTNeiRong1;
83 parameters[3].Value = model.State1;
84 parameters[4].Value = model.Dt;
85
86 DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
87 }
88
89 /**//// <summary>
90 /// 删除一条数据
91 /// </summary>
92 public void Delete(int HTID)
93 {
94
95 StringBuilder strSql = new StringBuilder();
96 strSql.Append("delete HuaTi ");
97 strSql.Append(" where HTID=@HTID ");
98 SqlParameter[] parameters = {
99 new SqlParameter("@HTID", SqlDbType.Int,4)};
100 parameters[0].Value = HTID;
101
102 DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
103 }
104
105
106 /**//// <summary>
107 /// 得到一个对象实体
108 /// </summary>
109 public HuaTi GetModel(int HTID)
110 {
111
112 StringBuilder strSql = new StringBuilder();
113 strSql.Append("select top 1 HTID,HTName,HTNeiRong,State,dt from HuaTi ");
114 strSql.Append(" where HTID=@HTID ");
115 SqlParameter[] parameters = {
116 new SqlParameter("@HTID", SqlDbType.Int,4)};
117 parameters[0].Value = HTID;
118
119 HuaTi model = new HuaTi();
120 DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
121 if (ds.Tables[0].Rows.Count > 0)
122 {
123 if (ds.Tables[0].Rows[0]["HTID"].ToString() != "")
124 {
125 model.HTID1 = int.Parse(ds.Tables[0].Rows[0]["HTID"].ToString());
126 }
127 model.HTName1 = ds.Tables[0].Rows[0]["HTName"].ToString();
128 model.HTNeiRong1 = ds.Tables[0].Rows[0]["HTNeiRong"].ToString();
129 if (ds.Tables[0].Rows[0]["State"].ToString() != "")
130 {
131 model.State1 = int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
132 }
133 if (ds.Tables[0].Rows[0]["dt"].ToString() != "")
134 {
135 model.Dt = DateTime.Parse(ds.Tables[0].Rows[0]["dt"].ToString());
136 }
137 return model;
138 }
139 else
140 {
141 return null;
142 }
143 }
144
145 /**//// <summary>
146 /// 获得数据列表
147 /// </summary>
148 public DataSet GetList(string strWhere)
149 {
150 StringBuilder strSql = new StringBuilder();
151 strSql.Append("select HTID,HTName,HTNeiRong,State,dt ");
152 strSql.Append(" FROM HuaTi ");
153 if (strWhere.Trim() != "")
154 {
155 strSql.Append(" where " + strWhere);
156 }
157 return DbHelperSQL.Query(strSql.ToString());
158 }
159
160 #endregion 成员方法
161 }
162}
163
基于WF的意见征集1(浅析)
基于WF的意见征集3(浅析)
基于WF的意见征集4(浅析)
基于WF的意见征集5(浅析)
基于WF的意见征集6(浅析)
基于WF的意见征集7(浅析)