鹤壁电销版 自用

T_CTI_Task.cs 25KB

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