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

T_Rec_RegRecordsCallOut.cs 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  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_Rec_RegRecordsCallOut
  13. /// </summary>
  14. public partial class T_Rec_RegRecordsCallOut
  15. {
  16. public T_Rec_RegRecordsCallOut()
  17. { }
  18. #region Method
  19. /// <summary>
  20. /// 是否存在该记录
  21. /// </summary>
  22. public bool Exists(int F_ID)
  23. {
  24. StringBuilder strSql = new StringBuilder();
  25. strSql.Append("select count(1) from T_Rec_RegRecordsCallOut");
  26. strSql.Append(" where F_ID=@F_ID");
  27. SqlParameter[] parameters = {
  28. new SqlParameter("@F_ID", SqlDbType.Int,4)
  29. };
  30. parameters[0].Value = F_ID;
  31. return DbHelperSQL.Exists(strSql.ToString(), parameters);
  32. }
  33. /// <summary>
  34. /// 增加一条数据
  35. /// </summary>
  36. public int Add(CallCenterApi.Model.T_Rec_RegRecordsCallOut model)
  37. {
  38. StringBuilder strSql = new StringBuilder();
  39. strSql.Append("insert into T_Rec_RegRecordsCallOut(");
  40. strSql.Append(@"F_RecCode,F_CusID,F_Type,F_Direction,F_Complained,F_Content,
  41. F_Remark,F_CreateBy,F_CreateOn,F_IsDelete,F_DeleteOn,F_DeleteBy,F_Tel,F_CallId,
  42. F_userName,F_userPhone,F_userSex,F_userProvince,F_userCity,F_userArea,F_ProblemType,F_Unit,
  43. F_UnitOffice,F_CaseParty,F_CitizensType,F_PutRecord,F_ZXZType,F_CasePartyId,F_ProblemTypeB,F_userAddress,F_InnerType
  44. )");
  45. strSql.Append(" values (");
  46. strSql.Append(@"@F_RecCode,@F_CusID,@F_Type,@F_Direction,@F_Complained,@F_Content,
  47. @F_Remark,@F_CreateBy,@F_CreateOn,@F_IsDelete,@F_DeleteOn,@F_DeleteBy,@F_Tel,@F_CallId,
  48. @F_userName,@F_userPhone,@F_userSex,@F_userProvince,@F_userCity,@F_userArea,@F_ProblemType,@F_Unit,
  49. @F_UnitOffice,@F_CaseParty,@F_CitizensType,@F_PutRecord,@F_ZXZType,@F_CasePartyId,@F_ProblemTypeB,@F_userAddress,@F_InnerType
  50. )");
  51. strSql.Append(";select @@IDENTITY");
  52. SqlParameter[] parameters = {
  53. new SqlParameter("@F_RecCode", SqlDbType.NVarChar,50),
  54. new SqlParameter("@F_CusID", SqlDbType.Int,4),
  55. new SqlParameter("@F_Type", SqlDbType.Int,4),
  56. new SqlParameter("@F_Direction", SqlDbType.Int,4),
  57. new SqlParameter("@F_Complained", SqlDbType.VarChar,2000),
  58. new SqlParameter("@F_Content", SqlDbType.VarChar),
  59. new SqlParameter("@F_Remark", SqlDbType.VarChar),
  60. new SqlParameter("@F_CreateBy", SqlDbType.VarChar,50),
  61. new SqlParameter("@F_CreateOn", SqlDbType.DateTime),
  62. new SqlParameter("@F_IsDelete", SqlDbType.Int,4),
  63. new SqlParameter("@F_DeleteOn", SqlDbType.VarChar,50),
  64. new SqlParameter("@F_DeleteBy", SqlDbType.DateTime),
  65. new SqlParameter("@F_Tel", SqlDbType.VarChar,200),
  66. new SqlParameter("@F_CallId", SqlDbType.VarChar,50),
  67. new SqlParameter("@F_userName", SqlDbType.VarChar,50),
  68. new SqlParameter("@F_userPhone", SqlDbType.VarChar,50),
  69. new SqlParameter("@F_userSex", SqlDbType.VarChar,50),
  70. new SqlParameter("@F_userProvince", SqlDbType.VarChar,50),
  71. new SqlParameter("@F_userCity", SqlDbType.VarChar,50),
  72. new SqlParameter("@F_userArea", SqlDbType.VarChar,50),
  73. new SqlParameter("@F_ProblemType", SqlDbType.VarChar,50) ,
  74. new SqlParameter("@F_Unit", SqlDbType.VarChar,50),
  75. new SqlParameter("@F_UnitOffice", SqlDbType.VarChar,50),
  76. new SqlParameter("@F_CaseParty", SqlDbType.VarChar,50),
  77. new SqlParameter("@F_CitizensType", SqlDbType.VarChar,50),
  78. new SqlParameter("@F_PutRecord", SqlDbType.VarChar,50) ,
  79. new SqlParameter("@F_ZXZType", SqlDbType.VarChar,50),
  80. new SqlParameter("@F_CasePartyId", SqlDbType.Int,4),
  81. new SqlParameter("@F_ProblemTypeB", SqlDbType.VarChar,50),
  82. new SqlParameter("@F_userAddress", SqlDbType.VarChar,50),
  83. new SqlParameter("@F_InnerType", SqlDbType.Int,4)
  84. };
  85. parameters[0].Value = model.F_RecCode;
  86. parameters[1].Value = model.F_CusID;
  87. parameters[2].Value = model.F_Type;
  88. parameters[3].Value = model.F_Direction;
  89. parameters[4].Value = model.F_Complained;
  90. parameters[5].Value = model.F_Content;
  91. parameters[6].Value = model.F_Remark;
  92. parameters[7].Value = model.F_CreateBy;
  93. parameters[8].Value = model.F_CreateOn;
  94. parameters[9].Value = model.F_IsDelete;
  95. parameters[10].Value = model.F_DeleteOn;
  96. parameters[11].Value = model.F_DeleteBy;
  97. parameters[12].Value = model.F_Tel;
  98. parameters[13].Value = model.F_CallId;
  99. parameters[14].Value = model.F_userName;
  100. parameters[15].Value = model.F_userPhone;
  101. parameters[16].Value = model.F_userSex;
  102. parameters[17].Value = model.F_userProvince;
  103. parameters[18].Value = model.F_userCity;
  104. parameters[19].Value = model.F_userArea;
  105. parameters[20].Value = model.F_ProblemType;
  106. parameters[21].Value = model.F_Unit;
  107. parameters[22].Value = model.F_UnitOffice;
  108. parameters[23].Value = model.F_CaseParty;
  109. parameters[24].Value = model.F_CitizensType;
  110. parameters[25].Value = model.F_PutRecord;
  111. parameters[26].Value = model.F_ZXZType;
  112. parameters[27].Value = model.F_CasePartyId;
  113. parameters[28].Value = model.F_ProblemTypeB;
  114. parameters[29].Value = model.F_userAddress;
  115. parameters[30].Value = model.F_InnerType;
  116. object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
  117. if (obj == null)
  118. {
  119. return 0;
  120. }
  121. else
  122. {
  123. return Convert.ToInt32(obj);
  124. }
  125. }
  126. /// <summary>
  127. /// 更新一条数据
  128. /// </summary>
  129. public bool Update(CallCenterApi.Model.T_Rec_RegRecordsCallOut model)
  130. {
  131. StringBuilder strSql = new StringBuilder();
  132. strSql.Append("update T_Rec_RegRecordsCallOut set ");
  133. strSql.Append("F_RecCode=@F_RecCode,");
  134. strSql.Append("F_CusID=@F_CusID,");
  135. strSql.Append("F_Type=@F_Type,");
  136. strSql.Append("F_Direction=@F_Direction,");
  137. strSql.Append("F_Complained=@F_Complained,");
  138. strSql.Append("F_Content=@F_Content,");
  139. strSql.Append("F_Remark=@F_Remark,");
  140. strSql.Append("F_CreateBy=@F_CreateBy,");
  141. strSql.Append("F_CreateOn=@F_CreateOn,");
  142. strSql.Append("F_IsDelete=@F_IsDelete,");
  143. strSql.Append("F_DeleteOn=@F_DeleteOn,");
  144. strSql.Append("F_DeleteBy=@F_DeleteBy,");
  145. strSql.Append("F_Tel=@F_Tel,");
  146. strSql.Append("F_CallId=@F_CallId,");
  147. strSql.Append("F_userName =@F_userName,");
  148. strSql.Append("F_userPhone =@F_userPhone,");
  149. strSql.Append("F_userSex =@F_userSex,");
  150. strSql.Append("F_userProvince=@F_userProvince,");
  151. strSql.Append("F_userCity =@F_userCity,");
  152. strSql.Append("F_userArea =@F_userArea,");
  153. strSql.Append("F_ProblemType =@F_ProblemType,");
  154. strSql.Append("F_Unit =@F_Unit, ");
  155. strSql.Append("F_UnitOffice =@F_UnitOffice,");
  156. strSql.Append("F_CaseParty =@F_CaseParty,");
  157. strSql.Append("F_CitizensType=@F_CitizensType,");
  158. strSql.Append("F_PutRecord =@F_PutRecord,");
  159. strSql.Append("F_ZXZType =@F_ZXZType,");
  160. strSql.Append("F_CasePartyId =@F_CasePartyId,");
  161. strSql.Append("F_ProblemTypeB =@F_ProblemTypeB,");
  162. strSql.Append("F_userAddress =@F_userAddress,");
  163. strSql.Append("F_InnerType =@F_InnerType");
  164. strSql.Append(" where F_ID=@F_ID");
  165. SqlParameter[] parameters = {
  166. new SqlParameter("@F_RecCode", SqlDbType.NVarChar,50),
  167. new SqlParameter("@F_CusID", SqlDbType.Int,4),
  168. new SqlParameter("@F_Type", SqlDbType.Int,4),
  169. new SqlParameter("@F_Direction", SqlDbType.Int,4),
  170. new SqlParameter("@F_Complained", SqlDbType.VarChar,2000),
  171. new SqlParameter("@F_Content", SqlDbType.VarChar),
  172. new SqlParameter("@F_Remark", SqlDbType.VarChar),
  173. new SqlParameter("@F_CreateBy", SqlDbType.VarChar,50),
  174. new SqlParameter("@F_CreateOn", SqlDbType.DateTime),
  175. new SqlParameter("@F_IsDelete", SqlDbType.Int,4),
  176. new SqlParameter("@F_DeleteOn", SqlDbType.VarChar,50),
  177. new SqlParameter("@F_DeleteBy", SqlDbType.DateTime),
  178. new SqlParameter("@F_Tel", SqlDbType.VarChar,200),
  179. new SqlParameter("@F_CallId", SqlDbType.VarChar,50),
  180. new SqlParameter("@F_ID", SqlDbType.Int,4),
  181. new SqlParameter("@F_userName", SqlDbType.VarChar,50),
  182. new SqlParameter("@F_userPhone", SqlDbType.VarChar,50),
  183. new SqlParameter("@F_userSex", SqlDbType.VarChar,50),
  184. new SqlParameter("@F_userProvince", SqlDbType.VarChar,50),
  185. new SqlParameter("@F_userCity", SqlDbType.VarChar,50),
  186. new SqlParameter("@F_userArea", SqlDbType.VarChar,50),
  187. new SqlParameter("@F_ProblemType", SqlDbType.VarChar,50) ,
  188. new SqlParameter("@F_Unit", SqlDbType.VarChar,50),
  189. new SqlParameter("@F_UnitOffice", SqlDbType.VarChar,50),
  190. new SqlParameter("@F_CaseParty", SqlDbType.VarChar,50),
  191. new SqlParameter("@F_CitizensType", SqlDbType.VarChar,50),
  192. new SqlParameter("@F_PutRecord", SqlDbType.VarChar,50),
  193. new SqlParameter("@F_ZXZType", SqlDbType.VarChar,50),
  194. new SqlParameter("@F_CasePartyId", SqlDbType.Int,4),
  195. new SqlParameter("@F_ProblemTypeB", SqlDbType.VarChar,50),
  196. new SqlParameter("@F_userAddress", SqlDbType.VarChar,150),
  197. new SqlParameter("@F_InnerType",SqlDbType.Int,4)
  198. };
  199. parameters[0].Value = model.F_RecCode;
  200. parameters[1].Value = model.F_CusID;
  201. parameters[2].Value = model.F_Type;
  202. parameters[3].Value = model.F_Direction;
  203. parameters[4].Value = model.F_Complained;
  204. parameters[5].Value = model.F_Content;
  205. parameters[6].Value = model.F_Remark;
  206. parameters[7].Value = model.F_CreateBy;
  207. parameters[8].Value = model.F_CreateOn;
  208. parameters[9].Value = model.F_IsDelete;
  209. parameters[10].Value = model.F_DeleteOn;
  210. parameters[11].Value = model.F_DeleteBy;
  211. parameters[12].Value = model.F_Tel;
  212. parameters[13].Value = model.F_CallId;
  213. parameters[14].Value = model.F_ID;
  214. parameters[15].Value = model.F_userName;
  215. parameters[16].Value = model.F_userPhone;
  216. parameters[17].Value = model.F_userSex;
  217. parameters[18].Value = model.F_userProvince;
  218. parameters[19].Value = model.F_userCity;
  219. parameters[20].Value = model.F_userArea;
  220. parameters[21].Value = model.F_ProblemType;
  221. parameters[22].Value = model.F_Unit;
  222. parameters[23].Value = model.F_UnitOffice;
  223. parameters[24].Value = model.F_CaseParty;
  224. parameters[25].Value = model.F_CitizensType;
  225. parameters[26].Value = model.F_PutRecord;
  226. parameters[27].Value = model.F_ZXZType;
  227. parameters[28].Value = model.F_CasePartyId;
  228. parameters[29].Value = model.F_ProblemTypeB;
  229. parameters[30].Value = model.F_userAddress;
  230. parameters[31].Value = model.F_InnerType;
  231. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  232. if (rows > 0)
  233. {
  234. return true;
  235. }
  236. else
  237. {
  238. return false;
  239. }
  240. }
  241. /// <summary>
  242. /// 是否可拨打电话 有正在通话中的电话不允许外呼
  243. /// </summary>
  244. public bool GetFlag(int userid)
  245. {
  246. int rows =Convert.ToInt32(DbHelperSQL.GetSingle(string.Format("select count(1) from T_Rec_RegRecordsCallOut where F_RecCode='0' and F_CreateBy=(select F_Mobile from T_Sys_UserAccount where F_UserId={0}) AND (select count(1) from T_Rec_RegRecordsCallOut where F_RecCode='1' and F_CreateBy=(select F_Mobile from T_Sys_UserAccount where F_UserId={0}))=0", userid)));
  247. if (rows > 0)
  248. {
  249. return true;
  250. }
  251. else
  252. {
  253. return false;
  254. }
  255. }
  256. /// <summary>
  257. /// 重置电话
  258. /// </summary>
  259. public bool Update0(string id)
  260. {
  261. int rows = DbHelperSQL.ExecuteSql("update T_Rec_RegRecordsCallOut set F_RecCode='0' where F_RecCode='2' AND F_Id=" + id);
  262. if (rows > 0)
  263. {
  264. return true;
  265. }
  266. else
  267. {
  268. return false;
  269. }
  270. }
  271. /// <summary>
  272. /// 开始电话
  273. /// </summary>
  274. public bool Update(string id)
  275. {
  276. int rows = DbHelperSQL.ExecuteSql("update T_Rec_RegRecordsCallOut set F_RecCode='1' where F_RecCode='0' AND F_Id=" + id);
  277. if (rows > 0)
  278. {
  279. return true;
  280. }
  281. else
  282. {
  283. return false;
  284. }
  285. }
  286. /// <summary>
  287. /// 挂断电话 可继续拨打电话
  288. /// </summary>
  289. public bool Update2(int userid,string phone)
  290. {
  291. int rows = DbHelperSQL.ExecuteSql(string.Format("update T_Rec_RegRecordsCallOut set F_RecCode='2' where F_userPhone='{0}' AND F_RecCode = '1' and F_CreateBy = (select F_Mobile from T_Sys_UserAccount where F_UserId ={1} )",phone,userid));
  292. if (rows > 0)
  293. {
  294. return true;
  295. }
  296. else
  297. {
  298. return false;
  299. }
  300. }
  301. /// <summary>
  302. /// 删除一条数据
  303. /// </summary>
  304. public bool Delete(int F_ID)
  305. {
  306. StringBuilder strSql = new StringBuilder();
  307. strSql.Append("delete from T_Rec_RegRecordsCallOut ");
  308. strSql.Append(" where F_ID=@F_ID");
  309. SqlParameter[] parameters = {
  310. new SqlParameter("@F_ID", SqlDbType.Int,4)
  311. };
  312. parameters[0].Value = F_ID;
  313. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  314. if (rows > 0)
  315. {
  316. return true;
  317. }
  318. else
  319. {
  320. return false;
  321. }
  322. }
  323. /// <summary>
  324. /// 批量删除数据
  325. /// </summary>
  326. public bool DeleteList(string F_IDlist)
  327. {
  328. StringBuilder strSql = new StringBuilder();
  329. strSql.Append("delete from T_Rec_RegRecordsCallOut ");
  330. strSql.Append(" where F_ID in (" + F_IDlist + ") ");
  331. int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
  332. if (rows > 0)
  333. {
  334. return true;
  335. }
  336. else
  337. {
  338. return false;
  339. }
  340. }
  341. /// <summary>
  342. /// 得到一个对象实体
  343. /// </summary>
  344. public CallCenterApi.Model.T_Rec_RegRecordsCallOut GetModel(int F_ID)
  345. {
  346. StringBuilder strSql = new StringBuilder();
  347. strSql.Append("select top 1 * from T_Rec_RegRecordsCallOut ");
  348. strSql.Append(" where F_ID=@F_ID");
  349. SqlParameter[] parameters = {
  350. new SqlParameter("@F_ID", SqlDbType.Int,4)
  351. };
  352. parameters[0].Value = F_ID;
  353. CallCenterApi.Model.T_Rec_RegRecordsCallOut model = new CallCenterApi.Model.T_Rec_RegRecordsCallOut();
  354. DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
  355. if (ds.Tables[0].Rows.Count > 0)
  356. {
  357. return DataRowToModel(ds.Tables[0].Rows[0]);
  358. }
  359. else
  360. {
  361. return null;
  362. }
  363. }
  364. /// <summary>
  365. /// 得到一个对象实体
  366. /// </summary>
  367. public CallCenterApi.Model.T_Rec_RegRecordsCallOut DataRowToModel(DataRow row)
  368. {
  369. CallCenterApi.Model.T_Rec_RegRecordsCallOut model = new CallCenterApi.Model.T_Rec_RegRecordsCallOut();
  370. if (row != null)
  371. {
  372. if (row["F_ID"] != null && row["F_ID"].ToString() != "")
  373. {
  374. model.F_ID = int.Parse(row["F_ID"].ToString());
  375. }
  376. if (row["F_RecCode"] != null && row["F_RecCode"].ToString() != "")
  377. {
  378. model.F_RecCode = row["F_RecCode"].ToString();
  379. }
  380. if (row["F_CusID"] != null && row["F_CusID"].ToString() != "")
  381. {
  382. model.F_CusID = int.Parse(row["F_CusID"].ToString());
  383. }
  384. if (row["F_Type"] != null && row["F_Type"].ToString() != "")
  385. {
  386. model.F_Type = int.Parse(row["F_Type"].ToString());
  387. }
  388. if (row["F_Direction"] != null && row["F_Direction"].ToString() != "")
  389. {
  390. model.F_Direction = int.Parse(row["F_Direction"].ToString());
  391. }
  392. if (row["F_Complained"] != null && row["F_Complained"].ToString() != "")
  393. {
  394. model.F_Complained = row["F_Complained"].ToString();
  395. }
  396. if (row["F_Content"] != null && row["F_Content"].ToString() != "")
  397. {
  398. model.F_Content = row["F_Content"].ToString();
  399. }
  400. if (row["F_Remark"] != null && row["F_Remark"].ToString() != "")
  401. {
  402. model.F_Remark = row["F_Remark"].ToString();
  403. }
  404. if (row["F_CreateBy"] != null && row["F_CreateBy"].ToString() != "")
  405. {
  406. model.F_CreateBy = row["F_CreateBy"].ToString();
  407. }
  408. if (row["F_CreateOn"] != null && row["F_CreateOn"].ToString() != "")
  409. {
  410. model.F_CreateOn = DateTime.Parse(row["F_CreateOn"].ToString());
  411. }
  412. if (row["F_IsDelete"] != null && row["F_IsDelete"].ToString() != "")
  413. {
  414. model.F_IsDelete = int.Parse(row["F_IsDelete"].ToString());
  415. }
  416. if (row["F_DeleteOn"] != null && row["F_DeleteOn"].ToString() != "")
  417. {
  418. model.F_DeleteOn = row["F_DeleteOn"].ToString();
  419. }
  420. if (row["F_DeleteBy"] != null && row["F_DeleteBy"].ToString() != "")
  421. {
  422. model.F_DeleteBy = DateTime.Parse(row["F_DeleteBy"].ToString());
  423. }
  424. if (row["F_Tel"] != null && row["F_Tel"].ToString() != "")
  425. {
  426. model.F_Tel = row["F_Tel"].ToString();
  427. }
  428. if (row["F_CallId"] != null && row["F_CallId"].ToString() != "")
  429. {
  430. model.F_CallId = row["F_CallId"].ToString();
  431. }
  432. if (row["F_userName"] != null && row["F_userName"].ToString() != "")
  433. { model.F_userName = row["F_userName"].ToString(); }
  434. if (row["F_userPhone"] != null && row["F_userPhone"].ToString() != "")
  435. { model.F_userPhone = row["F_userPhone"].ToString(); }
  436. if (row["F_userSex"] != null && row["F_userSex"].ToString() != "")
  437. { model.F_userSex = row["F_userSex"].ToString(); }
  438. if (row["F_userProvince"] != null && row["F_userProvince"].ToString() != "")
  439. { model.F_userProvince = row["F_userProvince"].ToString(); }
  440. if (row["F_userCity"] != null && row["F_userCity"].ToString() != "")
  441. { model.F_userCity = row["F_userCity"].ToString(); }
  442. if (row["F_userArea"] != null && row["F_userArea"].ToString() != "")
  443. { model.F_userArea = row["F_userArea"].ToString(); }
  444. if (row["F_ProblemType"] != null && row["F_ProblemType"].ToString() != "")
  445. { model.F_ProblemType = row["F_ProblemType"].ToString(); }
  446. if (row["F_Unit"] != null && row["F_Unit"].ToString() != "")
  447. { model.F_Unit = row["F_Unit"].ToString(); }
  448. if (row["F_UnitOffice"] != null && row["F_UnitOffice"].ToString() != "")
  449. { model.F_UnitOffice = row["F_UnitOffice"].ToString(); }
  450. if (row["F_CaseParty"] != null && row["F_CaseParty"].ToString() != "")
  451. { model.F_CaseParty = row["F_CaseParty"].ToString(); }
  452. if (row["F_CitizensType"] != null && row["F_CitizensType"].ToString() != "")
  453. { model.F_CitizensType = row["F_CitizensType"].ToString(); }
  454. if (row["F_PutRecord"] != null && row["F_PutRecord"].ToString() != "")
  455. { model.F_PutRecord = row["F_PutRecord"].ToString(); }
  456. if (row["F_ZXZType"] != null && row["F_ZXZType"].ToString() != "")
  457. { model.F_ZXZType = row["F_ZXZType"].ToString(); }
  458. if (row["F_CasePartyId"] != null && row["F_CasePartyId"].ToString() != "")
  459. {
  460. model.F_CasePartyId = int.Parse(row["F_CasePartyId"].ToString());
  461. }
  462. if (row["F_ProblemTypeB"] != null && row["F_ProblemTypeB"].ToString() != "")
  463. { model.F_ProblemTypeB = row["F_ProblemTypeB"].ToString(); }
  464. if (row["F_userAddress"] != null && row["F_userAddress"].ToString() != "")
  465. { model.F_userAddress = row["F_userAddress"].ToString(); }
  466. if (row["F_InnerType"] != null && row["F_InnerType"].ToString() != "")
  467. {
  468. model.F_InnerType = int.Parse(row["F_InnerType"].ToString());
  469. }
  470. }
  471. return model;
  472. }
  473. /// <summary>
  474. /// 获得数据列表
  475. /// </summary>
  476. public DataSet GetList(string strWhere)
  477. {
  478. StringBuilder strSql = new StringBuilder();
  479. strSql.Append("select * ");
  480. strSql.Append(" FROM T_Rec_RegRecordsCallOut ");
  481. if (strWhere.Trim() != "")
  482. {
  483. strSql.Append(" where " + strWhere);
  484. }
  485. return DbHelperSQL.Query(strSql.ToString());
  486. }
  487. /// <summary>
  488. /// 获得前几行数据
  489. /// </summary>
  490. public DataSet GetList(int Top, string strWhere, string filedOrder)
  491. {
  492. StringBuilder strSql = new StringBuilder();
  493. strSql.Append("select ");
  494. if (Top > 0)
  495. {
  496. strSql.Append(" top " + Top.ToString());
  497. }
  498. strSql.Append(" * ");
  499. strSql.Append(" FROM T_Rec_RegRecordsCallOut ");
  500. if (strWhere.Trim() != "")
  501. {
  502. strSql.Append(" where " + strWhere);
  503. }
  504. strSql.Append(" order by " + filedOrder);
  505. return DbHelperSQL.Query(strSql.ToString());
  506. }
  507. /// <summary>
  508. /// 获取记录总数
  509. /// </summary>
  510. public int GetRecordCount(string strWhere)
  511. {
  512. StringBuilder strSql = new StringBuilder();
  513. strSql.Append("select count(1) FROM T_Rec_RegRecordsCallOut ");
  514. if (strWhere.Trim() != "")
  515. {
  516. strSql.Append(" where " + strWhere);
  517. }
  518. object obj = DbHelperSQL.GetSingle(strSql.ToString());
  519. if (obj == null)
  520. {
  521. return 0;
  522. }
  523. else
  524. {
  525. return Convert.ToInt32(obj);
  526. }
  527. }
  528. /// <summary>
  529. /// 分页获取数据列表
  530. /// </summary>
  531. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  532. {
  533. StringBuilder strSql = new StringBuilder();
  534. strSql.Append("SELECT * FROM ( ");
  535. strSql.Append(" SELECT ROW_NUMBER() OVER (");
  536. if (!string.IsNullOrEmpty(orderby.Trim()))
  537. {
  538. strSql.Append("order by T." + orderby);
  539. }
  540. else
  541. {
  542. strSql.Append("order by T.F_ID desc");
  543. }
  544. strSql.Append(")AS Row, T.* from T_Rec_RegRecordsCallOut T ");
  545. if (!string.IsNullOrEmpty(strWhere.Trim()))
  546. {
  547. strSql.Append(" WHERE " + strWhere);
  548. }
  549. strSql.Append(" ) TT");
  550. strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
  551. return DbHelperSQL.Query(strSql.ToString());
  552. }
  553. #endregion Method
  554. }
  555. }