高新区管委会,以5.0标准版为基准,从双汇项目拷贝

T_RepositoryInformation.cs 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  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. namespace CallCenterApi.DAL
  10. {
  11. /// <summary>
  12. /// 数据访问类:T_RepositoryInformation
  13. /// </summary>
  14. public partial class T_RepositoryInformation
  15. {
  16. private readonly CallCenterApi.DAL.T_Sys_AccessLog AccessLogdal = new CallCenterApi.DAL.T_Sys_AccessLog();
  17. public T_RepositoryInformation()
  18. { }
  19. #region BasicMethod
  20. /// <summary>
  21. /// 得到最大ID
  22. /// </summary>
  23. public int GetMaxId()
  24. {
  25. return DbHelperSQL.GetMaxID("F_RepositoryId", "T_RepositoryInformation");
  26. }
  27. /// <summary>
  28. /// 是否存在该记录
  29. /// </summary>
  30. public bool Exists(int F_RepositoryId)
  31. {
  32. StringBuilder strSql = new StringBuilder();
  33. strSql.Append("select count(1) from T_RepositoryInformation WITH(NOLOCK)");
  34. strSql.Append(" where F_RepositoryId=@F_RepositoryId");
  35. SqlParameter[] parameters = {
  36. new SqlParameter("@F_RepositoryId", SqlDbType.Int,4)
  37. };
  38. parameters[0].Value = F_RepositoryId;
  39. return DbHelperSQL.Exists(strSql.ToString(), parameters);
  40. }
  41. /// <summary>
  42. /// 增加一条数据
  43. /// </summary>
  44. public int Add(Model.T_RepositoryInformation model,int userId)
  45. {
  46. StringBuilder strSql = new StringBuilder();
  47. strSql.Append("insert into T_RepositoryInformation(");
  48. strSql.Append(@"F_CategoryId,F_CustomerId,F_CustomerName,F_ManId,F_ManName,
  49. F_Title,F_Content,F_Description,F_Comments,F_Url,F_KeyWords,F_Expand1,F_Expand2,F_IntExpand1,
  50. F_CreateOn,F_CreateBy,F_CreateName,F_ModifyOn,F_ModifyBy,F_ModifyName,F_DeleteFlag,
  51. F_visibleDeptId,F_isorPerson ,F_visibleDeptName)");
  52. strSql.Append(" values (");
  53. strSql.Append(@"@F_CategoryId,@F_CustomerId,@F_CustomerName,@F_ManId,
  54. @F_ManName,@F_Title,@F_Content,@F_Description,@F_Comments,@F_Url,@F_KeyWords,@F_Expand1,
  55. @F_Expand2,@F_IntExpand1,@F_CreateOn,@F_CreateBy,@F_CreateName,@F_ModifyOn,@F_ModifyBy,
  56. @F_ModifyName,@F_DeleteFlag,@F_visibleDeptId,@F_isorPerson,@F_visibleDeptName )");
  57. strSql.Append(";select @@IDENTITY");
  58. SqlParameter[] parameters = {
  59. new SqlParameter("@F_CategoryId", SqlDbType.Int,4),
  60. new SqlParameter("@F_CustomerId", SqlDbType.Int,4),
  61. new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,100),
  62. new SqlParameter("@F_ManId", SqlDbType.Int,4),
  63. new SqlParameter("@F_ManName", SqlDbType.NVarChar,50),
  64. new SqlParameter("@F_Title", SqlDbType.NVarChar,200),
  65. new SqlParameter("@F_Content", SqlDbType.NText),
  66. new SqlParameter("@F_Description", SqlDbType.NText),
  67. new SqlParameter("@F_Comments", SqlDbType.NVarChar,500),
  68. new SqlParameter("@F_Url", SqlDbType.NVarChar,200),
  69. new SqlParameter("@F_KeyWords", SqlDbType.NVarChar,500),
  70. new SqlParameter("@F_Expand1", SqlDbType.NVarChar,100),
  71. new SqlParameter("@F_Expand2", SqlDbType.NVarChar,200),
  72. new SqlParameter("@F_IntExpand1", SqlDbType.SmallInt,2),
  73. new SqlParameter("@F_CreateOn", SqlDbType.DateTime),
  74. new SqlParameter("@F_CreateBy", SqlDbType.Int,4),
  75. new SqlParameter("@F_CreateName", SqlDbType.NVarChar,200),
  76. new SqlParameter("@F_ModifyOn", SqlDbType.DateTime),
  77. new SqlParameter("@F_ModifyBy", SqlDbType.Int,4),
  78. new SqlParameter("@F_ModifyName", SqlDbType.NVarChar,200),
  79. new SqlParameter("@F_DeleteFlag", SqlDbType.SmallInt,2),
  80. new SqlParameter("@F_visibleDeptId", SqlDbType.Int,2),
  81. new SqlParameter("@F_isorPerson", SqlDbType.Int,2),
  82. new SqlParameter("@F_visibleDeptName", SqlDbType.NVarChar,500),};
  83. parameters[0].Value = model.F_CategoryId;
  84. parameters[1].Value = model.F_CustomerId;
  85. parameters[2].Value = model.F_CustomerName;
  86. parameters[3].Value = model.F_ManId;
  87. parameters[4].Value = model.F_ManName;
  88. parameters[5].Value = model.F_Title;
  89. parameters[6].Value = model.F_Content;
  90. parameters[7].Value = model.F_Description;
  91. parameters[8].Value = model.F_Comments;
  92. parameters[9].Value = model.F_Url;
  93. parameters[10].Value = model.F_KeyWords;
  94. parameters[11].Value = model.F_Expand1;
  95. parameters[12].Value = model.F_Expand2;
  96. parameters[13].Value = model.F_IntExpand1;
  97. parameters[14].Value = model.F_CreateOn;
  98. parameters[15].Value = model.F_CreateBy;
  99. parameters[16].Value = model.F_CreateName;
  100. parameters[17].Value = model.F_ModifyOn;
  101. parameters[18].Value = model.F_ModifyBy;
  102. parameters[19].Value = model.F_ModifyName;
  103. parameters[20].Value = model.F_DeleteFlag;
  104. parameters[21].Value = model.F_visibleDeptId;
  105. parameters[22].Value = model.F_isorPerson;
  106. parameters[23].Value = model.F_visibleDeptName;
  107. object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
  108. if (obj == null)
  109. {
  110. return 0;
  111. }
  112. else
  113. {
  114. //日志添加
  115. AccessLogdal.AddAccessLog("新增", "T_RepositoryInformation", Convert.ToInt32(obj), userId);
  116. return Convert.ToInt32(obj);
  117. }
  118. }
  119. /// <summary>
  120. /// 更新一条数据
  121. /// </summary>
  122. public bool Update(Model.T_RepositoryInformation model,int userid)
  123. {
  124. StringBuilder strSql = new StringBuilder();
  125. strSql.Append("update T_RepositoryInformation set ");
  126. strSql.Append("F_CategoryId=@F_CategoryId,");
  127. strSql.Append("F_CustomerId=@F_CustomerId,");
  128. strSql.Append("F_CustomerName=@F_CustomerName,");
  129. strSql.Append("F_ManId=@F_ManId,");
  130. strSql.Append("F_ManName=@F_ManName,");
  131. strSql.Append("F_Title=@F_Title,");
  132. strSql.Append("F_Content=@F_Content,");
  133. strSql.Append("F_Description=@F_Description,");
  134. strSql.Append("F_Comments=@F_Comments,");
  135. strSql.Append("F_Url=@F_Url,");
  136. strSql.Append("F_KeyWords=@F_KeyWords,");
  137. strSql.Append("F_Expand1=@F_Expand1,");
  138. strSql.Append("F_Expand2=@F_Expand2,");
  139. strSql.Append("F_IntExpand1=@F_IntExpand1,");
  140. strSql.Append("F_CreateOn=@F_CreateOn,");
  141. strSql.Append("F_CreateBy=@F_CreateBy,");
  142. strSql.Append("F_CreateName=@F_CreateName,");
  143. strSql.Append("F_ModifyOn=@F_ModifyOn,");
  144. strSql.Append("F_ModifyBy=@F_ModifyBy,");
  145. strSql.Append("F_ModifyName=@F_ModifyName,");
  146. strSql.Append("F_DeleteFlag=@F_DeleteFlag,");
  147. //strSql.Append("F_RepositoryId=@F_RepositoryId,");
  148. strSql.Append("F_visibleDeptId=@F_visibleDeptId,");
  149. strSql.Append("F_isorPerson=@F_isorPerson,");
  150. strSql.Append("F_visibleDeptName=@F_visibleDeptName");
  151. strSql.Append(" where F_RepositoryId=@F_RepositoryId");
  152. SqlParameter[] parameters = {
  153. new SqlParameter("@F_CategoryId", SqlDbType.Int,4),
  154. new SqlParameter("@F_CustomerId", SqlDbType.Int,4),
  155. new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,100),
  156. new SqlParameter("@F_ManId", SqlDbType.Int,4),
  157. new SqlParameter("@F_ManName", SqlDbType.NVarChar,50),
  158. new SqlParameter("@F_Title", SqlDbType.NVarChar,200),
  159. new SqlParameter("@F_Content", SqlDbType.NText),
  160. new SqlParameter("@F_Description", SqlDbType.NText),
  161. new SqlParameter("@F_Comments", SqlDbType.NVarChar,500),
  162. new SqlParameter("@F_Url", SqlDbType.NVarChar,200),
  163. new SqlParameter("@F_KeyWords", SqlDbType.NVarChar,500),
  164. new SqlParameter("@F_Expand1", SqlDbType.NVarChar,100),
  165. new SqlParameter("@F_Expand2", SqlDbType.NVarChar,200),
  166. new SqlParameter("@F_IntExpand1", SqlDbType.SmallInt,2),
  167. new SqlParameter("@F_CreateOn", SqlDbType.DateTime),
  168. new SqlParameter("@F_CreateBy", SqlDbType.Int,4),
  169. new SqlParameter("@F_CreateName", SqlDbType.NVarChar,200),
  170. new SqlParameter("@F_ModifyOn", SqlDbType.DateTime),
  171. new SqlParameter("@F_ModifyBy", SqlDbType.Int,4),
  172. new SqlParameter("@F_ModifyName", SqlDbType.NVarChar,200),
  173. new SqlParameter("@F_DeleteFlag", SqlDbType.SmallInt,2),
  174. new SqlParameter("@F_RepositoryId", SqlDbType.Int,4),
  175. new SqlParameter("@F_visibleDeptId", SqlDbType.Int,4),
  176. new SqlParameter("@F_isorPerson", SqlDbType.Int,4),
  177. new SqlParameter("@F_visibleDeptName", SqlDbType.NVarChar,50)
  178. };
  179. parameters[0].Value = model.F_CategoryId;
  180. parameters[1].Value = model.F_CustomerId;
  181. parameters[2].Value = model.F_CustomerName;
  182. parameters[3].Value = model.F_ManId;
  183. parameters[4].Value = model.F_ManName;
  184. parameters[5].Value = model.F_Title;
  185. parameters[6].Value = model.F_Content;
  186. parameters[7].Value = model.F_Description;
  187. parameters[8].Value = model.F_Comments;
  188. parameters[9].Value = model.F_Url;
  189. parameters[10].Value = model.F_KeyWords;
  190. parameters[11].Value = model.F_Expand1;
  191. parameters[12].Value = model.F_Expand2;
  192. parameters[13].Value = model.F_IntExpand1;
  193. parameters[14].Value = model.F_CreateOn;
  194. parameters[15].Value = model.F_CreateBy;
  195. parameters[16].Value = model.F_CreateName;
  196. parameters[17].Value = model.F_ModifyOn;
  197. parameters[18].Value = model.F_ModifyBy;
  198. parameters[19].Value = model.F_ModifyName;
  199. parameters[20].Value = model.F_DeleteFlag;
  200. parameters[21].Value = model.F_RepositoryId;
  201. parameters[22].Value = model.F_visibleDeptId;
  202. parameters[23].Value = model.F_isorPerson;
  203. parameters[24].Value = model.F_visibleDeptName;
  204. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  205. if (rows > 0)
  206. {
  207. AccessLogdal.AddAccessLog("修改", "T_RepositoryInformation", model.F_RepositoryId, userid);
  208. return true;
  209. }
  210. else
  211. {
  212. return false;
  213. }
  214. }
  215. /// <summary>
  216. /// 删除一条数据
  217. /// </summary>
  218. public bool Delete(int F_RepositoryId,int UserId )
  219. {
  220. StringBuilder strSql = new StringBuilder();
  221. //strSql.Append("delete from T_RepositoryInformation ");
  222. strSql.Append("update T_RepositoryInformation set F_DeleteFlag=1");
  223. strSql.Append(" where F_RepositoryId=@F_RepositoryId");
  224. SqlParameter[] parameters = {
  225. new SqlParameter("@F_RepositoryId", SqlDbType.Int,4)
  226. };
  227. parameters[0].Value = F_RepositoryId;
  228. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  229. if (rows > 0)
  230. {
  231. AccessLogdal.AddAccessLog("删除", "T_RepositoryInformation", F_RepositoryId, UserId);
  232. return true;
  233. }
  234. else
  235. {
  236. return false;
  237. }
  238. }
  239. /// <summary>
  240. /// 批量删除数据
  241. /// </summary>
  242. public bool DeleteList(string F_RepositoryIdlist)
  243. {
  244. StringBuilder strSql = new StringBuilder();
  245. //strSql.Append("delete from T_RepositoryInformation ");
  246. strSql.Append("update T_RepositoryInformation set F_DeleteFlag=1");
  247. strSql.Append(" where F_RepositoryId in (" + F_RepositoryIdlist + ") ");
  248. int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
  249. if (rows > 0)
  250. {
  251. return true;
  252. }
  253. else
  254. {
  255. return false;
  256. }
  257. }
  258. /// <summary>
  259. /// 得到一个对象实体
  260. /// </summary>
  261. public Model.T_RepositoryInformation GetModel(int F_RepositoryId,int userId )
  262. {
  263. StringBuilder strSql = new StringBuilder();
  264. strSql.Append(@"select top 1 F_RepositoryId,F_CategoryId,F_CustomerId,F_CustomerName,
  265. F_ManId,F_ManName,F_Title,F_Content,F_Description,F_Comments,F_Url,F_KeyWords,F_Expand1,
  266. F_Expand2,F_IntExpand1,F_CreateOn,F_CreateBy,F_CreateName,F_ModifyOn,F_ModifyBy,F_ModifyName,
  267. F_DeleteFlag,F_visibleDeptId ,F_isorPerson,F_visibleDeptName from T_RepositoryInformation WITH(NOLOCK) ");
  268. strSql.Append(" where F_RepositoryId=@F_RepositoryId");
  269. SqlParameter[] parameters = {
  270. new SqlParameter("@F_RepositoryId", SqlDbType.Int,4)
  271. };
  272. parameters[0].Value = F_RepositoryId;
  273. Model.T_RepositoryInformation model = new Model.T_RepositoryInformation();
  274. DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
  275. if (ds.Tables[0].Rows.Count > 0)
  276. {
  277. AccessLogdal.AddAccessLog("获取查看", "T_RepositoryInformation", F_RepositoryId, userId);
  278. return DataRowToModel(ds.Tables[0].Rows[0]);
  279. }
  280. else
  281. {
  282. return null;
  283. }
  284. }
  285. /// <summary>
  286. /// 得到一个对象实体
  287. /// </summary>
  288. public Model.T_RepositoryInformation DataRowToModel(DataRow row)
  289. {
  290. Model.T_RepositoryInformation model = new Model.T_RepositoryInformation();
  291. if (row != null)
  292. {
  293. if (row["F_RepositoryId"] != null && row["F_RepositoryId"].ToString() != "")
  294. {
  295. model.F_RepositoryId = int.Parse(row["F_RepositoryId"].ToString());
  296. }
  297. if (row["F_CategoryId"] != null && row["F_CategoryId"].ToString() != "")
  298. {
  299. model.F_CategoryId = int.Parse(row["F_CategoryId"].ToString());
  300. }
  301. if (row["F_CustomerId"] != null && row["F_CustomerId"].ToString() != "")
  302. {
  303. model.F_CustomerId = int.Parse(row["F_CustomerId"].ToString());
  304. }
  305. if (row["F_CustomerName"] != null)
  306. {
  307. model.F_CustomerName = row["F_CustomerName"].ToString();
  308. }
  309. if (row["F_ManId"] != null && row["F_ManId"].ToString() != "")
  310. {
  311. model.F_ManId = int.Parse(row["F_ManId"].ToString());
  312. }
  313. if (row["F_ManName"] != null)
  314. {
  315. model.F_ManName = row["F_ManName"].ToString();
  316. }
  317. if (row["F_Title"] != null)
  318. {
  319. model.F_Title = row["F_Title"].ToString();
  320. }
  321. if (row["F_Content"] != null)
  322. {
  323. model.F_Content = row["F_Content"].ToString();
  324. }
  325. if (row["F_Description"] != null)
  326. {
  327. model.F_Description = row["F_Description"].ToString();
  328. }
  329. if (row["F_Comments"] != null)
  330. {
  331. model.F_Comments = row["F_Comments"].ToString();
  332. }
  333. if (row["F_Url"] != null)
  334. {
  335. model.F_Url = row["F_Url"].ToString();
  336. }
  337. if (row["F_KeyWords"] != null)
  338. {
  339. model.F_KeyWords = row["F_KeyWords"].ToString();
  340. }
  341. if (row["F_Expand1"] != null)
  342. {
  343. model.F_Expand1 = row["F_Expand1"].ToString();
  344. }
  345. if (row["F_Expand2"] != null)
  346. {
  347. model.F_Expand2 = row["F_Expand2"].ToString();
  348. }
  349. if (row["F_IntExpand1"] != null && row["F_IntExpand1"].ToString() != "")
  350. {
  351. model.F_IntExpand1 = int.Parse(row["F_IntExpand1"].ToString());
  352. }
  353. if (row["F_CreateOn"] != null && row["F_CreateOn"].ToString() != "")
  354. {
  355. model.F_CreateOn = DateTime.Parse(row["F_CreateOn"].ToString());
  356. }
  357. if (row["F_CreateBy"] != null && row["F_CreateBy"].ToString() != "")
  358. {
  359. model.F_CreateBy = int.Parse(row["F_CreateBy"].ToString());
  360. }
  361. if (row["F_CreateName"] != null)
  362. {
  363. model.F_CreateName = row["F_CreateName"].ToString();
  364. }
  365. if (row["F_ModifyOn"] != null && row["F_ModifyOn"].ToString() != "")
  366. {
  367. model.F_ModifyOn = DateTime.Parse(row["F_ModifyOn"].ToString());
  368. }
  369. if (row["F_ModifyBy"] != null && row["F_ModifyBy"].ToString() != "")
  370. {
  371. model.F_ModifyBy = int.Parse(row["F_ModifyBy"].ToString());
  372. }
  373. if (row["F_ModifyName"] != null)
  374. {
  375. model.F_ModifyName = row["F_ModifyName"].ToString();
  376. }
  377. if (row["F_DeleteFlag"] != null && row["F_DeleteFlag"].ToString() != "")
  378. {
  379. model.F_DeleteFlag = int.Parse(row["F_DeleteFlag"].ToString());
  380. }
  381. if (row["F_visibleDeptId"] != null && row["F_visibleDeptId"].ToString() != "")
  382. {
  383. model.F_visibleDeptId = int.Parse(row["F_visibleDeptId"].ToString());
  384. }
  385. if (row["F_isorPerson"] != null && row["F_isorPerson"].ToString() != "")
  386. {
  387. model.F_isorPerson = int.Parse(row["F_isorPerson"].ToString());
  388. }
  389. if (row["F_visibleDeptName"] != null && row["F_visibleDeptName"].ToString() != "")
  390. {
  391. model.F_visibleDeptName = row["F_visibleDeptName"].ToString();
  392. }
  393. }
  394. return model;
  395. }
  396. /// <summary>
  397. /// 获得数据列表
  398. /// </summary>
  399. public DataSet GetList(string strWhere)
  400. {
  401. StringBuilder strSql = new StringBuilder();
  402. strSql.Append(@"select F_RepositoryId,F_CategoryId,F_CustomerId,F_CustomerName,
  403. F_ManId,F_ManName,F_Title,F_Content,F_Description,F_Comments,F_Url,F_KeyWords,F_Expand1
  404. ,F_Expand2,F_IntExpand1,F_CreateOn,F_CreateBy,F_CreateName,F_ModifyOn,F_ModifyBy,F_ModifyName,
  405. F_DeleteFlag,F_visibleDeptId,F_isorPerson,F_visibleDeptName ");
  406. strSql.Append(" FROM T_RepositoryInformation WITH(NOLOCK)");
  407. if (strWhere.Trim() != "")
  408. {
  409. strSql.Append(" where " + strWhere);
  410. }
  411. return DbHelperSQL.Query(strSql.ToString());
  412. }
  413. /// <summary>
  414. /// 获得前几行数据
  415. /// </summary>
  416. public DataSet GetList(int Top, string strWhere, string filedOrder)
  417. {
  418. StringBuilder strSql = new StringBuilder();
  419. strSql.Append("select ");
  420. if (Top > 0)
  421. {
  422. strSql.Append(" top " + Top.ToString());
  423. }
  424. strSql.Append(@" F_RepositoryId,F_CategoryId,F_CustomerId,F_CustomerName,F_ManId,
  425. F_ManName,F_Title,F_Content,F_Description,F_Comments,F_Url,F_KeyWords,F_Expand1,F_Expand2,
  426. F_IntExpand1,F_CreateOn,F_CreateBy,F_CreateName,F_ModifyOn,F_ModifyBy,F_ModifyName,F_DeleteFlag,
  427. F_visibleDeptId,F_isorPerson,F_visibleDeptName ");
  428. strSql.Append(" FROM T_RepositoryInformation WITH(NOLOCK)");
  429. if (strWhere.Trim() != "")
  430. {
  431. strSql.Append(" where " + strWhere);
  432. }
  433. strSql.Append(" order by " + filedOrder);
  434. return DbHelperSQL.Query(strSql.ToString());
  435. }
  436. /// <summary>
  437. /// 获取记录总数
  438. /// </summary>
  439. public int GetRecordCount(string strWhere)
  440. {
  441. StringBuilder strSql = new StringBuilder();
  442. strSql.Append("select count(1) FROM T_RepositoryInformation WITH(NOLOCK)");
  443. if (strWhere.Trim() != "")
  444. {
  445. strSql.Append(" where " + strWhere);
  446. }
  447. object obj = DbHelperSQL.GetSingle(strSql.ToString());
  448. if (obj == null)
  449. {
  450. return 0;
  451. }
  452. else
  453. {
  454. return Convert.ToInt32(obj);
  455. }
  456. }
  457. /// <summary>
  458. /// 分页获取数据列表
  459. /// </summary>
  460. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  461. {
  462. StringBuilder strSql = new StringBuilder();
  463. strSql.Append("SELECT * FROM ( ");
  464. strSql.Append(" SELECT ROW_NUMBER() OVER (");
  465. if (!string.IsNullOrEmpty(orderby.Trim()))
  466. {
  467. strSql.Append("order by T." + orderby);
  468. }
  469. else
  470. {
  471. strSql.Append("order by T.F_RepositoryId desc");
  472. }
  473. strSql.Append(")AS Row, T.* from T_RepositoryInformation T WITH(NOLOCK)");
  474. if (!string.IsNullOrEmpty(strWhere.Trim()))
  475. {
  476. strSql.Append(" WHERE " + strWhere);
  477. }
  478. strSql.Append(" ) TT");
  479. strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
  480. return DbHelperSQL.Query(strSql.ToString());
  481. }
  482. #endregion BasicMethod
  483. #region ExtensionMethod
  484. #endregion ExtensionMethod
  485. }
  486. }