鹤壁电销版 自用

T_CTI_Task.cs 26KB

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