Няма описание

T_CTI_Task.cs 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data;
  6. namespace CallCenterApi.BLL
  7. {
  8. /// <summary>
  9. /// 计划表
  10. /// </summary>
  11. public partial class T_CTI_Task
  12. {
  13. private readonly CallCenterApi.DAL.T_CTI_Task dal = new CallCenterApi.DAL.T_CTI_Task();
  14. private readonly DAL.T_Call_TaskTelNum taskTelNumDAL = new DAL.T_Call_TaskTelNum();
  15. public T_CTI_Task()
  16. { }
  17. #region Method
  18. /// <summary>
  19. /// 是否存在该记录
  20. /// </summary>
  21. public bool Exists(long TaskID)
  22. {
  23. return dal.Exists(TaskID);
  24. }
  25. /// <summary>
  26. /// 增加一条数据
  27. /// </summary>
  28. public long Add(CallCenterApi.Model.T_CTI_Task model)
  29. {
  30. return dal.Add(model);
  31. }
  32. /// <summary>
  33. /// 更新一条数据
  34. /// </summary>
  35. public bool Update(CallCenterApi.Model.T_CTI_Task model)
  36. {
  37. return dal.Update(model);
  38. }
  39. /// <summary>
  40. /// 更新一条数据
  41. /// </summary>
  42. public bool UpdateState(int id, int state)
  43. {
  44. return dal.UpdateState(id, state);
  45. }
  46. /// <summary>
  47. /// 更新多条数据
  48. /// </summary>
  49. public bool UpdateStateBatch(string where, int state)
  50. {
  51. return dal.UpdateStateBatch(where, state);
  52. }
  53. /// <summary>
  54. /// 删除一条数据
  55. /// </summary>
  56. public bool Delete(long TaskID)
  57. {
  58. return dal.Delete(TaskID);
  59. }
  60. /// <summary>
  61. /// 删除一条数据
  62. /// </summary>
  63. public bool DeleteList(string TaskIDlist)
  64. {
  65. return dal.DeleteList(TaskIDlist);
  66. }
  67. /// <summary>
  68. /// 删除指定任务下所有号码
  69. /// </summary>
  70. public int DeletePhoneByTaskId(long TaskID)
  71. {
  72. return taskTelNumDAL.DeletePhoneByTaskId(TaskID);
  73. }
  74. /// <summary>
  75. /// 得到一个对象实体
  76. /// </summary>
  77. public CallCenterApi.Model.T_CTI_Task GetModel(long TaskID)
  78. {
  79. return dal.GetModel(TaskID);
  80. }
  81. /// <summary>
  82. /// 获得数据列表
  83. /// </summary>
  84. public DataSet GetList(string strWhere)
  85. {
  86. return dal.GetList(strWhere);
  87. }
  88. /// <summary>
  89. /// 获得前几行数据
  90. /// </summary>
  91. public DataSet GetList(int Top, string strWhere, string filedOrder)
  92. {
  93. return dal.GetList(Top, strWhere, filedOrder);
  94. }
  95. /// <summary>
  96. /// 获得数据列表
  97. /// </summary>
  98. public List<CallCenterApi.Model.T_CTI_Task> GetModelList(string strWhere)
  99. {
  100. DataSet ds = dal.GetList(strWhere);
  101. return DataTableToList(ds.Tables[0]);
  102. }
  103. /// <summary>
  104. /// 获得数据列表
  105. /// </summary>
  106. public List<CallCenterApi.Model.T_CTI_Task> DataTableToList(DataTable dt)
  107. {
  108. List<CallCenterApi.Model.T_CTI_Task> modelList = new List<CallCenterApi.Model.T_CTI_Task>();
  109. int rowsCount = dt.Rows.Count;
  110. if (rowsCount > 0)
  111. {
  112. CallCenterApi.Model.T_CTI_Task model;
  113. for (int n = 0; n < rowsCount; n++)
  114. {
  115. model = new CallCenterApi.Model.T_CTI_Task();
  116. if (dt.Rows[n]["TaskID"] != null && dt.Rows[n]["TaskID"].ToString() != "")
  117. {
  118. model.TaskID = long.Parse(dt.Rows[n]["TaskID"].ToString());
  119. }
  120. if (dt.Rows[n]["TaskName"] != null && dt.Rows[n]["TaskName"].ToString() != "")
  121. {
  122. model.TaskName = dt.Rows[n]["TaskName"].ToString();
  123. }
  124. if (dt.Rows[n]["TrunkGroupID"] != null && dt.Rows[n]["TrunkGroupID"].ToString() != "")
  125. {
  126. model.TrunkGroupID = int.Parse(dt.Rows[n]["TrunkGroupID"].ToString());
  127. }
  128. if (dt.Rows[n]["CallerNum"] != null && dt.Rows[n]["CallerNum"].ToString() != "")
  129. {
  130. model.CallerNum = dt.Rows[n]["CallerNum"].ToString();
  131. }
  132. if (dt.Rows[n]["CallType"] != null && dt.Rows[n]["CallType"].ToString() != "")
  133. {
  134. model.CallType = int.Parse(dt.Rows[n]["CallType"].ToString());
  135. }
  136. if (dt.Rows[n]["ExInfo"] != null && dt.Rows[n]["ExInfo"].ToString() != "")
  137. {
  138. model.ExInfo = dt.Rows[n]["ExInfo"].ToString();
  139. }
  140. if (dt.Rows[n]["MaxTrunkCount"] != null && dt.Rows[n]["MaxTrunkCount"].ToString() != "")
  141. {
  142. model.MaxTrunkCount = int.Parse(dt.Rows[n]["MaxTrunkCount"].ToString());
  143. }
  144. if (dt.Rows[n]["IntensityCoefficient"] != null && dt.Rows[n]["IntensityCoefficient"].ToString() != "")
  145. {
  146. model.IntensityCoefficient = decimal.Parse(dt.Rows[n]["IntensityCoefficient"].ToString());
  147. }
  148. if (dt.Rows[n]["ItemTableName"] != null && dt.Rows[n]["ItemTableName"].ToString() != "")
  149. {
  150. model.ItemTableName = dt.Rows[n]["ItemTableName"].ToString();
  151. }
  152. if (dt.Rows[n]["State"] != null && dt.Rows[n]["State"].ToString() != "")
  153. {
  154. model.State = int.Parse(dt.Rows[n]["State"].ToString());
  155. }
  156. if (dt.Rows[n]["AddTime"] != null && dt.Rows[n]["AddTime"].ToString() != "")
  157. {
  158. model.AddTime = DateTime.Parse(dt.Rows[n]["AddTime"].ToString());
  159. }
  160. if (dt.Rows[n]["y_PSort"] != null && dt.Rows[n]["y_PSort"].ToString() != "")
  161. {
  162. model.y_PSort = int.Parse(dt.Rows[n]["y_PSort"].ToString());
  163. }
  164. if (dt.Rows[n]["y_TkModelId"] != null && dt.Rows[n]["y_TkModelId"].ToString() != "")
  165. {
  166. model.y_TkModelId = long.Parse(dt.Rows[n]["y_TkModelId"].ToString());
  167. }
  168. //if (dt.Columns.Contains("F_Title"))
  169. //{
  170. // if (dt.Rows[n]["y_TkModelId"] != null && dt.Rows[n]["y_TkModelId"].ToString() != "")
  171. // {
  172. // model.y_TkModelId = long.Parse(dt.Rows[n]["y_TkModelId"].ToString());
  173. // }
  174. //}
  175. if (dt.Rows[n]["y_SXH"] != null && dt.Rows[n]["y_SXH"].ToString() != "")
  176. {
  177. model.y_SXH = int.Parse(dt.Rows[n]["y_SXH"].ToString());
  178. }
  179. if (dt.Rows[n]["y_FPCount"] != null && dt.Rows[n]["y_FPCount"].ToString() != "")
  180. {
  181. model.y_FPCount = int.Parse(dt.Rows[n]["y_FPCount"].ToString());
  182. }
  183. if (dt.Rows[n]["y_YJCount"] != null && dt.Rows[n]["y_YJCount"].ToString() != "")
  184. {
  185. model.y_YJCount = int.Parse(dt.Rows[n]["y_YJCount"].ToString());
  186. }
  187. if (dt.Rows[n]["y_HCCount"] != null && dt.Rows[n]["y_HCCount"].ToString() != "")
  188. {
  189. model.y_HCCount = int.Parse(dt.Rows[n]["y_HCCount"].ToString());
  190. }
  191. if (dt.Rows[n]["y_HSCount"] != null && dt.Rows[n]["y_HSCount"].ToString() != "")
  192. {
  193. model.y_HSCount = int.Parse(dt.Rows[n]["y_HSCount"].ToString());
  194. }
  195. if (dt.Rows[n]["y_HTCount"] != null && dt.Rows[n]["y_HTCount"].ToString() != "")
  196. {
  197. model.y_HTCount = int.Parse(dt.Rows[n]["y_HTCount"].ToString());
  198. }
  199. if (dt.Rows[n]["y_HMCount"] != null && dt.Rows[n]["y_HMCount"].ToString() != "")
  200. {
  201. model.y_HMCount = int.Parse(dt.Rows[n]["y_HMCount"].ToString());
  202. }
  203. if (dt.Rows[n]["y_OkCount"] != null && dt.Rows[n]["y_OkCount"].ToString() != "")
  204. {
  205. model.y_OkCount = int.Parse(dt.Rows[n]["y_OkCount"].ToString());
  206. }
  207. if (dt.Rows[n]["y_RFCount"] != null && dt.Rows[n]["y_RFCount"].ToString() != "")
  208. {
  209. model.y_RFCount = int.Parse(dt.Rows[n]["y_RFCount"].ToString());
  210. }
  211. if (dt.Rows[n]["y_ConsCount"] != null && dt.Rows[n]["y_ConsCount"].ToString() != "")
  212. {
  213. model.y_ConsCount = int.Parse(dt.Rows[n]["y_ConsCount"].ToString());
  214. }
  215. if (dt.Rows[n]["y_InvlCount"] != null && dt.Rows[n]["y_InvlCount"].ToString() != "")
  216. {
  217. model.y_InvlCount = int.Parse(dt.Rows[n]["y_InvlCount"].ToString());
  218. }
  219. if (dt.Rows[n]["y_NoAnswerCount"] != null && dt.Rows[n]["y_NoAnswerCount"].ToString() != "")
  220. {
  221. model.y_NoAnswerCount = int.Parse(dt.Rows[n]["y_NoAnswerCount"].ToString());
  222. }
  223. if (dt.Rows[n]["y_ShutDownCount"] != null && dt.Rows[n]["y_ShutDownCount"].ToString() != "")
  224. {
  225. model.y_ShutDownCount = int.Parse(dt.Rows[n]["y_ShutDownCount"].ToString());
  226. }
  227. if (dt.Rows[n]["TaskType"] != null && dt.Rows[n]["TaskType"].ToString() != "")
  228. {
  229. model.TaskType = int.Parse(dt.Rows[n]["TaskType"].ToString());
  230. }
  231. if (dt.Rows[n]["Pre"] != null && dt.Rows[n]["Pre"].ToString() != "")
  232. {
  233. model.Pre = dt.Rows[n]["Pre"].ToString();
  234. }
  235. if (dt.Rows[n]["Concurrency"] != null && dt.Rows[n]["Concurrency"].ToString() != "")
  236. {
  237. model.Concurrency = float.Parse(dt.Rows[n]["Concurrency"].ToString());
  238. }
  239. if (dt.Rows[n]["ConcurrencyType"] != null && dt.Rows[n]["ConcurrencyType"].ToString() != "")
  240. {
  241. model.ConcurrencyType = int.Parse(dt.Rows[n]["ConcurrencyType"].ToString());
  242. }
  243. if (dt.Rows[n]["PlanStartDate"] != null && dt.Rows[n]["PlanStartDate"].ToString() != "")
  244. {
  245. model.PlanStartDate = DateTime.Parse(dt.Rows[n]["PlanStartDate"].ToString());
  246. }
  247. if (dt.Rows[n]["PlanEndDate"] != null && dt.Rows[n]["PlanEndDate"].ToString() != "")
  248. {
  249. model.PlanEndDate = DateTime.Parse(dt.Rows[n]["PlanEndDate"].ToString());
  250. }
  251. if (dt.Rows[n]["StartTime1"] != null && dt.Rows[n]["StartTime1"].ToString() != "")
  252. {
  253. model.StartTime1 = DateTime.Parse(dt.Rows[n]["StartTime1"].ToString());
  254. }
  255. if (dt.Rows[n]["StartTime2"] != null && dt.Rows[n]["StartTime2"].ToString() != "")
  256. {
  257. model.StartTime2 = DateTime.Parse(dt.Rows[n]["StartTime2"].ToString());
  258. }
  259. if (dt.Rows[n]["EndTime1"] != null && dt.Rows[n]["EndTime1"].ToString() != "")
  260. {
  261. model.EndTime1 = DateTime.Parse(dt.Rows[n]["EndTime1"].ToString());
  262. }
  263. if (dt.Rows[n]["EndTime2"] != null && dt.Rows[n]["EndTime2"].ToString() != "")
  264. {
  265. model.EndTime2 = DateTime.Parse(dt.Rows[n]["EndTime2"].ToString());
  266. }
  267. if (dt.Rows[n]["AgentGroupId"] != null && dt.Rows[n]["AgentGroupId"].ToString() != "")
  268. {
  269. model.AgentGroupId = Convert.ToInt32(dt.Rows[n]["AgentGroupId"].ToString());
  270. }
  271. modelList.Add(model);
  272. }
  273. }
  274. return modelList;
  275. }
  276. ///// <summary>
  277. ///// 获得数据列表
  278. ///// </summary>
  279. //public List<CallCenterApi.Model.vw_CTI_TaskPager> DataTableToListPager(DataTable dt)
  280. //{
  281. // List<CallCenterApi.Model.vw_CTI_TaskPager> modelList = new List<CallCenterApi.Model.vw_CTI_TaskPager>();
  282. // int rowsCount = dt.Rows.Count;
  283. // var columns = dt.Columns;
  284. // if (rowsCount > 0)
  285. // {
  286. // CallCenterApi.Model.vw_CTI_TaskPager model;
  287. // for (int n = 0; n < rowsCount; n++)
  288. // {
  289. // try
  290. // {
  291. // model = new CallCenterApi.Model.vw_CTI_TaskPager();
  292. // if (dt.Rows[n]["TaskID"] != null && dt.Rows[n]["TaskID"].ToString() != "")
  293. // {
  294. // model.TaskID = long.Parse(dt.Rows[n]["TaskID"].ToString());
  295. // }
  296. // if (dt.Rows[n]["TaskName"] != null && dt.Rows[n]["TaskName"].ToString() != "")
  297. // {
  298. // model.TaskName = dt.Rows[n]["TaskName"].ToString();
  299. // }
  300. // if (columns.Contains("TrunkGroupID"))
  301. // {
  302. // if (dt.Rows[n]["TrunkGroupID"] != null && dt.Rows[n]["TrunkGroupID"].ToString() != "")
  303. // {
  304. // model.TrunkGroupID = int.Parse(dt.Rows[n]["TrunkGroupID"].ToString());
  305. // }
  306. // }
  307. // if (dt.Rows[n]["CallerNum"] != null && dt.Rows[n]["CallerNum"].ToString() != "")
  308. // {
  309. // model.CallerNum = dt.Rows[n]["CallerNum"].ToString();
  310. // }
  311. // if (dt.Rows[n]["CallType"] != null && dt.Rows[n]["CallType"].ToString() != "")
  312. // {
  313. // model.CallType = int.Parse(dt.Rows[n]["CallType"].ToString());
  314. // }
  315. // if (dt.Rows[n]["ExInfo"] != null && dt.Rows[n]["ExInfo"].ToString() != "")
  316. // {
  317. // model.ExInfo = dt.Rows[n]["ExInfo"].ToString();
  318. // }
  319. // if (dt.Rows[n]["MaxTrunkCount"] != null && dt.Rows[n]["MaxTrunkCount"].ToString() != "")
  320. // {
  321. // model.MaxTrunkCount = int.Parse(dt.Rows[n]["MaxTrunkCount"].ToString());
  322. // }
  323. // if (dt.Rows[n]["IntensityCoefficient"] != null && dt.Rows[n]["IntensityCoefficient"].ToString() != "")
  324. // {
  325. // model.IntensityCoefficient = decimal.Parse(dt.Rows[n]["IntensityCoefficient"].ToString());
  326. // }
  327. // if (dt.Rows[n]["ItemTableName"] != null && dt.Rows[n]["ItemTableName"].ToString() != "")
  328. // {
  329. // model.ItemTableName = dt.Rows[n]["ItemTableName"].ToString();
  330. // }
  331. // if (dt.Rows[n]["State"] != null && dt.Rows[n]["State"].ToString() != "")
  332. // {
  333. // model.State = int.Parse(dt.Rows[n]["State"].ToString());
  334. // }
  335. // if (dt.Rows[n]["AddTime"] != null && dt.Rows[n]["AddTime"].ToString() != "")
  336. // {
  337. // model.AddTime = Convert.ToDateTime(dt.Rows[n]["AddTime"].ToString());
  338. // }
  339. // if (dt.Rows[n]["y_PSort"] != null && dt.Rows[n]["y_PSort"].ToString() != "")
  340. // {
  341. // model.y_PSort = int.Parse(dt.Rows[n]["y_PSort"].ToString());
  342. // }
  343. // if (dt.Rows[n]["y_TkModelId"] != null && dt.Rows[n]["y_TkModelId"].ToString() != "")
  344. // {
  345. // model.y_TkModelId = long.Parse(dt.Rows[n]["y_TkModelId"].ToString());
  346. // }
  347. // if (dt.Rows[n]["y_SXH"] != null && dt.Rows[n]["y_SXH"].ToString() != "")
  348. // {
  349. // model.y_SXH = int.Parse(dt.Rows[n]["y_SXH"].ToString());
  350. // }
  351. // if (dt.Rows[n]["y_FPCount"] != null && dt.Rows[n]["y_FPCount"].ToString() != "")
  352. // {
  353. // model.y_FPCount = int.Parse(dt.Rows[n]["y_FPCount"].ToString());
  354. // }
  355. // if (dt.Rows[n]["y_YJCount"] != null && dt.Rows[n]["y_YJCount"].ToString() != "")
  356. // {
  357. // model.y_YJCount = int.Parse(dt.Rows[n]["y_YJCount"].ToString());
  358. // }
  359. // if (dt.Rows[n]["y_HCCount"] != null && dt.Rows[n]["y_HCCount"].ToString() != "")
  360. // {
  361. // model.y_HCCount = int.Parse(dt.Rows[n]["y_HCCount"].ToString());
  362. // }
  363. // if (dt.Rows[n]["y_HSCount"] != null && dt.Rows[n]["y_HSCount"].ToString() != "")
  364. // {
  365. // model.y_HSCount = int.Parse(dt.Rows[n]["y_HSCount"].ToString());
  366. // }
  367. // if (dt.Rows[n]["y_HTCount"] != null && dt.Rows[n]["y_HTCount"].ToString() != "")
  368. // {
  369. // model.y_HTCount = int.Parse(dt.Rows[n]["y_HTCount"].ToString());
  370. // }
  371. // if (dt.Rows[n]["y_HMCount"] != null && dt.Rows[n]["y_HMCount"].ToString() != "")
  372. // {
  373. // model.y_HMCount = int.Parse(dt.Rows[n]["y_HMCount"].ToString());
  374. // }
  375. // if (dt.Rows[n]["y_OkCount"] != null && dt.Rows[n]["y_OkCount"].ToString() != "")
  376. // {
  377. // model.y_OkCount = int.Parse(dt.Rows[n]["y_OkCount"].ToString());
  378. // }
  379. // if (dt.Rows[n]["y_RFCount"] != null && dt.Rows[n]["y_RFCount"].ToString() != "")
  380. // {
  381. // model.y_RFCount = int.Parse(dt.Rows[n]["y_RFCount"].ToString());
  382. // }
  383. // if (dt.Rows[n]["y_ConsCount"] != null && dt.Rows[n]["y_ConsCount"].ToString() != "")
  384. // {
  385. // model.y_ConsCount = int.Parse(dt.Rows[n]["y_ConsCount"].ToString());
  386. // }
  387. // if (dt.Rows[n]["y_InvlCount"] != null && dt.Rows[n]["y_InvlCount"].ToString() != "")
  388. // {
  389. // model.y_InvlCount = int.Parse(dt.Rows[n]["y_InvlCount"].ToString());
  390. // }
  391. // if (dt.Rows[n]["y_NoAnswerCount"] != null && dt.Rows[n]["y_NoAnswerCount"].ToString() != "")
  392. // {
  393. // model.y_NoAnswerCount = int.Parse(dt.Rows[n]["y_NoAnswerCount"].ToString());
  394. // }
  395. // if (dt.Rows[n]["y_ShutDownCount"] != null && dt.Rows[n]["y_ShutDownCount"].ToString() != "")
  396. // {
  397. // model.y_ShutDownCount = int.Parse(dt.Rows[n]["y_ShutDownCount"].ToString());
  398. // }
  399. // if (dt.Rows[n]["TaskType"] != null && dt.Rows[n]["TaskType"].ToString() != "")
  400. // {
  401. // model.TaskType = int.Parse(dt.Rows[n]["TaskType"].ToString());
  402. // }
  403. // model.F_Title = dt.Rows[n]["F_Title"].ToString();
  404. // modelList.Add(model);
  405. // }
  406. // catch
  407. // {
  408. // throw new Exception("AddTime=" + dt.Rows[n]["AddTime"].ToString());
  409. // }
  410. // }
  411. // }
  412. // return modelList;
  413. //}
  414. /// <summary>
  415. /// 获得数据列表
  416. /// </summary>
  417. public DataSet GetAllList()
  418. {
  419. return GetList("");
  420. }
  421. /// <summary>
  422. /// 分页获取数据列表
  423. /// </summary>
  424. public int GetRecordCount(string strWhere)
  425. {
  426. return dal.GetRecordCount(strWhere);
  427. }
  428. /// <summary>
  429. /// 分页获取数据列表
  430. /// </summary>
  431. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  432. {
  433. return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
  434. }
  435. /// <summary>
  436. /// 分页获取数据列表
  437. /// </summary>
  438. //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
  439. //{
  440. //return dal.GetList(PageSize,PageIndex,strWhere);
  441. //}
  442. public DataSet GetTask(int groupId)
  443. {
  444. return dal.GetTask(groupId);
  445. }
  446. #endregion Method
  447. }
  448. }