市长热线演示版

T_Cus_CustomerExpand.cs 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. /** 版本信息模板在安装目录下,可自行修改。
  2. * T_Cus_CustomerExpand.cs
  3. *
  4. * 功 能: N/A
  5. * 类 名: T_Cus_CustomerExpand
  6. *
  7. * Ver 变更日期 负责人 变更内容
  8. * ───────────────────────────────────
  9. * V0.01 2015/2/27 16:06:05 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 HySoft.DBUtility;//Please add references
  22. namespace HySoft.BaseCallCenter.DAL
  23. {
  24. /// <summary>
  25. /// 数据访问类:T_Cus_CustomerExpand
  26. /// </summary>
  27. public partial class T_Cus_CustomerExpand
  28. {
  29. public T_Cus_CustomerExpand()
  30. {}
  31. #region BasicMethod
  32. /// <summary>
  33. /// 是否存在该记录
  34. /// </summary>
  35. public bool Exists(Guid F_ExpandId)
  36. {
  37. StringBuilder strSql=new StringBuilder();
  38. strSql.Append("select count(1) from T_Cus_CustomerExpand");
  39. strSql.Append(" where F_ExpandId=@F_ExpandId ");
  40. SqlParameter[] parameters = {
  41. new SqlParameter("@F_ExpandId", SqlDbType.UniqueIdentifier,16) };
  42. parameters[0].Value = F_ExpandId;
  43. return DbHelperSQL.Exists(strSql.ToString(),parameters);
  44. }
  45. /// <summary>
  46. /// 增加一条数据
  47. /// </summary>
  48. public bool Add(HySoft.BaseCallCenter.Model.T_Cus_CustomerExpand model)
  49. {
  50. StringBuilder strSql=new StringBuilder();
  51. strSql.Append("insert into T_Cus_CustomerExpand(");
  52. strSql.Append("F_ExpandId,F_CustomerId,F_StrExpand1,F_StrExpand2,F_StrExpand3,F_StrExpand4,F_StrExpand5,F_StrExpand6,F_TypeExpand1,F_TypeExpand2,F_IntExpand1,F_IntExpand2,F_TimeExpand1,F_TimeExpand2,F_TextExpand1,F_TextExpand2)");
  53. strSql.Append(" values (");
  54. strSql.Append("@F_ExpandId,@F_CustomerId,@F_StrExpand1,@F_StrExpand2,@F_StrExpand3,@F_StrExpand4,@F_StrExpand5,@F_StrExpand6,@F_TypeExpand1,@F_TypeExpand2,@F_IntExpand1,@F_IntExpand2,@F_TimeExpand1,@F_TimeExpand2,@F_TextExpand1,@F_TextExpand2)");
  55. SqlParameter[] parameters = {
  56. new SqlParameter("@F_ExpandId", SqlDbType.UniqueIdentifier,16),
  57. new SqlParameter("@F_CustomerId", SqlDbType.UniqueIdentifier,16),
  58. new SqlParameter("@F_StrExpand1", SqlDbType.NVarChar,200),
  59. new SqlParameter("@F_StrExpand2", SqlDbType.NVarChar,200),
  60. new SqlParameter("@F_StrExpand3", SqlDbType.NVarChar,200),
  61. new SqlParameter("@F_StrExpand4", SqlDbType.NVarChar,200),
  62. new SqlParameter("@F_StrExpand5", SqlDbType.NVarChar,200),
  63. new SqlParameter("@F_StrExpand6", SqlDbType.NVarChar,200),
  64. new SqlParameter("@F_TypeExpand1", SqlDbType.NVarChar,50),
  65. new SqlParameter("@F_TypeExpand2", SqlDbType.NVarChar,50),
  66. new SqlParameter("@F_IntExpand1", SqlDbType.Int,4),
  67. new SqlParameter("@F_IntExpand2", SqlDbType.Int,4),
  68. new SqlParameter("@F_TimeExpand1", SqlDbType.DateTime),
  69. new SqlParameter("@F_TimeExpand2", SqlDbType.DateTime),
  70. new SqlParameter("@F_TextExpand1", SqlDbType.Text),
  71. new SqlParameter("@F_TextExpand2", SqlDbType.Text)};
  72. parameters[0].Value = Guid.NewGuid();
  73. parameters[1].Value = Guid.NewGuid();
  74. parameters[2].Value = model.F_StrExpand1;
  75. parameters[3].Value = model.F_StrExpand2;
  76. parameters[4].Value = model.F_StrExpand3;
  77. parameters[5].Value = model.F_StrExpand4;
  78. parameters[6].Value = model.F_StrExpand5;
  79. parameters[7].Value = model.F_StrExpand6;
  80. parameters[8].Value = model.F_TypeExpand1;
  81. parameters[9].Value = model.F_TypeExpand2;
  82. parameters[10].Value = model.F_IntExpand1;
  83. parameters[11].Value = model.F_IntExpand2;
  84. parameters[12].Value = model.F_TimeExpand1;
  85. parameters[13].Value = model.F_TimeExpand2;
  86. parameters[14].Value = model.F_TextExpand1;
  87. parameters[15].Value = model.F_TextExpand2;
  88. int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
  89. if (rows > 0)
  90. {
  91. return true;
  92. }
  93. else
  94. {
  95. return false;
  96. }
  97. }
  98. /// <summary>
  99. /// 更新一条数据
  100. /// </summary>
  101. public bool Update(HySoft.BaseCallCenter.Model.T_Cus_CustomerExpand model)
  102. {
  103. StringBuilder strSql=new StringBuilder();
  104. strSql.Append("update T_Cus_CustomerExpand set ");
  105. strSql.Append("F_CustomerId=@F_CustomerId,");
  106. strSql.Append("F_StrExpand1=@F_StrExpand1,");
  107. strSql.Append("F_StrExpand2=@F_StrExpand2,");
  108. strSql.Append("F_StrExpand3=@F_StrExpand3,");
  109. strSql.Append("F_StrExpand4=@F_StrExpand4,");
  110. strSql.Append("F_StrExpand5=@F_StrExpand5,");
  111. strSql.Append("F_StrExpand6=@F_StrExpand6,");
  112. strSql.Append("F_TypeExpand1=@F_TypeExpand1,");
  113. strSql.Append("F_TypeExpand2=@F_TypeExpand2,");
  114. strSql.Append("F_IntExpand1=@F_IntExpand1,");
  115. strSql.Append("F_IntExpand2=@F_IntExpand2,");
  116. strSql.Append("F_TimeExpand1=@F_TimeExpand1,");
  117. strSql.Append("F_TimeExpand2=@F_TimeExpand2,");
  118. strSql.Append("F_TextExpand1=@F_TextExpand1,");
  119. strSql.Append("F_TextExpand2=@F_TextExpand2");
  120. strSql.Append(" where F_ExpandId=@F_ExpandId ");
  121. SqlParameter[] parameters = {
  122. new SqlParameter("@F_CustomerId", SqlDbType.UniqueIdentifier,16),
  123. new SqlParameter("@F_StrExpand1", SqlDbType.NVarChar,200),
  124. new SqlParameter("@F_StrExpand2", SqlDbType.NVarChar,200),
  125. new SqlParameter("@F_StrExpand3", SqlDbType.NVarChar,200),
  126. new SqlParameter("@F_StrExpand4", SqlDbType.NVarChar,200),
  127. new SqlParameter("@F_StrExpand5", SqlDbType.NVarChar,200),
  128. new SqlParameter("@F_StrExpand6", SqlDbType.NVarChar,200),
  129. new SqlParameter("@F_TypeExpand1", SqlDbType.NVarChar,50),
  130. new SqlParameter("@F_TypeExpand2", SqlDbType.NVarChar,50),
  131. new SqlParameter("@F_IntExpand1", SqlDbType.Int,4),
  132. new SqlParameter("@F_IntExpand2", SqlDbType.Int,4),
  133. new SqlParameter("@F_TimeExpand1", SqlDbType.DateTime),
  134. new SqlParameter("@F_TimeExpand2", SqlDbType.DateTime),
  135. new SqlParameter("@F_TextExpand1", SqlDbType.Text),
  136. new SqlParameter("@F_TextExpand2", SqlDbType.Text),
  137. new SqlParameter("@F_ExpandId", SqlDbType.UniqueIdentifier,16)};
  138. parameters[0].Value = model.F_CustomerId;
  139. parameters[1].Value = model.F_StrExpand1;
  140. parameters[2].Value = model.F_StrExpand2;
  141. parameters[3].Value = model.F_StrExpand3;
  142. parameters[4].Value = model.F_StrExpand4;
  143. parameters[5].Value = model.F_StrExpand5;
  144. parameters[6].Value = model.F_StrExpand6;
  145. parameters[7].Value = model.F_TypeExpand1;
  146. parameters[8].Value = model.F_TypeExpand2;
  147. parameters[9].Value = model.F_IntExpand1;
  148. parameters[10].Value = model.F_IntExpand2;
  149. parameters[11].Value = model.F_TimeExpand1;
  150. parameters[12].Value = model.F_TimeExpand2;
  151. parameters[13].Value = model.F_TextExpand1;
  152. parameters[14].Value = model.F_TextExpand2;
  153. parameters[15].Value = model.F_ExpandId;
  154. int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
  155. if (rows > 0)
  156. {
  157. return true;
  158. }
  159. else
  160. {
  161. return false;
  162. }
  163. }
  164. /// <summary>
  165. /// 删除一条数据
  166. /// </summary>
  167. public bool Delete(Guid F_ExpandId)
  168. {
  169. StringBuilder strSql=new StringBuilder();
  170. strSql.Append("delete from T_Cus_CustomerExpand ");
  171. strSql.Append(" where F_ExpandId=@F_ExpandId ");
  172. SqlParameter[] parameters = {
  173. new SqlParameter("@F_ExpandId", SqlDbType.UniqueIdentifier,16) };
  174. parameters[0].Value = F_ExpandId;
  175. int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
  176. if (rows > 0)
  177. {
  178. return true;
  179. }
  180. else
  181. {
  182. return false;
  183. }
  184. }
  185. /// <summary>
  186. /// 批量删除数据
  187. /// </summary>
  188. public bool DeleteList(string F_ExpandIdlist )
  189. {
  190. StringBuilder strSql=new StringBuilder();
  191. strSql.Append("delete from T_Cus_CustomerExpand ");
  192. strSql.Append(" where F_ExpandId in ("+F_ExpandIdlist + ") ");
  193. int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
  194. if (rows > 0)
  195. {
  196. return true;
  197. }
  198. else
  199. {
  200. return false;
  201. }
  202. }
  203. /// <summary>
  204. /// 得到一个对象实体
  205. /// </summary>
  206. public HySoft.BaseCallCenter.Model.T_Cus_CustomerExpand GetModel(Guid F_ExpandId)
  207. {
  208. StringBuilder strSql=new StringBuilder();
  209. strSql.Append("select top 1 F_ExpandId,F_CustomerId,F_StrExpand1,F_StrExpand2,F_StrExpand3,F_StrExpand4,F_StrExpand5,F_StrExpand6,F_TypeExpand1,F_TypeExpand2,F_IntExpand1,F_IntExpand2,F_TimeExpand1,F_TimeExpand2,F_TextExpand1,F_TextExpand2 from T_Cus_CustomerExpand ");
  210. strSql.Append(" where F_ExpandId=@F_ExpandId ");
  211. SqlParameter[] parameters = {
  212. new SqlParameter("@F_ExpandId", SqlDbType.UniqueIdentifier,16) };
  213. parameters[0].Value = F_ExpandId;
  214. HySoft.BaseCallCenter.Model.T_Cus_CustomerExpand model=new HySoft.BaseCallCenter.Model.T_Cus_CustomerExpand();
  215. DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
  216. if(ds.Tables[0].Rows.Count>0)
  217. {
  218. return DataRowToModel(ds.Tables[0].Rows[0]);
  219. }
  220. else
  221. {
  222. return null;
  223. }
  224. }
  225. /// <summary>
  226. /// 得到一个对象实体
  227. /// </summary>
  228. public HySoft.BaseCallCenter.Model.T_Cus_CustomerExpand DataRowToModel(DataRow row)
  229. {
  230. HySoft.BaseCallCenter.Model.T_Cus_CustomerExpand model=new HySoft.BaseCallCenter.Model.T_Cus_CustomerExpand();
  231. if (row != null)
  232. {
  233. if(row["F_ExpandId"]!=null && row["F_ExpandId"].ToString()!="")
  234. {
  235. model.F_ExpandId= new Guid(row["F_ExpandId"].ToString());
  236. }
  237. if(row["F_CustomerId"]!=null && row["F_CustomerId"].ToString()!="")
  238. {
  239. model.F_CustomerId= new Guid(row["F_CustomerId"].ToString());
  240. }
  241. if(row["F_StrExpand1"]!=null)
  242. {
  243. model.F_StrExpand1=row["F_StrExpand1"].ToString();
  244. }
  245. if(row["F_StrExpand2"]!=null)
  246. {
  247. model.F_StrExpand2=row["F_StrExpand2"].ToString();
  248. }
  249. if(row["F_StrExpand3"]!=null)
  250. {
  251. model.F_StrExpand3=row["F_StrExpand3"].ToString();
  252. }
  253. if(row["F_StrExpand4"]!=null)
  254. {
  255. model.F_StrExpand4=row["F_StrExpand4"].ToString();
  256. }
  257. if(row["F_StrExpand5"]!=null)
  258. {
  259. model.F_StrExpand5=row["F_StrExpand5"].ToString();
  260. }
  261. if(row["F_StrExpand6"]!=null)
  262. {
  263. model.F_StrExpand6=row["F_StrExpand6"].ToString();
  264. }
  265. if(row["F_TypeExpand1"]!=null)
  266. {
  267. model.F_TypeExpand1=row["F_TypeExpand1"].ToString();
  268. }
  269. if(row["F_TypeExpand2"]!=null)
  270. {
  271. model.F_TypeExpand2=row["F_TypeExpand2"].ToString();
  272. }
  273. if(row["F_IntExpand1"]!=null && row["F_IntExpand1"].ToString()!="")
  274. {
  275. model.F_IntExpand1=int.Parse(row["F_IntExpand1"].ToString());
  276. }
  277. if(row["F_IntExpand2"]!=null && row["F_IntExpand2"].ToString()!="")
  278. {
  279. model.F_IntExpand2=int.Parse(row["F_IntExpand2"].ToString());
  280. }
  281. if(row["F_TimeExpand1"]!=null && row["F_TimeExpand1"].ToString()!="")
  282. {
  283. model.F_TimeExpand1=DateTime.Parse(row["F_TimeExpand1"].ToString());
  284. }
  285. if(row["F_TimeExpand2"]!=null && row["F_TimeExpand2"].ToString()!="")
  286. {
  287. model.F_TimeExpand2=DateTime.Parse(row["F_TimeExpand2"].ToString());
  288. }
  289. if(row["F_TextExpand1"]!=null)
  290. {
  291. model.F_TextExpand1=row["F_TextExpand1"].ToString();
  292. }
  293. if(row["F_TextExpand2"]!=null)
  294. {
  295. model.F_TextExpand2=row["F_TextExpand2"].ToString();
  296. }
  297. }
  298. return model;
  299. }
  300. /// <summary>
  301. /// 获得数据列表
  302. /// </summary>
  303. public DataSet GetList(string strWhere)
  304. {
  305. StringBuilder strSql=new StringBuilder();
  306. strSql.Append("select F_ExpandId,F_CustomerId,F_StrExpand1,F_StrExpand2,F_StrExpand3,F_StrExpand4,F_StrExpand5,F_StrExpand6,F_TypeExpand1,F_TypeExpand2,F_IntExpand1,F_IntExpand2,F_TimeExpand1,F_TimeExpand2,F_TextExpand1,F_TextExpand2 ");
  307. strSql.Append(" FROM T_Cus_CustomerExpand ");
  308. if(strWhere.Trim()!="")
  309. {
  310. strSql.Append(" where "+strWhere);
  311. }
  312. return DbHelperSQL.Query(strSql.ToString());
  313. }
  314. /// <summary>
  315. /// 获得前几行数据
  316. /// </summary>
  317. public DataSet GetList(int Top,string strWhere,string filedOrder)
  318. {
  319. StringBuilder strSql=new StringBuilder();
  320. strSql.Append("select ");
  321. if(Top>0)
  322. {
  323. strSql.Append(" top "+Top.ToString());
  324. }
  325. strSql.Append(" F_ExpandId,F_CustomerId,F_StrExpand1,F_StrExpand2,F_StrExpand3,F_StrExpand4,F_StrExpand5,F_StrExpand6,F_TypeExpand1,F_TypeExpand2,F_IntExpand1,F_IntExpand2,F_TimeExpand1,F_TimeExpand2,F_TextExpand1,F_TextExpand2 ");
  326. strSql.Append(" FROM T_Cus_CustomerExpand ");
  327. if(strWhere.Trim()!="")
  328. {
  329. strSql.Append(" where "+strWhere);
  330. }
  331. strSql.Append(" order by " + filedOrder);
  332. return DbHelperSQL.Query(strSql.ToString());
  333. }
  334. /// <summary>
  335. /// 获取记录总数
  336. /// </summary>
  337. public int GetRecordCount(string strWhere)
  338. {
  339. StringBuilder strSql=new StringBuilder();
  340. strSql.Append("select count(1) FROM T_Cus_CustomerExpand ");
  341. if(strWhere.Trim()!="")
  342. {
  343. strSql.Append(" where "+strWhere);
  344. }
  345. object obj = DbHelperSQL.GetSingle(strSql.ToString());
  346. if (obj == null)
  347. {
  348. return 0;
  349. }
  350. else
  351. {
  352. return Convert.ToInt32(obj);
  353. }
  354. }
  355. /// <summary>
  356. /// 分页获取数据列表
  357. /// </summary>
  358. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  359. {
  360. StringBuilder strSql=new StringBuilder();
  361. strSql.Append("SELECT * FROM ( ");
  362. strSql.Append(" SELECT ROW_NUMBER() OVER (");
  363. if (!string.IsNullOrEmpty(orderby.Trim()))
  364. {
  365. strSql.Append("order by T." + orderby );
  366. }
  367. else
  368. {
  369. strSql.Append("order by T.F_ExpandId desc");
  370. }
  371. strSql.Append(")AS Row, T.* from T_Cus_CustomerExpand T ");
  372. if (!string.IsNullOrEmpty(strWhere.Trim()))
  373. {
  374. strSql.Append(" WHERE " + strWhere);
  375. }
  376. strSql.Append(" ) TT");
  377. strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
  378. return DbHelperSQL.Query(strSql.ToString());
  379. }
  380. /*
  381. /// <summary>
  382. /// 分页获取数据列表
  383. /// </summary>
  384. public DataSet GetList(int PageSize,int PageIndex,string strWhere)
  385. {
  386. SqlParameter[] parameters = {
  387. new SqlParameter("@tblName", SqlDbType.VarChar, 255),
  388. new SqlParameter("@fldName", SqlDbType.VarChar, 255),
  389. new SqlParameter("@PageSize", SqlDbType.Int),
  390. new SqlParameter("@PageIndex", SqlDbType.Int),
  391. new SqlParameter("@IsReCount", SqlDbType.Bit),
  392. new SqlParameter("@OrderType", SqlDbType.Bit),
  393. new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
  394. };
  395. parameters[0].Value = "T_Cus_CustomerExpand";
  396. parameters[1].Value = "F_ExpandId";
  397. parameters[2].Value = PageSize;
  398. parameters[3].Value = PageIndex;
  399. parameters[4].Value = 0;
  400. parameters[5].Value = 0;
  401. parameters[6].Value = strWhere;
  402. return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
  403. }*/
  404. #endregion BasicMethod
  405. #region ExtensionMethod
  406. #endregion ExtensionMethod
  407. }
  408. }