|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+using System;
|
|
|
2
|
+using System.Data;
|
|
|
3
|
+using System.Text;
|
|
|
4
|
+using System.Data.SqlClient;
|
|
|
5
|
+using RMYY_CallCenter_Api.DB;
|
|
|
6
|
+
|
|
|
7
|
+namespace RMYY_CallCenter_Api.Dal
|
|
|
8
|
+{
|
|
|
9
|
+ /// <summary>
|
|
|
10
|
+ /// 数据访问类:T_Cus_Customer
|
|
|
11
|
+ /// </summary>
|
|
|
12
|
+ public partial class T_Cus_Customer
|
|
|
13
|
+ {
|
|
|
14
|
+ public T_Cus_Customer()
|
|
|
15
|
+ { }
|
|
|
16
|
+ #region BasicMethod
|
|
|
17
|
+ /// <summary>
|
|
|
18
|
+ /// 是否存在该记录
|
|
|
19
|
+ /// </summary>
|
|
|
20
|
+ public bool Exists(int F_CustomerId)
|
|
|
21
|
+ {
|
|
|
22
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
23
|
+ strSql.Append("select count(1) from T_Cus_Customer with(nolock)");
|
|
|
24
|
+ strSql.Append(" where F_CustomerId=@F_CustomerId");
|
|
|
25
|
+ SqlParameter[] parameters = {
|
|
|
26
|
+ new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
|
|
|
27
|
+ };
|
|
|
28
|
+ parameters[0].Value = F_CustomerId;
|
|
|
29
|
+
|
|
|
30
|
+ return DbHelperSQL.Exists(strSql.ToString(), parameters);
|
|
|
31
|
+ }
|
|
|
32
|
+
|
|
|
33
|
+
|
|
|
34
|
+ /// <summary>
|
|
|
35
|
+ /// 增加一条数据
|
|
|
36
|
+ /// </summary>
|
|
|
37
|
+ public int Add(RMYY_CallCenter_Api.Model.T_Cus_Customer model)
|
|
|
38
|
+ {
|
|
|
39
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
40
|
+ strSql.Append("insert into T_Cus_Customer(");
|
|
|
41
|
+ strSql.Append("F_CustomerName,F_CustomerCode,F_Layer,F_Province,F_City,F_County,F_Address,F_Telephone,F_Mobile,F_Fax,F_Email,F_PostCode,F_Sex,F_CreateBy,F_CreatedOn,F_ModifyBy,F_ModifiedOn,F_DeleteFlag,F_DeleteBy,F_DeleteOn)");
|
|
|
42
|
+ strSql.Append(" values (");
|
|
|
43
|
+ strSql.Append("@F_CustomerName,@F_CustomerCode,@F_Layer,@F_Province,@F_City,@F_County,@F_Address,@F_Telephone,@F_Mobile,@F_Fax,@F_Email,@F_PostCode,@F_Sex,@F_CreateBy,@F_CreatedOn,@F_ModifyBy,@F_ModifiedOn,@F_DeleteFlag,@F_DeleteBy,@F_DeleteOn)");
|
|
|
44
|
+ strSql.Append(";select @@IDENTITY");
|
|
|
45
|
+ SqlParameter[] parameters = {
|
|
|
46
|
+ new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,200),
|
|
|
47
|
+ new SqlParameter("@F_CustomerCode", SqlDbType.VarChar,100),
|
|
|
48
|
+ new SqlParameter("@F_Layer", SqlDbType.SmallInt,2),
|
|
|
49
|
+ new SqlParameter("@F_Province", SqlDbType.NVarChar,50),
|
|
|
50
|
+ new SqlParameter("@F_City", SqlDbType.NVarChar,50),
|
|
|
51
|
+ new SqlParameter("@F_County", SqlDbType.NVarChar,50),
|
|
|
52
|
+ new SqlParameter("@F_Address", SqlDbType.NVarChar,300),
|
|
|
53
|
+ new SqlParameter("@F_Telephone", SqlDbType.NVarChar,200),
|
|
|
54
|
+ new SqlParameter("@F_Mobile", SqlDbType.NVarChar,200),
|
|
|
55
|
+ new SqlParameter("@F_Fax", SqlDbType.NVarChar,200),
|
|
|
56
|
+ new SqlParameter("@F_Email", SqlDbType.VarChar,200),
|
|
|
57
|
+ new SqlParameter("@F_PostCode", SqlDbType.NVarChar,50),
|
|
|
58
|
+ new SqlParameter("@F_Sex", SqlDbType.VarChar,50),
|
|
|
59
|
+ new SqlParameter("@F_CreateBy", SqlDbType.VarChar,50),
|
|
|
60
|
+ new SqlParameter("@F_CreatedOn", SqlDbType.DateTime),
|
|
|
61
|
+ new SqlParameter("@F_ModifyBy", SqlDbType.VarChar,50),
|
|
|
62
|
+ new SqlParameter("@F_ModifiedOn", SqlDbType.DateTime),
|
|
|
63
|
+ new SqlParameter("@F_DeleteFlag", SqlDbType.SmallInt,2),
|
|
|
64
|
+ new SqlParameter("@F_DeleteBy", SqlDbType.VarChar,50),
|
|
|
65
|
+ new SqlParameter("@F_DeleteOn", SqlDbType.DateTime)};
|
|
|
66
|
+ parameters[0].Value = model.F_CustomerName;
|
|
|
67
|
+ parameters[1].Value = model.F_CustomerCode;
|
|
|
68
|
+ parameters[2].Value = model.F_Layer;
|
|
|
69
|
+ parameters[3].Value = model.F_Province;
|
|
|
70
|
+ parameters[4].Value = model.F_City;
|
|
|
71
|
+ parameters[5].Value = model.F_County;
|
|
|
72
|
+ parameters[6].Value = model.F_Address;
|
|
|
73
|
+ parameters[7].Value = model.F_Telephone;
|
|
|
74
|
+ parameters[8].Value = model.F_Mobile;
|
|
|
75
|
+ parameters[9].Value = model.F_Fax;
|
|
|
76
|
+ parameters[10].Value = model.F_Email;
|
|
|
77
|
+ parameters[11].Value = model.F_PostCode;
|
|
|
78
|
+ parameters[12].Value = model.F_Sex;
|
|
|
79
|
+ parameters[13].Value = model.F_CreateBy;
|
|
|
80
|
+ parameters[14].Value = model.F_CreatedOn;
|
|
|
81
|
+ parameters[15].Value = model.F_ModifyBy;
|
|
|
82
|
+ parameters[16].Value = model.F_ModifiedOn;
|
|
|
83
|
+ parameters[17].Value = model.F_DeleteFlag;
|
|
|
84
|
+ parameters[18].Value = model.F_DeleteBy;
|
|
|
85
|
+ parameters[19].Value = model.F_DeleteOn;
|
|
|
86
|
+
|
|
|
87
|
+ object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
|
|
|
88
|
+ if (obj == null)
|
|
|
89
|
+ {
|
|
|
90
|
+ return 0;
|
|
|
91
|
+ }
|
|
|
92
|
+ else
|
|
|
93
|
+ {
|
|
|
94
|
+ return Convert.ToInt32(obj);
|
|
|
95
|
+ }
|
|
|
96
|
+ }
|
|
|
97
|
+ /// <summary>
|
|
|
98
|
+ /// 更新一条数据
|
|
|
99
|
+ /// </summary>
|
|
|
100
|
+ public bool Update(RMYY_CallCenter_Api.Model.T_Cus_Customer model)
|
|
|
101
|
+ {
|
|
|
102
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
103
|
+ strSql.Append("update T_Cus_Customer set ");
|
|
|
104
|
+ strSql.Append("F_CustomerName=@F_CustomerName,");
|
|
|
105
|
+ strSql.Append("F_CustomerCode=@F_CustomerCode,");
|
|
|
106
|
+ strSql.Append("F_Layer=@F_Layer,");
|
|
|
107
|
+ strSql.Append("F_Province=@F_Province,");
|
|
|
108
|
+ strSql.Append("F_City=@F_City,");
|
|
|
109
|
+ strSql.Append("F_County=@F_County,");
|
|
|
110
|
+ strSql.Append("F_Address=@F_Address,");
|
|
|
111
|
+ strSql.Append("F_Telephone=@F_Telephone,");
|
|
|
112
|
+ strSql.Append("F_Mobile=@F_Mobile,");
|
|
|
113
|
+ strSql.Append("F_Fax=@F_Fax,");
|
|
|
114
|
+ strSql.Append("F_Email=@F_Email,");
|
|
|
115
|
+ strSql.Append("F_PostCode=@F_PostCode,");
|
|
|
116
|
+ strSql.Append("F_Sex=@F_Sex,");
|
|
|
117
|
+ strSql.Append("F_CreateBy=@F_CreateBy,");
|
|
|
118
|
+ strSql.Append("F_CreatedOn=@F_CreatedOn,");
|
|
|
119
|
+ strSql.Append("F_ModifyBy=@F_ModifyBy,");
|
|
|
120
|
+ strSql.Append("F_ModifiedOn=@F_ModifiedOn,");
|
|
|
121
|
+ strSql.Append("F_DeleteFlag=@F_DeleteFlag,");
|
|
|
122
|
+ strSql.Append("F_DeleteBy=@F_DeleteBy,");
|
|
|
123
|
+ strSql.Append("F_DeleteOn=@F_DeleteOn");
|
|
|
124
|
+ strSql.Append(" where F_CustomerId=@F_CustomerId");
|
|
|
125
|
+ SqlParameter[] parameters = {
|
|
|
126
|
+ new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,200),
|
|
|
127
|
+ new SqlParameter("@F_CustomerCode", SqlDbType.VarChar,100),
|
|
|
128
|
+ new SqlParameter("@F_Layer", SqlDbType.SmallInt,2),
|
|
|
129
|
+ new SqlParameter("@F_Province", SqlDbType.NVarChar,50),
|
|
|
130
|
+ new SqlParameter("@F_City", SqlDbType.NVarChar,50),
|
|
|
131
|
+ new SqlParameter("@F_County", SqlDbType.NVarChar,50),
|
|
|
132
|
+ new SqlParameter("@F_Address", SqlDbType.NVarChar,300),
|
|
|
133
|
+ new SqlParameter("@F_Telephone", SqlDbType.NVarChar,200),
|
|
|
134
|
+ new SqlParameter("@F_Mobile", SqlDbType.NVarChar,200),
|
|
|
135
|
+ new SqlParameter("@F_Fax", SqlDbType.NVarChar,200),
|
|
|
136
|
+ new SqlParameter("@F_Email", SqlDbType.VarChar,200),
|
|
|
137
|
+ new SqlParameter("@F_PostCode", SqlDbType.NVarChar,50),
|
|
|
138
|
+ new SqlParameter("@F_Sex", SqlDbType.VarChar,50),
|
|
|
139
|
+ new SqlParameter("@F_CreateBy", SqlDbType.VarChar,50),
|
|
|
140
|
+ new SqlParameter("@F_CreatedOn", SqlDbType.DateTime),
|
|
|
141
|
+ new SqlParameter("@F_ModifyBy", SqlDbType.VarChar,50),
|
|
|
142
|
+ new SqlParameter("@F_ModifiedOn", SqlDbType.DateTime),
|
|
|
143
|
+ new SqlParameter("@F_DeleteFlag", SqlDbType.SmallInt,2),
|
|
|
144
|
+ new SqlParameter("@F_DeleteBy", SqlDbType.VarChar,50),
|
|
|
145
|
+ new SqlParameter("@F_DeleteOn", SqlDbType.DateTime),
|
|
|
146
|
+ new SqlParameter("@F_CustomerId", SqlDbType.Int,4)};
|
|
|
147
|
+ parameters[0].Value = model.F_CustomerName;
|
|
|
148
|
+ parameters[1].Value = model.F_CustomerCode;
|
|
|
149
|
+ parameters[2].Value = model.F_Layer;
|
|
|
150
|
+ parameters[3].Value = model.F_Province;
|
|
|
151
|
+ parameters[4].Value = model.F_City;
|
|
|
152
|
+ parameters[5].Value = model.F_County;
|
|
|
153
|
+ parameters[6].Value = model.F_Address;
|
|
|
154
|
+ parameters[7].Value = model.F_Telephone;
|
|
|
155
|
+ parameters[8].Value = model.F_Mobile;
|
|
|
156
|
+ parameters[9].Value = model.F_Fax;
|
|
|
157
|
+ parameters[10].Value = model.F_Email;
|
|
|
158
|
+ parameters[11].Value = model.F_PostCode;
|
|
|
159
|
+ parameters[12].Value = model.F_Sex;
|
|
|
160
|
+ parameters[13].Value = model.F_CreateBy;
|
|
|
161
|
+ parameters[14].Value = model.F_CreatedOn;
|
|
|
162
|
+ parameters[15].Value = model.F_ModifyBy;
|
|
|
163
|
+ parameters[16].Value = model.F_ModifiedOn;
|
|
|
164
|
+ parameters[17].Value = model.F_DeleteFlag;
|
|
|
165
|
+ parameters[18].Value = model.F_DeleteBy;
|
|
|
166
|
+ parameters[19].Value = model.F_DeleteOn;
|
|
|
167
|
+ parameters[20].Value = model.F_CustomerId;
|
|
|
168
|
+
|
|
|
169
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
|
170
|
+ if (rows > 0)
|
|
|
171
|
+ {
|
|
|
172
|
+ return true;
|
|
|
173
|
+ }
|
|
|
174
|
+ else
|
|
|
175
|
+ {
|
|
|
176
|
+ return false;
|
|
|
177
|
+ }
|
|
|
178
|
+ }
|
|
|
179
|
+
|
|
|
180
|
+ /// <summary>
|
|
|
181
|
+ /// 删除一条数据
|
|
|
182
|
+ /// </summary>
|
|
|
183
|
+ public bool Delete(int F_CustomerId)
|
|
|
184
|
+ {
|
|
|
185
|
+
|
|
|
186
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
187
|
+ strSql.Append("delete from T_Cus_Customer ");
|
|
|
188
|
+ strSql.Append(" where F_CustomerId=@F_CustomerId");
|
|
|
189
|
+ SqlParameter[] parameters = {
|
|
|
190
|
+ new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
|
|
|
191
|
+ };
|
|
|
192
|
+ parameters[0].Value = F_CustomerId;
|
|
|
193
|
+
|
|
|
194
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
|
195
|
+ if (rows > 0)
|
|
|
196
|
+ {
|
|
|
197
|
+ return true;
|
|
|
198
|
+ }
|
|
|
199
|
+ else
|
|
|
200
|
+ {
|
|
|
201
|
+ return false;
|
|
|
202
|
+ }
|
|
|
203
|
+ }
|
|
|
204
|
+ /// <summary>
|
|
|
205
|
+ /// 批量删除数据
|
|
|
206
|
+ /// </summary>
|
|
|
207
|
+ public bool DeleteList(string F_CustomerIdlist)
|
|
|
208
|
+ {
|
|
|
209
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
210
|
+ strSql.Append("delete from T_Cus_Customer ");
|
|
|
211
|
+ strSql.Append(" where F_CustomerId in (" + F_CustomerIdlist + ") ");
|
|
|
212
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
|
|
|
213
|
+ if (rows > 0)
|
|
|
214
|
+ {
|
|
|
215
|
+ return true;
|
|
|
216
|
+ }
|
|
|
217
|
+ else
|
|
|
218
|
+ {
|
|
|
219
|
+ return false;
|
|
|
220
|
+ }
|
|
|
221
|
+ }
|
|
|
222
|
+
|
|
|
223
|
+
|
|
|
224
|
+ /// <summary>
|
|
|
225
|
+ /// 得到一个对象实体
|
|
|
226
|
+ /// </summary>
|
|
|
227
|
+ public RMYY_CallCenter_Api.Model.T_Cus_Customer GetModel(int F_CustomerId)
|
|
|
228
|
+ {
|
|
|
229
|
+
|
|
|
230
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
231
|
+ strSql.Append("select top 1 F_CustomerId,F_CustomerName,F_CustomerCode,F_Layer,F_Province,F_City,F_County,F_Address,F_Telephone,F_Mobile,F_Fax,F_Email,F_PostCode,F_Sex,F_CreateBy,F_CreatedOn,F_ModifyBy,F_ModifiedOn,F_DeleteFlag,F_DeleteBy,F_DeleteOn from T_Cus_Customer with(nolock)");
|
|
|
232
|
+ strSql.Append(" where F_CustomerId=@F_CustomerId");
|
|
|
233
|
+ SqlParameter[] parameters = {
|
|
|
234
|
+ new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
|
|
|
235
|
+ };
|
|
|
236
|
+ parameters[0].Value = F_CustomerId;
|
|
|
237
|
+
|
|
|
238
|
+ RMYY_CallCenter_Api.Model.T_Cus_Customer model = new RMYY_CallCenter_Api.Model.T_Cus_Customer();
|
|
|
239
|
+ DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
|
|
|
240
|
+ if (ds.Tables[0].Rows.Count > 0)
|
|
|
241
|
+ {
|
|
|
242
|
+ return DataRowToModel(ds.Tables[0].Rows[0]);
|
|
|
243
|
+ }
|
|
|
244
|
+ else
|
|
|
245
|
+ {
|
|
|
246
|
+ return null;
|
|
|
247
|
+ }
|
|
|
248
|
+ }
|
|
|
249
|
+
|
|
|
250
|
+
|
|
|
251
|
+ /// <summary>
|
|
|
252
|
+ /// 得到一个对象实体
|
|
|
253
|
+ /// </summary>
|
|
|
254
|
+ public RMYY_CallCenter_Api.Model.T_Cus_Customer DataRowToModel(DataRow row)
|
|
|
255
|
+ {
|
|
|
256
|
+ RMYY_CallCenter_Api.Model.T_Cus_Customer model = new RMYY_CallCenter_Api.Model.T_Cus_Customer();
|
|
|
257
|
+ if (row != null)
|
|
|
258
|
+ {
|
|
|
259
|
+ if (row["F_CustomerId"] != null && row["F_CustomerId"].ToString() != "")
|
|
|
260
|
+ {
|
|
|
261
|
+ model.F_CustomerId = int.Parse(row["F_CustomerId"].ToString());
|
|
|
262
|
+ }
|
|
|
263
|
+ if (row["F_CustomerName"] != null)
|
|
|
264
|
+ {
|
|
|
265
|
+ model.F_CustomerName = row["F_CustomerName"].ToString();
|
|
|
266
|
+ }
|
|
|
267
|
+ if (row["F_CustomerCode"] != null)
|
|
|
268
|
+ {
|
|
|
269
|
+ model.F_CustomerCode = row["F_CustomerCode"].ToString();
|
|
|
270
|
+ }
|
|
|
271
|
+ if (row["F_Layer"] != null && row["F_Layer"].ToString() != "")
|
|
|
272
|
+ {
|
|
|
273
|
+ model.F_Layer = int.Parse(row["F_Layer"].ToString());
|
|
|
274
|
+ }
|
|
|
275
|
+ if (row["F_Province"] != null)
|
|
|
276
|
+ {
|
|
|
277
|
+ model.F_Province = row["F_Province"].ToString();
|
|
|
278
|
+ }
|
|
|
279
|
+ if (row["F_City"] != null)
|
|
|
280
|
+ {
|
|
|
281
|
+ model.F_City = row["F_City"].ToString();
|
|
|
282
|
+ }
|
|
|
283
|
+ if (row["F_County"] != null)
|
|
|
284
|
+ {
|
|
|
285
|
+ model.F_County = row["F_County"].ToString();
|
|
|
286
|
+ }
|
|
|
287
|
+ if (row["F_Address"] != null)
|
|
|
288
|
+ {
|
|
|
289
|
+ model.F_Address = row["F_Address"].ToString();
|
|
|
290
|
+ }
|
|
|
291
|
+ if (row["F_Telephone"] != null)
|
|
|
292
|
+ {
|
|
|
293
|
+ model.F_Telephone = row["F_Telephone"].ToString();
|
|
|
294
|
+ }
|
|
|
295
|
+ if (row["F_Mobile"] != null)
|
|
|
296
|
+ {
|
|
|
297
|
+ model.F_Mobile = row["F_Mobile"].ToString();
|
|
|
298
|
+ }
|
|
|
299
|
+ if (row["F_Fax"] != null)
|
|
|
300
|
+ {
|
|
|
301
|
+ model.F_Fax = row["F_Fax"].ToString();
|
|
|
302
|
+ }
|
|
|
303
|
+ if (row["F_Email"] != null)
|
|
|
304
|
+ {
|
|
|
305
|
+ model.F_Email = row["F_Email"].ToString();
|
|
|
306
|
+ }
|
|
|
307
|
+ if (row["F_PostCode"] != null)
|
|
|
308
|
+ {
|
|
|
309
|
+ model.F_PostCode = row["F_PostCode"].ToString();
|
|
|
310
|
+ }
|
|
|
311
|
+ if (row["F_Sex"] != null)
|
|
|
312
|
+ {
|
|
|
313
|
+ model.F_Sex = row["F_Sex"].ToString();
|
|
|
314
|
+ }
|
|
|
315
|
+ if (row["F_CreateBy"] != null)
|
|
|
316
|
+ {
|
|
|
317
|
+ model.F_CreateBy = row["F_CreateBy"].ToString();
|
|
|
318
|
+ }
|
|
|
319
|
+ if (row["F_CreatedOn"] != null && row["F_CreatedOn"].ToString() != "")
|
|
|
320
|
+ {
|
|
|
321
|
+ model.F_CreatedOn = DateTime.Parse(row["F_CreatedOn"].ToString());
|
|
|
322
|
+ }
|
|
|
323
|
+ if (row["F_ModifyBy"] != null)
|
|
|
324
|
+ {
|
|
|
325
|
+ model.F_ModifyBy = row["F_ModifyBy"].ToString();
|
|
|
326
|
+ }
|
|
|
327
|
+ if (row["F_ModifiedOn"] != null && row["F_ModifiedOn"].ToString() != "")
|
|
|
328
|
+ {
|
|
|
329
|
+ model.F_ModifiedOn = DateTime.Parse(row["F_ModifiedOn"].ToString());
|
|
|
330
|
+ }
|
|
|
331
|
+ if (row["F_DeleteFlag"] != null && row["F_DeleteFlag"].ToString() != "")
|
|
|
332
|
+ {
|
|
|
333
|
+ model.F_DeleteFlag = int.Parse(row["F_DeleteFlag"].ToString());
|
|
|
334
|
+ }
|
|
|
335
|
+ if (row["F_DeleteBy"] != null)
|
|
|
336
|
+ {
|
|
|
337
|
+ model.F_DeleteBy = row["F_DeleteBy"].ToString();
|
|
|
338
|
+ }
|
|
|
339
|
+ if (row["F_DeleteOn"] != null && row["F_DeleteOn"].ToString() != "")
|
|
|
340
|
+ {
|
|
|
341
|
+ model.F_DeleteOn = DateTime.Parse(row["F_DeleteOn"].ToString());
|
|
|
342
|
+ }
|
|
|
343
|
+ }
|
|
|
344
|
+ return model;
|
|
|
345
|
+ }
|
|
|
346
|
+
|
|
|
347
|
+ /// <summary>
|
|
|
348
|
+ /// 获得数据列表
|
|
|
349
|
+ /// </summary>
|
|
|
350
|
+ public DataSet GetList(string strWhere)
|
|
|
351
|
+ {
|
|
|
352
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
353
|
+ strSql.Append("select F_CustomerId,F_CustomerName,F_CustomerCode,F_Layer,F_Province,F_City,F_County,F_Address,F_Telephone,F_Mobile,F_Fax,F_Email,F_PostCode,F_Sex,F_CreateBy,F_CreatedOn,F_ModifyBy,F_ModifiedOn,F_DeleteFlag,F_DeleteBy,F_DeleteOn ");
|
|
|
354
|
+ strSql.Append(" FROM T_Cus_Customer with(nolock)");
|
|
|
355
|
+ if (strWhere.Trim() != "")
|
|
|
356
|
+ {
|
|
|
357
|
+ strSql.Append(" where " + strWhere);
|
|
|
358
|
+ }
|
|
|
359
|
+ return DbHelperSQL.Query(strSql.ToString());
|
|
|
360
|
+ }
|
|
|
361
|
+
|
|
|
362
|
+ /// <summary>
|
|
|
363
|
+ /// 获得前几行数据
|
|
|
364
|
+ /// </summary>
|
|
|
365
|
+ public DataSet GetList(int Top, string strWhere, string filedOrder)
|
|
|
366
|
+ {
|
|
|
367
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
368
|
+ strSql.Append("select ");
|
|
|
369
|
+ if (Top > 0)
|
|
|
370
|
+ {
|
|
|
371
|
+ strSql.Append(" top " + Top.ToString());
|
|
|
372
|
+ }
|
|
|
373
|
+ strSql.Append(" F_CustomerId,F_CustomerName,F_CustomerCode,F_Layer,F_Province,F_City,F_County,F_Address,F_Telephone,F_Mobile,F_Fax,F_Email,F_PostCode,F_Sex,F_CreateBy,F_CreatedOn,F_ModifyBy,F_ModifiedOn,F_DeleteFlag,F_DeleteBy,F_DeleteOn ");
|
|
|
374
|
+ strSql.Append(" FROM T_Cus_Customer with(nolock)");
|
|
|
375
|
+ if (strWhere.Trim() != "")
|
|
|
376
|
+ {
|
|
|
377
|
+ strSql.Append(" where " + strWhere);
|
|
|
378
|
+ }
|
|
|
379
|
+ strSql.Append(" order by " + filedOrder);
|
|
|
380
|
+ return DbHelperSQL.Query(strSql.ToString());
|
|
|
381
|
+ }
|
|
|
382
|
+
|
|
|
383
|
+ /// <summary>
|
|
|
384
|
+ /// 获取记录总数
|
|
|
385
|
+ /// </summary>
|
|
|
386
|
+ public int GetRecordCount(string strWhere)
|
|
|
387
|
+ {
|
|
|
388
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
389
|
+ strSql.Append("select count(1) FROM T_Cus_Customer with(nolock)");
|
|
|
390
|
+ if (strWhere.Trim() != "")
|
|
|
391
|
+ {
|
|
|
392
|
+ strSql.Append(" where " + strWhere);
|
|
|
393
|
+ }
|
|
|
394
|
+ object obj = DbHelperSQL.GetSingle(strSql.ToString());
|
|
|
395
|
+ if (obj == null)
|
|
|
396
|
+ {
|
|
|
397
|
+ return 0;
|
|
|
398
|
+ }
|
|
|
399
|
+ else
|
|
|
400
|
+ {
|
|
|
401
|
+ return Convert.ToInt32(obj);
|
|
|
402
|
+ }
|
|
|
403
|
+ }
|
|
|
404
|
+
|
|
|
405
|
+ #endregion BasicMethod
|
|
|
406
|
+ }
|
|
|
407
|
+}
|
|
|
408
|
+
|