|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+using CallCenterApi.DB;
|
|
|
2
|
+using System;
|
|
|
3
|
+using System.Collections.Generic;
|
|
|
4
|
+using System.Data;
|
|
|
5
|
+using System.Data.SqlClient;
|
|
|
6
|
+using System.Linq;
|
|
|
7
|
+using System.Text;
|
|
|
8
|
+using System.Threading.Tasks;
|
|
|
9
|
+
|
|
|
10
|
+namespace CallCenterApi.DAL
|
|
|
11
|
+{
|
|
|
12
|
+ /// <summary>
|
|
|
13
|
+ /// 数据访问类:T_Sys_IVRWords
|
|
|
14
|
+ /// </summary>
|
|
|
15
|
+ public partial class T_Sys_IVRWords
|
|
|
16
|
+ {
|
|
|
17
|
+ public T_Sys_IVRWords()
|
|
|
18
|
+ { }
|
|
|
19
|
+ #region BasicMethod
|
|
|
20
|
+
|
|
|
21
|
+
|
|
|
22
|
+ /// <summary>
|
|
|
23
|
+ /// 增加一条数据
|
|
|
24
|
+ /// </summary>
|
|
|
25
|
+ public int Add(CallCenterApi.Model.T_Sys_IVRWords model)
|
|
|
26
|
+ {
|
|
|
27
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
28
|
+ strSql.Append("insert into T_Sys_IVRWords(");
|
|
|
29
|
+ strSql.Append("F_Title,F_Content,F_Type,F_WavOldName,F_WavNewName,F_WavPath,F_StartDate,F_EndDate,F_Remark,F_IsState,F_CreateTime,F_CreateUser,F_IsDel)");
|
|
|
30
|
+ strSql.Append(" values (");
|
|
|
31
|
+ strSql.Append("@F_Title,@F_Content,@F_Type,@F_WavOldName,@F_WavNewName,@F_WavPath,@F_StartDate,@F_EndDate,@F_Remark,@F_IsState,@F_CreateTime,@F_CreateUser,@F_IsDel)");
|
|
|
32
|
+ strSql.Append(";select @@IDENTITY");
|
|
|
33
|
+ SqlParameter[] parameters = {
|
|
|
34
|
+ new SqlParameter("@F_Title", SqlDbType.NVarChar,500),
|
|
|
35
|
+ new SqlParameter("@F_Content", SqlDbType.NText),
|
|
|
36
|
+ new SqlParameter("@F_Type", SqlDbType.Int,4),
|
|
|
37
|
+ new SqlParameter("@F_WavOldName", SqlDbType.NVarChar,500),
|
|
|
38
|
+ new SqlParameter("@F_WavNewName", SqlDbType.NVarChar,500),
|
|
|
39
|
+ new SqlParameter("@F_WavPath", SqlDbType.NText),
|
|
|
40
|
+ new SqlParameter("@F_StartDate", SqlDbType.DateTime),
|
|
|
41
|
+ new SqlParameter("@F_EndDate", SqlDbType.DateTime),
|
|
|
42
|
+ new SqlParameter("@F_Remark", SqlDbType.NText),
|
|
|
43
|
+ new SqlParameter("@F_IsState", SqlDbType.Int,4),
|
|
|
44
|
+ new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
|
|
|
45
|
+ new SqlParameter("@F_CreateUser", SqlDbType.NVarChar,50),
|
|
|
46
|
+ new SqlParameter("@F_IsDel", SqlDbType.Int,4)};
|
|
|
47
|
+ parameters[0].Value = model.F_Title;
|
|
|
48
|
+ parameters[1].Value = model.F_Content;
|
|
|
49
|
+ parameters[2].Value = model.F_Type;
|
|
|
50
|
+ parameters[3].Value = model.F_WavOldName;
|
|
|
51
|
+ parameters[4].Value = model.F_WavNewName;
|
|
|
52
|
+ parameters[5].Value = model.F_WavPath;
|
|
|
53
|
+ parameters[6].Value = model.F_StartDate;
|
|
|
54
|
+ parameters[7].Value = model.F_EndDate;
|
|
|
55
|
+ parameters[8].Value = model.F_Remark;
|
|
|
56
|
+ parameters[9].Value = model.F_IsState;
|
|
|
57
|
+ parameters[10].Value = model.F_CreateTime;
|
|
|
58
|
+ parameters[11].Value = model.F_CreateUser;
|
|
|
59
|
+ parameters[12].Value = model.F_IsDel;
|
|
|
60
|
+
|
|
|
61
|
+ object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
|
|
|
62
|
+ if (obj == null)
|
|
|
63
|
+ {
|
|
|
64
|
+ return 0;
|
|
|
65
|
+ }
|
|
|
66
|
+ else
|
|
|
67
|
+ {
|
|
|
68
|
+ return Convert.ToInt32(obj);
|
|
|
69
|
+ }
|
|
|
70
|
+ }
|
|
|
71
|
+ /// <summary>
|
|
|
72
|
+ /// 更新一条数据
|
|
|
73
|
+ /// </summary>
|
|
|
74
|
+ public bool Update(CallCenterApi.Model.T_Sys_IVRWords model)
|
|
|
75
|
+ {
|
|
|
76
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
77
|
+ strSql.Append("update T_Sys_IVRWords set ");
|
|
|
78
|
+ strSql.Append("F_Title=@F_Title,");
|
|
|
79
|
+ strSql.Append("F_Content=@F_Content,");
|
|
|
80
|
+ strSql.Append("F_Type=@F_Type,");
|
|
|
81
|
+ strSql.Append("F_WavOldName=@F_WavOldName,");
|
|
|
82
|
+ strSql.Append("F_WavNewName=@F_WavNewName,");
|
|
|
83
|
+ strSql.Append("F_WavPath=@F_WavPath,");
|
|
|
84
|
+ strSql.Append("F_StartDate=@F_StartDate,");
|
|
|
85
|
+ strSql.Append("F_EndDate=@F_EndDate,");
|
|
|
86
|
+ strSql.Append("F_Remark=@F_Remark,");
|
|
|
87
|
+ strSql.Append("F_IsState=@F_IsState,");
|
|
|
88
|
+ strSql.Append("F_CreateTime=@F_CreateTime,");
|
|
|
89
|
+ strSql.Append("F_CreateUser=@F_CreateUser,");
|
|
|
90
|
+ strSql.Append("F_IsDel=@F_IsDel");
|
|
|
91
|
+ strSql.Append(" where F_ID=@F_ID");
|
|
|
92
|
+ SqlParameter[] parameters = {
|
|
|
93
|
+ new SqlParameter("@F_Title", SqlDbType.NVarChar,500),
|
|
|
94
|
+ new SqlParameter("@F_Content", SqlDbType.NText),
|
|
|
95
|
+ new SqlParameter("@F_Type", SqlDbType.Int,4),
|
|
|
96
|
+ new SqlParameter("@F_WavOldName", SqlDbType.NVarChar,500),
|
|
|
97
|
+ new SqlParameter("@F_WavNewName", SqlDbType.NVarChar,500),
|
|
|
98
|
+ new SqlParameter("@F_WavPath", SqlDbType.NText),
|
|
|
99
|
+ new SqlParameter("@F_StartDate", SqlDbType.DateTime),
|
|
|
100
|
+ new SqlParameter("@F_EndDate", SqlDbType.DateTime),
|
|
|
101
|
+ new SqlParameter("@F_Remark", SqlDbType.NText),
|
|
|
102
|
+ new SqlParameter("@F_IsState", SqlDbType.Int,4),
|
|
|
103
|
+ new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
|
|
|
104
|
+ new SqlParameter("@F_CreateUser", SqlDbType.NVarChar,50),
|
|
|
105
|
+ new SqlParameter("@F_IsDel", SqlDbType.Int,4),
|
|
|
106
|
+ new SqlParameter("@F_ID", SqlDbType.Int,4)};
|
|
|
107
|
+ parameters[0].Value = model.F_Title;
|
|
|
108
|
+ parameters[1].Value = model.F_Content;
|
|
|
109
|
+ parameters[2].Value = model.F_Type;
|
|
|
110
|
+ parameters[3].Value = model.F_WavOldName;
|
|
|
111
|
+ parameters[4].Value = model.F_WavNewName;
|
|
|
112
|
+ parameters[5].Value = model.F_WavPath;
|
|
|
113
|
+ parameters[6].Value = model.F_StartDate;
|
|
|
114
|
+ parameters[7].Value = model.F_EndDate;
|
|
|
115
|
+ parameters[8].Value = model.F_Remark;
|
|
|
116
|
+ parameters[9].Value = model.F_IsState;
|
|
|
117
|
+ parameters[10].Value = model.F_CreateTime;
|
|
|
118
|
+ parameters[11].Value = model.F_CreateUser;
|
|
|
119
|
+ parameters[12].Value = model.F_IsDel;
|
|
|
120
|
+ parameters[13].Value = model.F_ID;
|
|
|
121
|
+
|
|
|
122
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
|
123
|
+ if (rows > 0)
|
|
|
124
|
+ {
|
|
|
125
|
+ return true;
|
|
|
126
|
+ }
|
|
|
127
|
+ else
|
|
|
128
|
+ {
|
|
|
129
|
+ return false;
|
|
|
130
|
+ }
|
|
|
131
|
+ }
|
|
|
132
|
+
|
|
|
133
|
+ /// <summary>
|
|
|
134
|
+ /// 删除一条数据
|
|
|
135
|
+ /// </summary>
|
|
|
136
|
+ public bool Delete(int F_ID)
|
|
|
137
|
+ {
|
|
|
138
|
+
|
|
|
139
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
140
|
+ strSql.Append("delete from T_Sys_IVRWords ");
|
|
|
141
|
+ strSql.Append(" where F_ID=@F_ID");
|
|
|
142
|
+ SqlParameter[] parameters = {
|
|
|
143
|
+ new SqlParameter("@F_ID", SqlDbType.Int,4)
|
|
|
144
|
+ };
|
|
|
145
|
+ parameters[0].Value = F_ID;
|
|
|
146
|
+
|
|
|
147
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
|
148
|
+ if (rows > 0)
|
|
|
149
|
+ {
|
|
|
150
|
+ return true;
|
|
|
151
|
+ }
|
|
|
152
|
+ else
|
|
|
153
|
+ {
|
|
|
154
|
+ return false;
|
|
|
155
|
+ }
|
|
|
156
|
+ }
|
|
|
157
|
+ /// <summary>
|
|
|
158
|
+ /// 批量删除数据
|
|
|
159
|
+ /// </summary>
|
|
|
160
|
+ public bool DeleteList(string F_IDlist)
|
|
|
161
|
+ {
|
|
|
162
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
163
|
+ strSql.Append("delete from T_Sys_IVRWords ");
|
|
|
164
|
+ strSql.Append(" where F_ID in (" + F_IDlist + ") ");
|
|
|
165
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
|
|
|
166
|
+ if (rows > 0)
|
|
|
167
|
+ {
|
|
|
168
|
+ return true;
|
|
|
169
|
+ }
|
|
|
170
|
+ else
|
|
|
171
|
+ {
|
|
|
172
|
+ return false;
|
|
|
173
|
+ }
|
|
|
174
|
+ }
|
|
|
175
|
+
|
|
|
176
|
+
|
|
|
177
|
+ /// <summary>
|
|
|
178
|
+ /// 得到一个对象实体
|
|
|
179
|
+ /// </summary>
|
|
|
180
|
+ public CallCenterApi.Model.T_Sys_IVRWords GetModel(int F_ID)
|
|
|
181
|
+ {
|
|
|
182
|
+
|
|
|
183
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
184
|
+ strSql.Append("select top 1 * from T_Sys_IVRWords ");
|
|
|
185
|
+ strSql.Append(" where F_ID=@F_ID");
|
|
|
186
|
+ SqlParameter[] parameters = {
|
|
|
187
|
+ new SqlParameter("@F_ID", SqlDbType.Int,4)
|
|
|
188
|
+ };
|
|
|
189
|
+ parameters[0].Value = F_ID;
|
|
|
190
|
+
|
|
|
191
|
+ CallCenterApi.Model.T_Sys_IVRWords model = new CallCenterApi.Model.T_Sys_IVRWords();
|
|
|
192
|
+ DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
|
|
|
193
|
+ if (ds.Tables[0].Rows.Count > 0)
|
|
|
194
|
+ {
|
|
|
195
|
+ return DataRowToModel(ds.Tables[0].Rows[0]);
|
|
|
196
|
+ }
|
|
|
197
|
+ else
|
|
|
198
|
+ {
|
|
|
199
|
+ return null;
|
|
|
200
|
+ }
|
|
|
201
|
+ }
|
|
|
202
|
+
|
|
|
203
|
+
|
|
|
204
|
+ /// <summary>
|
|
|
205
|
+ /// 得到一个对象实体
|
|
|
206
|
+ /// </summary>
|
|
|
207
|
+ public CallCenterApi.Model.T_Sys_IVRWords DataRowToModel(DataRow row)
|
|
|
208
|
+ {
|
|
|
209
|
+ CallCenterApi.Model.T_Sys_IVRWords model = new CallCenterApi.Model.T_Sys_IVRWords();
|
|
|
210
|
+ if (row != null)
|
|
|
211
|
+ {
|
|
|
212
|
+ if (row["F_ID"] != null && row["F_ID"].ToString() != "")
|
|
|
213
|
+ {
|
|
|
214
|
+ model.F_ID = int.Parse(row["F_ID"].ToString());
|
|
|
215
|
+ }
|
|
|
216
|
+ if (row["F_Title"] != null)
|
|
|
217
|
+ {
|
|
|
218
|
+ model.F_Title = row["F_Title"].ToString();
|
|
|
219
|
+ }
|
|
|
220
|
+ if (row["F_Content"] != null)
|
|
|
221
|
+ {
|
|
|
222
|
+ model.F_Content = row["F_Content"].ToString();
|
|
|
223
|
+ }
|
|
|
224
|
+ if (row["F_Type"] != null && row["F_Type"].ToString() != "")
|
|
|
225
|
+ {
|
|
|
226
|
+ model.F_Type = int.Parse(row["F_Type"].ToString());
|
|
|
227
|
+ }
|
|
|
228
|
+ if (row["F_WavOldName"] != null)
|
|
|
229
|
+ {
|
|
|
230
|
+ model.F_WavOldName = row["F_WavOldName"].ToString();
|
|
|
231
|
+ }
|
|
|
232
|
+ if (row["F_WavNewName"] != null)
|
|
|
233
|
+ {
|
|
|
234
|
+ model.F_WavNewName = row["F_WavNewName"].ToString();
|
|
|
235
|
+ }
|
|
|
236
|
+ if (row["F_WavPath"] != null)
|
|
|
237
|
+ {
|
|
|
238
|
+ model.F_WavPath = row["F_WavPath"].ToString();
|
|
|
239
|
+ }
|
|
|
240
|
+ if (row["F_StartDate"] != null && row["F_StartDate"].ToString() != "")
|
|
|
241
|
+ {
|
|
|
242
|
+ model.F_StartDate = DateTime.Parse(row["F_StartDate"].ToString());
|
|
|
243
|
+ }
|
|
|
244
|
+ if (row["F_EndDate"] != null && row["F_EndDate"].ToString() != "")
|
|
|
245
|
+ {
|
|
|
246
|
+ model.F_EndDate = DateTime.Parse(row["F_EndDate"].ToString());
|
|
|
247
|
+ }
|
|
|
248
|
+ if (row["F_Remark"] != null)
|
|
|
249
|
+ {
|
|
|
250
|
+ model.F_Remark = row["F_Remark"].ToString();
|
|
|
251
|
+ }
|
|
|
252
|
+ if (row["F_IsState"] != null && row["F_IsState"].ToString() != "")
|
|
|
253
|
+ {
|
|
|
254
|
+ model.F_IsState = int.Parse(row["F_IsState"].ToString());
|
|
|
255
|
+ }
|
|
|
256
|
+ if (row["F_CreateTime"] != null && row["F_CreateTime"].ToString() != "")
|
|
|
257
|
+ {
|
|
|
258
|
+ model.F_CreateTime = DateTime.Parse(row["F_CreateTime"].ToString());
|
|
|
259
|
+ }
|
|
|
260
|
+ if (row["F_CreateUser"] != null)
|
|
|
261
|
+ {
|
|
|
262
|
+ model.F_CreateUser = row["F_CreateUser"].ToString();
|
|
|
263
|
+ }
|
|
|
264
|
+ if (row["F_IsDel"] != null && row["F_IsDel"].ToString() != "")
|
|
|
265
|
+ {
|
|
|
266
|
+ model.F_IsDel = int.Parse(row["F_IsDel"].ToString());
|
|
|
267
|
+ }
|
|
|
268
|
+ }
|
|
|
269
|
+ return model;
|
|
|
270
|
+ }
|
|
|
271
|
+
|
|
|
272
|
+ /// <summary>
|
|
|
273
|
+ /// 获得数据列表
|
|
|
274
|
+ /// </summary>
|
|
|
275
|
+ public DataSet GetList(string strWhere)
|
|
|
276
|
+ {
|
|
|
277
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
278
|
+ strSql.Append("select * ");
|
|
|
279
|
+ strSql.Append(" FROM T_Sys_IVRWords ");
|
|
|
280
|
+ if (strWhere.Trim() != "")
|
|
|
281
|
+ {
|
|
|
282
|
+ strSql.Append(" where " + strWhere);
|
|
|
283
|
+ }
|
|
|
284
|
+ return DbHelperSQL.Query(strSql.ToString());
|
|
|
285
|
+ }
|
|
|
286
|
+
|
|
|
287
|
+ /// <summary>
|
|
|
288
|
+ /// 获得前几行数据
|
|
|
289
|
+ /// </summary>
|
|
|
290
|
+ public DataSet GetList(int Top, string strWhere, string filedOrder)
|
|
|
291
|
+ {
|
|
|
292
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
293
|
+ strSql.Append("select ");
|
|
|
294
|
+ if (Top > 0)
|
|
|
295
|
+ {
|
|
|
296
|
+ strSql.Append(" top " + Top.ToString());
|
|
|
297
|
+ }
|
|
|
298
|
+ strSql.Append(" * ");
|
|
|
299
|
+ strSql.Append(" FROM T_Sys_IVRWords ");
|
|
|
300
|
+ if (strWhere.Trim() != "")
|
|
|
301
|
+ {
|
|
|
302
|
+ strSql.Append(" where " + strWhere);
|
|
|
303
|
+ }
|
|
|
304
|
+ strSql.Append(" order by " + filedOrder);
|
|
|
305
|
+ return DbHelperSQL.Query(strSql.ToString());
|
|
|
306
|
+ }
|
|
|
307
|
+
|
|
|
308
|
+ /// <summary>
|
|
|
309
|
+ /// 获取记录总数
|
|
|
310
|
+ /// </summary>
|
|
|
311
|
+ public int GetRecordCount(string strWhere)
|
|
|
312
|
+ {
|
|
|
313
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
314
|
+ strSql.Append("select count(1) FROM T_Sys_IVRWords ");
|
|
|
315
|
+ if (strWhere.Trim() != "")
|
|
|
316
|
+ {
|
|
|
317
|
+ strSql.Append(" where " + strWhere);
|
|
|
318
|
+ }
|
|
|
319
|
+ object obj = DbHelperSQL.GetSingle(strSql.ToString());
|
|
|
320
|
+ if (obj == null)
|
|
|
321
|
+ {
|
|
|
322
|
+ return 0;
|
|
|
323
|
+ }
|
|
|
324
|
+ else
|
|
|
325
|
+ {
|
|
|
326
|
+ return Convert.ToInt32(obj);
|
|
|
327
|
+ }
|
|
|
328
|
+ }
|
|
|
329
|
+ /// <summary>
|
|
|
330
|
+ /// 分页获取数据列表
|
|
|
331
|
+ /// </summary>
|
|
|
332
|
+ public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
|
|
|
333
|
+ {
|
|
|
334
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
335
|
+ strSql.Append("SELECT * FROM ( ");
|
|
|
336
|
+ strSql.Append(" SELECT ROW_NUMBER() OVER (");
|
|
|
337
|
+ if (!string.IsNullOrEmpty(orderby.Trim()))
|
|
|
338
|
+ {
|
|
|
339
|
+ strSql.Append("order by T." + orderby);
|
|
|
340
|
+ }
|
|
|
341
|
+ else
|
|
|
342
|
+ {
|
|
|
343
|
+ strSql.Append("order by T.F_ID desc");
|
|
|
344
|
+ }
|
|
|
345
|
+ strSql.Append(")AS Row, T.* from T_Sys_IVRWords T ");
|
|
|
346
|
+ if (!string.IsNullOrEmpty(strWhere.Trim()))
|
|
|
347
|
+ {
|
|
|
348
|
+ strSql.Append(" WHERE " + strWhere);
|
|
|
349
|
+ }
|
|
|
350
|
+ strSql.Append(" ) TT");
|
|
|
351
|
+ strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
|
|
|
352
|
+ return DbHelperSQL.Query(strSql.ToString());
|
|
|
353
|
+ }
|
|
|
354
|
+
|
|
|
355
|
+ #endregion BasicMethod
|
|
|
356
|
+ #region ExtensionMethod
|
|
|
357
|
+
|
|
|
358
|
+ #endregion ExtensionMethod
|
|
|
359
|
+ }
|
|
|
360
|
+}
|