|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+/** 版本信息模板在安装目录下,可自行修改。
|
|
|
2
|
+* usernotice.cs
|
|
|
3
|
+*
|
|
|
4
|
+* 功 能: N/A
|
|
|
5
|
+* 类 名: usernotice
|
|
|
6
|
+*
|
|
|
7
|
+* Ver 变更日期 负责人 变更内容
|
|
|
8
|
+* ───────────────────────────────────
|
|
|
9
|
+* V0.01 2022/2/21 10:07:01 N/A 初版
|
|
|
10
|
+*
|
|
|
11
|
+* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
|
|
|
12
|
+*┌──────────────────────────────────┐
|
|
|
13
|
+*│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │
|
|
|
14
|
+*│ 版权所有:动软卓越(北京)科技有限公司 │
|
|
|
15
|
+*└──────────────────────────────────┘
|
|
|
16
|
+*/
|
|
|
17
|
+using System;
|
|
|
18
|
+using System.Data;
|
|
|
19
|
+using System.Text;
|
|
|
20
|
+using System.Data.SqlClient;
|
|
|
21
|
+using YTSoft.DBUtility;
|
|
|
22
|
+
|
|
|
23
|
+namespace YTSoft.BaseCallCenter.DAL
|
|
|
24
|
+{
|
|
|
25
|
+ /// <summary>
|
|
|
26
|
+ /// 数据访问类:usernotice
|
|
|
27
|
+ /// </summary>
|
|
|
28
|
+ public partial class usernotice
|
|
|
29
|
+ {
|
|
|
30
|
+ public usernotice()
|
|
|
31
|
+ {}
|
|
|
32
|
+ #region BasicMethod
|
|
|
33
|
+
|
|
|
34
|
+
|
|
|
35
|
+
|
|
|
36
|
+ /// <summary>
|
|
|
37
|
+ /// 增加一条数据
|
|
|
38
|
+ /// </summary>
|
|
|
39
|
+ public int Add(YTSoft.BaseCallCenter.Model.usernotice model)
|
|
|
40
|
+ {
|
|
|
41
|
+ StringBuilder strSql=new StringBuilder();
|
|
|
42
|
+ strSql.Append("insert into usernotice(");
|
|
|
43
|
+ strSql.Append("F_noticeid,F_userid,F_state)");
|
|
|
44
|
+ strSql.Append(" values (");
|
|
|
45
|
+ strSql.Append("SQL2012F_noticeid,SQL2012F_userid,SQL2012F_state)");
|
|
|
46
|
+ strSql.Append(";select @@IDENTITY");
|
|
|
47
|
+ SqlParameter[] parameters = {
|
|
|
48
|
+ new SqlParameter("SQL2012F_noticeid", SqlDbType.Int,4),
|
|
|
49
|
+ new SqlParameter("SQL2012F_userid", SqlDbType.Int,4),
|
|
|
50
|
+ new SqlParameter("SQL2012F_state", SqlDbType.Int,4)};
|
|
|
51
|
+ parameters[0].Value = model.F_noticeid;
|
|
|
52
|
+ parameters[1].Value = model.F_userid;
|
|
|
53
|
+ parameters[2].Value = model.F_state;
|
|
|
54
|
+
|
|
|
55
|
+ object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
|
|
|
56
|
+ if (obj == null)
|
|
|
57
|
+ {
|
|
|
58
|
+ return 0;
|
|
|
59
|
+ }
|
|
|
60
|
+ else
|
|
|
61
|
+ {
|
|
|
62
|
+ return Convert.ToInt32(obj);
|
|
|
63
|
+ }
|
|
|
64
|
+ }
|
|
|
65
|
+ /// <summary>
|
|
|
66
|
+ /// 更新一条数据
|
|
|
67
|
+ /// </summary>
|
|
|
68
|
+ public bool Update(YTSoft.BaseCallCenter.Model.usernotice model)
|
|
|
69
|
+ {
|
|
|
70
|
+ StringBuilder strSql=new StringBuilder();
|
|
|
71
|
+ strSql.Append("update usernotice set ");
|
|
|
72
|
+ strSql.Append("F_noticeid=SQL2012F_noticeid,");
|
|
|
73
|
+ strSql.Append("F_userid=SQL2012F_userid,");
|
|
|
74
|
+ strSql.Append("F_state=SQL2012F_state");
|
|
|
75
|
+ strSql.Append(" where F_id=SQL2012F_id");
|
|
|
76
|
+ SqlParameter[] parameters = {
|
|
|
77
|
+ new SqlParameter("SQL2012F_noticeid", SqlDbType.Int,4),
|
|
|
78
|
+ new SqlParameter("SQL2012F_userid", SqlDbType.Int,4),
|
|
|
79
|
+ new SqlParameter("SQL2012F_state", SqlDbType.Int,4),
|
|
|
80
|
+ new SqlParameter("SQL2012F_id", SqlDbType.Int,4)};
|
|
|
81
|
+ parameters[0].Value = model.F_noticeid;
|
|
|
82
|
+ parameters[1].Value = model.F_userid;
|
|
|
83
|
+ parameters[2].Value = model.F_state;
|
|
|
84
|
+ parameters[3].Value = model.F_id;
|
|
|
85
|
+
|
|
|
86
|
+ int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
|
|
|
87
|
+ if (rows > 0)
|
|
|
88
|
+ {
|
|
|
89
|
+ return true;
|
|
|
90
|
+ }
|
|
|
91
|
+ else
|
|
|
92
|
+ {
|
|
|
93
|
+ return false;
|
|
|
94
|
+ }
|
|
|
95
|
+ }
|
|
|
96
|
+
|
|
|
97
|
+ /// <summary>
|
|
|
98
|
+ /// 删除一条数据
|
|
|
99
|
+ /// </summary>
|
|
|
100
|
+ public bool Delete(int F_id)
|
|
|
101
|
+ {
|
|
|
102
|
+
|
|
|
103
|
+ StringBuilder strSql=new StringBuilder();
|
|
|
104
|
+ strSql.Append("delete from usernotice ");
|
|
|
105
|
+ strSql.Append(" where F_id=SQL2012F_id");
|
|
|
106
|
+ SqlParameter[] parameters = {
|
|
|
107
|
+ new SqlParameter("SQL2012F_id", SqlDbType.Int,4)
|
|
|
108
|
+ };
|
|
|
109
|
+ parameters[0].Value = F_id;
|
|
|
110
|
+
|
|
|
111
|
+ int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
|
|
|
112
|
+ if (rows > 0)
|
|
|
113
|
+ {
|
|
|
114
|
+ return true;
|
|
|
115
|
+ }
|
|
|
116
|
+ else
|
|
|
117
|
+ {
|
|
|
118
|
+ return false;
|
|
|
119
|
+ }
|
|
|
120
|
+ }
|
|
|
121
|
+ /// <summary>
|
|
|
122
|
+ /// 批量删除数据
|
|
|
123
|
+ /// </summary>
|
|
|
124
|
+ public bool DeleteList(string F_idlist )
|
|
|
125
|
+ {
|
|
|
126
|
+ StringBuilder strSql=new StringBuilder();
|
|
|
127
|
+ strSql.Append("delete from usernotice ");
|
|
|
128
|
+ strSql.Append(" where F_id in ("+F_idlist + ") ");
|
|
|
129
|
+ int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
|
|
|
130
|
+ if (rows > 0)
|
|
|
131
|
+ {
|
|
|
132
|
+ return true;
|
|
|
133
|
+ }
|
|
|
134
|
+ else
|
|
|
135
|
+ {
|
|
|
136
|
+ return false;
|
|
|
137
|
+ }
|
|
|
138
|
+ }
|
|
|
139
|
+
|
|
|
140
|
+
|
|
|
141
|
+ /// <summary>
|
|
|
142
|
+ /// 得到一个对象实体
|
|
|
143
|
+ /// </summary>
|
|
|
144
|
+ public YTSoft.BaseCallCenter.Model.usernotice GetModel(int F_id)
|
|
|
145
|
+ {
|
|
|
146
|
+
|
|
|
147
|
+ StringBuilder strSql=new StringBuilder();
|
|
|
148
|
+ strSql.Append("select top 1 F_id,F_noticeid,F_userid,F_state from usernotice ");
|
|
|
149
|
+ strSql.Append(" where F_id=SQL2012F_id");
|
|
|
150
|
+ SqlParameter[] parameters = {
|
|
|
151
|
+ new SqlParameter("SQL2012F_id", SqlDbType.Int,4)
|
|
|
152
|
+ };
|
|
|
153
|
+ parameters[0].Value = F_id;
|
|
|
154
|
+
|
|
|
155
|
+ YTSoft.BaseCallCenter.Model.usernotice model=new YTSoft.BaseCallCenter.Model.usernotice();
|
|
|
156
|
+ DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
|
|
|
157
|
+ if(ds.Tables[0].Rows.Count>0)
|
|
|
158
|
+ {
|
|
|
159
|
+ return DataRowToModel(ds.Tables[0].Rows[0]);
|
|
|
160
|
+ }
|
|
|
161
|
+ else
|
|
|
162
|
+ {
|
|
|
163
|
+ return null;
|
|
|
164
|
+ }
|
|
|
165
|
+ }
|
|
|
166
|
+
|
|
|
167
|
+
|
|
|
168
|
+ /// <summary>
|
|
|
169
|
+ /// 得到一个对象实体
|
|
|
170
|
+ /// </summary>
|
|
|
171
|
+ public YTSoft.BaseCallCenter.Model.usernotice DataRowToModel(DataRow row)
|
|
|
172
|
+ {
|
|
|
173
|
+ YTSoft.BaseCallCenter.Model.usernotice model=new YTSoft.BaseCallCenter.Model.usernotice();
|
|
|
174
|
+ if (row != null)
|
|
|
175
|
+ {
|
|
|
176
|
+ if(row["F_id"]!=null && row["F_id"].ToString()!="")
|
|
|
177
|
+ {
|
|
|
178
|
+ model.F_id=int.Parse(row["F_id"].ToString());
|
|
|
179
|
+ }
|
|
|
180
|
+ if(row["F_noticeid"]!=null && row["F_noticeid"].ToString()!="")
|
|
|
181
|
+ {
|
|
|
182
|
+ model.F_noticeid=int.Parse(row["F_noticeid"].ToString());
|
|
|
183
|
+ }
|
|
|
184
|
+ if(row["F_userid"]!=null && row["F_userid"].ToString()!="")
|
|
|
185
|
+ {
|
|
|
186
|
+ model.F_userid=int.Parse(row["F_userid"].ToString());
|
|
|
187
|
+ }
|
|
|
188
|
+ if(row["F_state"]!=null && row["F_state"].ToString()!="")
|
|
|
189
|
+ {
|
|
|
190
|
+ model.F_state=int.Parse(row["F_state"].ToString());
|
|
|
191
|
+ }
|
|
|
192
|
+ }
|
|
|
193
|
+ return model;
|
|
|
194
|
+ }
|
|
|
195
|
+
|
|
|
196
|
+ /// <summary>
|
|
|
197
|
+ /// 获得数据列表
|
|
|
198
|
+ /// </summary>
|
|
|
199
|
+ public DataSet GetList(string strWhere)
|
|
|
200
|
+ {
|
|
|
201
|
+ StringBuilder strSql=new StringBuilder();
|
|
|
202
|
+ strSql.Append("select F_id,F_noticeid,F_userid,F_state ");
|
|
|
203
|
+ strSql.Append(" FROM usernotice ");
|
|
|
204
|
+ if(strWhere.Trim()!="")
|
|
|
205
|
+ {
|
|
|
206
|
+ strSql.Append(" where "+strWhere);
|
|
|
207
|
+ }
|
|
|
208
|
+ return DbHelperSQL.Query(strSql.ToString());
|
|
|
209
|
+ }
|
|
|
210
|
+
|
|
|
211
|
+ /// <summary>
|
|
|
212
|
+ /// 获得前几行数据
|
|
|
213
|
+ /// </summary>
|
|
|
214
|
+ public DataSet GetList(int Top,string strWhere,string filedOrder)
|
|
|
215
|
+ {
|
|
|
216
|
+ StringBuilder strSql=new StringBuilder();
|
|
|
217
|
+ strSql.Append("select ");
|
|
|
218
|
+ if(Top>0)
|
|
|
219
|
+ {
|
|
|
220
|
+ strSql.Append(" top "+Top.ToString());
|
|
|
221
|
+ }
|
|
|
222
|
+ strSql.Append(" F_id,F_noticeid,F_userid,F_state ");
|
|
|
223
|
+ strSql.Append(" FROM usernotice ");
|
|
|
224
|
+ if(strWhere.Trim()!="")
|
|
|
225
|
+ {
|
|
|
226
|
+ strSql.Append(" where "+strWhere);
|
|
|
227
|
+ }
|
|
|
228
|
+ strSql.Append(" order by " + filedOrder);
|
|
|
229
|
+ return DbHelperSQL.Query(strSql.ToString());
|
|
|
230
|
+ }
|
|
|
231
|
+
|
|
|
232
|
+ /// <summary>
|
|
|
233
|
+ /// 获取记录总数
|
|
|
234
|
+ /// </summary>
|
|
|
235
|
+ public int GetRecordCount(string strWhere)
|
|
|
236
|
+ {
|
|
|
237
|
+ StringBuilder strSql=new StringBuilder();
|
|
|
238
|
+ strSql.Append("select count(1) FROM usernotice ");
|
|
|
239
|
+ if(strWhere.Trim()!="")
|
|
|
240
|
+ {
|
|
|
241
|
+ strSql.Append(" where "+strWhere);
|
|
|
242
|
+ }
|
|
|
243
|
+ object obj = DbHelperSQL.GetSingle(strSql.ToString());
|
|
|
244
|
+ if (obj == null)
|
|
|
245
|
+ {
|
|
|
246
|
+ return 0;
|
|
|
247
|
+ }
|
|
|
248
|
+ else
|
|
|
249
|
+ {
|
|
|
250
|
+ return Convert.ToInt32(obj);
|
|
|
251
|
+ }
|
|
|
252
|
+ }
|
|
|
253
|
+ /// <summary>
|
|
|
254
|
+ /// 分页获取数据列表
|
|
|
255
|
+ /// </summary>
|
|
|
256
|
+ public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
|
|
|
257
|
+ {
|
|
|
258
|
+ StringBuilder strSql=new StringBuilder();
|
|
|
259
|
+ strSql.Append("SELECT * FROM ( ");
|
|
|
260
|
+ strSql.Append(" SELECT ROW_NUMBER() OVER (");
|
|
|
261
|
+ if (!string.IsNullOrEmpty(orderby.Trim()))
|
|
|
262
|
+ {
|
|
|
263
|
+ strSql.Append("order by T." + orderby );
|
|
|
264
|
+ }
|
|
|
265
|
+ else
|
|
|
266
|
+ {
|
|
|
267
|
+ strSql.Append("order by T.F_id desc");
|
|
|
268
|
+ }
|
|
|
269
|
+ strSql.Append(")AS Row, T.* from usernotice T ");
|
|
|
270
|
+ if (!string.IsNullOrEmpty(strWhere.Trim()))
|
|
|
271
|
+ {
|
|
|
272
|
+ strSql.Append(" WHERE " + strWhere);
|
|
|
273
|
+ }
|
|
|
274
|
+ strSql.Append(" ) TT");
|
|
|
275
|
+ strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
|
|
|
276
|
+ return DbHelperSQL.Query(strSql.ToString());
|
|
|
277
|
+ }
|
|
|
278
|
+
|
|
|
279
|
+ /*
|
|
|
280
|
+ /// <summary>
|
|
|
281
|
+ /// 分页获取数据列表
|
|
|
282
|
+ /// </summary>
|
|
|
283
|
+ public DataSet GetList(int PageSize,int PageIndex,string strWhere)
|
|
|
284
|
+ {
|
|
|
285
|
+ SqlParameter[] parameters = {
|
|
|
286
|
+ new SqlParameter("SQL2012tblName", SqlDbType.VarChar, 255),
|
|
|
287
|
+ new SqlParameter("SQL2012fldName", SqlDbType.VarChar, 255),
|
|
|
288
|
+ new SqlParameter("SQL2012PageSize", SqlDbType.Int),
|
|
|
289
|
+ new SqlParameter("SQL2012PageIndex", SqlDbType.Int),
|
|
|
290
|
+ new SqlParameter("SQL2012IsReCount", SqlDbType.Bit),
|
|
|
291
|
+ new SqlParameter("SQL2012OrderType", SqlDbType.Bit),
|
|
|
292
|
+ new SqlParameter("SQL2012strWhere", SqlDbType.VarChar,1000),
|
|
|
293
|
+ };
|
|
|
294
|
+ parameters[0].Value = "usernotice";
|
|
|
295
|
+ parameters[1].Value = "F_id";
|
|
|
296
|
+ parameters[2].Value = PageSize;
|
|
|
297
|
+ parameters[3].Value = PageIndex;
|
|
|
298
|
+ parameters[4].Value = 0;
|
|
|
299
|
+ parameters[5].Value = 0;
|
|
|
300
|
+ parameters[6].Value = strWhere;
|
|
|
301
|
+ return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
|
|
|
302
|
+ }*/
|
|
|
303
|
+
|
|
|
304
|
+ #endregion BasicMethod
|
|
|
305
|
+ #region ExtensionMethod
|
|
|
306
|
+
|
|
|
307
|
+ #endregion ExtensionMethod
|
|
|
308
|
+ }
|
|
|
309
|
+}
|
|
|
310
|
+
|