|
|
@@ -0,0 +1,294 @@
|
|
|
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_Sys_SeatGroup
|
|
|
11
|
+ /// </summary>
|
|
|
12
|
+ public partial class T_Sys_SeatGroup
|
|
|
13
|
+ {
|
|
|
14
|
+ public T_Sys_SeatGroup()
|
|
|
15
|
+ { }
|
|
|
16
|
+ #region BasicMethod
|
|
|
17
|
+
|
|
|
18
|
+
|
|
|
19
|
+ /// <summary>
|
|
|
20
|
+ /// 增加一条数据
|
|
|
21
|
+ /// </summary>
|
|
|
22
|
+ public int Add(RMYY_CallCenter_Api.Model.T_Sys_SeatGroup model)
|
|
|
23
|
+ {
|
|
|
24
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
25
|
+ strSql.Append("insert into T_Sys_SeatGroup(");
|
|
|
26
|
+ strSql.Append("F_ZXZCode,F_ZXZName,F_IVRKey,F_WHBDKey,F_WHWDKey,F_ZXAtt,F_Des,F_CreateTime,F_CreateUser)");
|
|
|
27
|
+ strSql.Append(" values (");
|
|
|
28
|
+ strSql.Append("@F_ZXZCode,@F_ZXZName,@F_IVRKey,@F_WHBDKey,@F_WHWDKey,@F_ZXAtt,@F_Des,@F_CreateTime,@F_CreateUser)");
|
|
|
29
|
+ strSql.Append(";select @@IDENTITY");
|
|
|
30
|
+ SqlParameter[] parameters = {
|
|
|
31
|
+ new SqlParameter("@F_ZXZCode", SqlDbType.NVarChar,50),
|
|
|
32
|
+ new SqlParameter("@F_ZXZName", SqlDbType.NVarChar,50),
|
|
|
33
|
+ new SqlParameter("@F_IVRKey", SqlDbType.Int,4),
|
|
|
34
|
+ new SqlParameter("@F_WHBDKey", SqlDbType.NChar,10),
|
|
|
35
|
+ new SqlParameter("@F_WHWDKey", SqlDbType.NChar,10),
|
|
|
36
|
+ new SqlParameter("@F_ZXAtt", SqlDbType.NVarChar,50),
|
|
|
37
|
+ new SqlParameter("@F_Des", SqlDbType.NText),
|
|
|
38
|
+ new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
|
|
|
39
|
+ new SqlParameter("@F_CreateUser", SqlDbType.VarChar,50)};
|
|
|
40
|
+ parameters[0].Value = model.F_ZXZCode;
|
|
|
41
|
+ parameters[1].Value = model.F_ZXZName;
|
|
|
42
|
+ parameters[2].Value = model.F_IVRKey;
|
|
|
43
|
+ parameters[3].Value = model.F_WHBDKey;
|
|
|
44
|
+ parameters[4].Value = model.F_WHWDKey;
|
|
|
45
|
+ parameters[5].Value = model.F_ZXAtt;
|
|
|
46
|
+ parameters[6].Value = model.F_Des;
|
|
|
47
|
+ parameters[7].Value = model.F_CreateTime;
|
|
|
48
|
+ parameters[8].Value = model.F_CreateUser;
|
|
|
49
|
+
|
|
|
50
|
+ object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
|
|
|
51
|
+ if (obj == null)
|
|
|
52
|
+ {
|
|
|
53
|
+ return 0;
|
|
|
54
|
+ }
|
|
|
55
|
+ else
|
|
|
56
|
+ {
|
|
|
57
|
+ return Convert.ToInt32(obj);
|
|
|
58
|
+ }
|
|
|
59
|
+ }
|
|
|
60
|
+ /// <summary>
|
|
|
61
|
+ /// 更新一条数据
|
|
|
62
|
+ /// </summary>
|
|
|
63
|
+ public bool Update(RMYY_CallCenter_Api.Model.T_Sys_SeatGroup model)
|
|
|
64
|
+ {
|
|
|
65
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
66
|
+ strSql.Append("update T_Sys_SeatGroup set ");
|
|
|
67
|
+ strSql.Append("F_ZXZCode=@F_ZXZCode,");
|
|
|
68
|
+ strSql.Append("F_ZXZName=@F_ZXZName,");
|
|
|
69
|
+ strSql.Append("F_IVRKey=@F_IVRKey,");
|
|
|
70
|
+ strSql.Append("F_WHBDKey=@F_WHBDKey,");
|
|
|
71
|
+ strSql.Append("F_WHWDKey=@F_WHWDKey,");
|
|
|
72
|
+ strSql.Append("F_ZXAtt=@F_ZXAtt,");
|
|
|
73
|
+ strSql.Append("F_Des=@F_Des,");
|
|
|
74
|
+ strSql.Append("F_CreateTime=@F_CreateTime,");
|
|
|
75
|
+ strSql.Append("F_CreateUser=@F_CreateUser");
|
|
|
76
|
+ strSql.Append(" where F_ID=@F_ID");
|
|
|
77
|
+ SqlParameter[] parameters = {
|
|
|
78
|
+ new SqlParameter("@F_ZXZCode", SqlDbType.NVarChar,50),
|
|
|
79
|
+ new SqlParameter("@F_ZXZName", SqlDbType.NVarChar,50),
|
|
|
80
|
+ new SqlParameter("@F_IVRKey", SqlDbType.Int,4),
|
|
|
81
|
+ new SqlParameter("@F_WHBDKey", SqlDbType.NChar,10),
|
|
|
82
|
+ new SqlParameter("@F_WHWDKey", SqlDbType.NChar,10),
|
|
|
83
|
+ new SqlParameter("@F_ZXAtt", SqlDbType.NVarChar,50),
|
|
|
84
|
+ new SqlParameter("@F_Des", SqlDbType.NText),
|
|
|
85
|
+ new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
|
|
|
86
|
+ new SqlParameter("@F_CreateUser", SqlDbType.VarChar,50),
|
|
|
87
|
+ new SqlParameter("@F_ID", SqlDbType.Int,4)};
|
|
|
88
|
+ parameters[0].Value = model.F_ZXZCode;
|
|
|
89
|
+ parameters[1].Value = model.F_ZXZName;
|
|
|
90
|
+ parameters[2].Value = model.F_IVRKey;
|
|
|
91
|
+ parameters[3].Value = model.F_WHBDKey;
|
|
|
92
|
+ parameters[4].Value = model.F_WHWDKey;
|
|
|
93
|
+ parameters[5].Value = model.F_ZXAtt;
|
|
|
94
|
+ parameters[6].Value = model.F_Des;
|
|
|
95
|
+ parameters[7].Value = model.F_CreateTime;
|
|
|
96
|
+ parameters[8].Value = model.F_CreateUser;
|
|
|
97
|
+ parameters[9].Value = model.F_ID;
|
|
|
98
|
+
|
|
|
99
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
|
100
|
+ if (rows > 0)
|
|
|
101
|
+ {
|
|
|
102
|
+ return true;
|
|
|
103
|
+ }
|
|
|
104
|
+ else
|
|
|
105
|
+ {
|
|
|
106
|
+ return false;
|
|
|
107
|
+ }
|
|
|
108
|
+ }
|
|
|
109
|
+
|
|
|
110
|
+ /// <summary>
|
|
|
111
|
+ /// 删除一条数据
|
|
|
112
|
+ /// </summary>
|
|
|
113
|
+ public bool Delete(int F_ID)
|
|
|
114
|
+ {
|
|
|
115
|
+
|
|
|
116
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
117
|
+ strSql.Append("delete from T_Sys_SeatGroup ");
|
|
|
118
|
+ strSql.Append(" where F_ID=@F_ID");
|
|
|
119
|
+ SqlParameter[] parameters = {
|
|
|
120
|
+ new SqlParameter("@F_ID", SqlDbType.Int,4)
|
|
|
121
|
+ };
|
|
|
122
|
+ parameters[0].Value = F_ID;
|
|
|
123
|
+
|
|
|
124
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
|
125
|
+ if (rows > 0)
|
|
|
126
|
+ {
|
|
|
127
|
+ return true;
|
|
|
128
|
+ }
|
|
|
129
|
+ else
|
|
|
130
|
+ {
|
|
|
131
|
+ return false;
|
|
|
132
|
+ }
|
|
|
133
|
+ }
|
|
|
134
|
+ /// <summary>
|
|
|
135
|
+ /// 批量删除数据
|
|
|
136
|
+ /// </summary>
|
|
|
137
|
+ public bool DeleteList(string F_IDlist)
|
|
|
138
|
+ {
|
|
|
139
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
140
|
+ strSql.Append("delete from T_Sys_SeatGroup ");
|
|
|
141
|
+ strSql.Append(" where F_ID in (" + F_IDlist + ") ");
|
|
|
142
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
|
|
|
143
|
+ if (rows > 0)
|
|
|
144
|
+ {
|
|
|
145
|
+ return true;
|
|
|
146
|
+ }
|
|
|
147
|
+ else
|
|
|
148
|
+ {
|
|
|
149
|
+ return false;
|
|
|
150
|
+ }
|
|
|
151
|
+ }
|
|
|
152
|
+
|
|
|
153
|
+
|
|
|
154
|
+ /// <summary>
|
|
|
155
|
+ /// 得到一个对象实体
|
|
|
156
|
+ /// </summary>
|
|
|
157
|
+ public RMYY_CallCenter_Api.Model.T_Sys_SeatGroup GetModel(int F_ID)
|
|
|
158
|
+ {
|
|
|
159
|
+
|
|
|
160
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
161
|
+ strSql.Append("select top 1 F_ID,F_ZXZCode,F_ZXZName,F_IVRKey,F_WHBDKey,F_WHWDKey,F_ZXAtt,F_Des,F_CreateTime,F_CreateUser from T_Sys_SeatGroup with(nolock)");
|
|
|
162
|
+ strSql.Append(" where F_ID=@F_ID");
|
|
|
163
|
+ SqlParameter[] parameters = {
|
|
|
164
|
+ new SqlParameter("@F_ID", SqlDbType.Int,4)
|
|
|
165
|
+ };
|
|
|
166
|
+ parameters[0].Value = F_ID;
|
|
|
167
|
+
|
|
|
168
|
+ RMYY_CallCenter_Api.Model.T_Sys_SeatGroup model = new RMYY_CallCenter_Api.Model.T_Sys_SeatGroup();
|
|
|
169
|
+ DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
|
|
|
170
|
+ if (ds.Tables[0].Rows.Count > 0)
|
|
|
171
|
+ {
|
|
|
172
|
+ return DataRowToModel(ds.Tables[0].Rows[0]);
|
|
|
173
|
+ }
|
|
|
174
|
+ else
|
|
|
175
|
+ {
|
|
|
176
|
+ return null;
|
|
|
177
|
+ }
|
|
|
178
|
+ }
|
|
|
179
|
+
|
|
|
180
|
+
|
|
|
181
|
+ /// <summary>
|
|
|
182
|
+ /// 得到一个对象实体
|
|
|
183
|
+ /// </summary>
|
|
|
184
|
+ public RMYY_CallCenter_Api.Model.T_Sys_SeatGroup DataRowToModel(DataRow row)
|
|
|
185
|
+ {
|
|
|
186
|
+ RMYY_CallCenter_Api.Model.T_Sys_SeatGroup model = new RMYY_CallCenter_Api.Model.T_Sys_SeatGroup();
|
|
|
187
|
+ if (row != null)
|
|
|
188
|
+ {
|
|
|
189
|
+ if (row["F_ID"] != null && row["F_ID"].ToString() != "")
|
|
|
190
|
+ {
|
|
|
191
|
+ model.F_ID = int.Parse(row["F_ID"].ToString());
|
|
|
192
|
+ }
|
|
|
193
|
+ if (row["F_ZXZCode"] != null)
|
|
|
194
|
+ {
|
|
|
195
|
+ model.F_ZXZCode = row["F_ZXZCode"].ToString();
|
|
|
196
|
+ }
|
|
|
197
|
+ if (row["F_ZXZName"] != null)
|
|
|
198
|
+ {
|
|
|
199
|
+ model.F_ZXZName = row["F_ZXZName"].ToString();
|
|
|
200
|
+ }
|
|
|
201
|
+ if (row["F_IVRKey"] != null && row["F_IVRKey"].ToString() != "")
|
|
|
202
|
+ {
|
|
|
203
|
+ model.F_IVRKey = int.Parse(row["F_IVRKey"].ToString());
|
|
|
204
|
+ }
|
|
|
205
|
+ if (row["F_WHBDKey"] != null)
|
|
|
206
|
+ {
|
|
|
207
|
+ model.F_WHBDKey = row["F_WHBDKey"].ToString();
|
|
|
208
|
+ }
|
|
|
209
|
+ if (row["F_WHWDKey"] != null)
|
|
|
210
|
+ {
|
|
|
211
|
+ model.F_WHWDKey = row["F_WHWDKey"].ToString();
|
|
|
212
|
+ }
|
|
|
213
|
+ if (row["F_ZXAtt"] != null)
|
|
|
214
|
+ {
|
|
|
215
|
+ model.F_ZXAtt = row["F_ZXAtt"].ToString();
|
|
|
216
|
+ }
|
|
|
217
|
+ if (row["F_Des"] != null)
|
|
|
218
|
+ {
|
|
|
219
|
+ model.F_Des = row["F_Des"].ToString();
|
|
|
220
|
+ }
|
|
|
221
|
+ if (row["F_CreateTime"] != null && row["F_CreateTime"].ToString() != "")
|
|
|
222
|
+ {
|
|
|
223
|
+ model.F_CreateTime = DateTime.Parse(row["F_CreateTime"].ToString());
|
|
|
224
|
+ }
|
|
|
225
|
+ if (row["F_CreateUser"] != null)
|
|
|
226
|
+ {
|
|
|
227
|
+ model.F_CreateUser = row["F_CreateUser"].ToString();
|
|
|
228
|
+ }
|
|
|
229
|
+ }
|
|
|
230
|
+ return model;
|
|
|
231
|
+ }
|
|
|
232
|
+
|
|
|
233
|
+ /// <summary>
|
|
|
234
|
+ /// 获得数据列表
|
|
|
235
|
+ /// </summary>
|
|
|
236
|
+ public DataSet GetList(string strWhere)
|
|
|
237
|
+ {
|
|
|
238
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
239
|
+ strSql.Append("select F_ID,F_ZXZCode,F_ZXZName,F_IVRKey,F_WHBDKey,F_WHWDKey,F_ZXAtt,F_Des,F_CreateTime,F_CreateUser ");
|
|
|
240
|
+ strSql.Append(" FROM T_Sys_SeatGroup with(nolock)");
|
|
|
241
|
+ if (strWhere.Trim() != "")
|
|
|
242
|
+ {
|
|
|
243
|
+ strSql.Append(" where " + strWhere);
|
|
|
244
|
+ }
|
|
|
245
|
+ return DbHelperSQL.Query(strSql.ToString());
|
|
|
246
|
+ }
|
|
|
247
|
+
|
|
|
248
|
+ /// <summary>
|
|
|
249
|
+ /// 获得前几行数据
|
|
|
250
|
+ /// </summary>
|
|
|
251
|
+ public DataSet GetList(int Top, string strWhere, string filedOrder)
|
|
|
252
|
+ {
|
|
|
253
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
254
|
+ strSql.Append("select ");
|
|
|
255
|
+ if (Top > 0)
|
|
|
256
|
+ {
|
|
|
257
|
+ strSql.Append(" top " + Top.ToString());
|
|
|
258
|
+ }
|
|
|
259
|
+ strSql.Append(" F_ID,F_ZXZCode,F_ZXZName,F_IVRKey,F_WHBDKey,F_WHWDKey,F_ZXAtt,F_Des,F_CreateTime,F_CreateUser ");
|
|
|
260
|
+ strSql.Append(" FROM T_Sys_SeatGroup with(nolock)");
|
|
|
261
|
+ if (strWhere.Trim() != "")
|
|
|
262
|
+ {
|
|
|
263
|
+ strSql.Append(" where " + strWhere);
|
|
|
264
|
+ }
|
|
|
265
|
+ strSql.Append(" order by " + filedOrder);
|
|
|
266
|
+ return DbHelperSQL.Query(strSql.ToString());
|
|
|
267
|
+ }
|
|
|
268
|
+
|
|
|
269
|
+ /// <summary>
|
|
|
270
|
+ /// 获取记录总数
|
|
|
271
|
+ /// </summary>
|
|
|
272
|
+ public int GetRecordCount(string strWhere)
|
|
|
273
|
+ {
|
|
|
274
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
275
|
+ strSql.Append("select count(1) FROM T_Sys_SeatGroup with(nolock)");
|
|
|
276
|
+ if (strWhere.Trim() != "")
|
|
|
277
|
+ {
|
|
|
278
|
+ strSql.Append(" where " + strWhere);
|
|
|
279
|
+ }
|
|
|
280
|
+ object obj = DbHelperSQL.GetSingle(strSql.ToString());
|
|
|
281
|
+ if (obj == null)
|
|
|
282
|
+ {
|
|
|
283
|
+ return 0;
|
|
|
284
|
+ }
|
|
|
285
|
+ else
|
|
|
286
|
+ {
|
|
|
287
|
+ return Convert.ToInt32(obj);
|
|
|
288
|
+ }
|
|
|
289
|
+ }
|
|
|
290
|
+
|
|
|
291
|
+ #endregion BasicMethod
|
|
|
292
|
+ }
|
|
|
293
|
+}
|
|
|
294
|
+
|