No Description

T_Sys_Customer.cs 28KB

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