地铁二期项目正式开始

SystemManageController.cs 47KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453
  1. using Newtonsoft.Json;
  2. using Newtonsoft.Json.Linq;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Web;
  10. using System.Web.Mvc;
  11. using YTSoft.BaseCallCenter.Model;
  12. using YTSoft.BaseCallCenter.MVCWeb.Commons;
  13. using YTSoft.BaseCallCenter.MVCWeb.Models;
  14. using YTSoft.Common;
  15. namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
  16. {
  17. public class SystemManageController : BaseController
  18. {
  19. #region 部门管理
  20. BLL.T_Sys_Department deptBLL = new BLL.T_Sys_Department();
  21. /// <summary>
  22. /// 部门列表
  23. /// </summary>
  24. /// <returns></returns>
  25. public ActionResult DepartmentList()
  26. {
  27. WorkOrderMyModel model = new WorkOrderMyModel();
  28. return View(model);
  29. }
  30. ///通过部门父级节点获取数据
  31. /// </summary>
  32. /// <param name="fid"></param>
  33. /// <returns></returns>
  34. public string GetDepartmentJsonModel(int parentId)
  35. {
  36. return Newtonsoft.Json.JsonConvert.SerializeObject(deptBLL.GetDepartmentJsonModel(parentId));
  37. }
  38. /// <summary>
  39. /// 部门编辑
  40. /// </summary>
  41. /// <param name="editType">类型1、新增 2、修改</param>
  42. /// /// <returns></returns>
  43. public ActionResult DepartmentEdit(int deptId, int editType)
  44. {
  45. Model.T_Sys_Department viewModel = new Model.T_Sys_Department();
  46. //当前对象实体
  47. if (editType == 1)
  48. {
  49. viewModel.F_ParentId = deptId;
  50. viewModel.F_Sort = 1;
  51. }
  52. else
  53. {
  54. Model.T_Sys_Department deptModel = deptBLL.GetModel(deptId);
  55. viewModel = deptModel;
  56. }
  57. return View(viewModel);
  58. }
  59. /// <summary>
  60. /// 保存编辑
  61. /// </summary>
  62. /// <param name="workOrderBaseModel"></param>
  63. /// <returns></returns>
  64. [AcceptVerbs(HttpVerbs.Post)]
  65. public bool SaveDeptData(T_Sys_Department deptModel)
  66. {
  67. if (deptModel.F_DeptId > 0)
  68. {
  69. AddAction("t_sys_department", deptModel.F_DeptId.ToMyString(), "更新部门", deptModel.F_DeptName);
  70. return deptBLL.Update(deptModel);
  71. }
  72. else
  73. {
  74. int id = deptBLL.Add(deptModel);
  75. AddAction("t_sys_department", id.ToMyString(), "添加部门", deptModel.F_DeptName);
  76. return id> 0;
  77. }
  78. }
  79. /// <summary>
  80. /// 删除部门
  81. /// </summary>
  82. /// <param name="workOrderBaseModel"></param>
  83. /// <returns></returns>
  84. [AcceptVerbs(HttpVerbs.Get)]
  85. public bool DeleteDeptData(int deptId)
  86. {
  87. AddAction("t_sys_department", deptId.ToMyString(), "删除部门");
  88. return deptBLL.Delete(deptId);
  89. }
  90. /// <summary>
  91. /// 获取部门数据
  92. /// </summary>
  93. /// <param name="page">当前页码</param>
  94. /// <param name="limit">每页数据量</param>
  95. /// <returns></returns>
  96. [ActionName("DeptDate")]
  97. [HttpGet]
  98. public string DeptDate(DateTime? NowDateTime, int page, int limit, int? parentId)
  99. {
  100. //数据结果集
  101. ResponseData dataModel = new ResponseData();
  102. string sql = "";
  103. if (parentId != null)
  104. {
  105. sql += " and F_ParentId=" + parentId;
  106. }
  107. DataTable dt = new DataTable();
  108. int recordCount = 0;
  109. Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
  110. dt = BLL.PagerBLL.GetListPager(
  111. "T_Sys_Department",
  112. "F_DeptId",
  113. "*",
  114. sql,
  115. "ORDER BY F_Sort asc ",
  116. limit,
  117. page,
  118. true,
  119. out recordCount);
  120. dataModel.code = 0;
  121. dataModel.count = recordCount;
  122. dataModel.data = dt;
  123. return JsonConvert.SerializeObject(dataModel);
  124. }
  125. #endregion
  126. #region 角色管理
  127. BLL.T_Sys_RoleInfo roleBLL = new BLL.T_Sys_RoleInfo();
  128. public ActionResult RoleList()
  129. {
  130. WorkOrderMyModel model = new WorkOrderMyModel();
  131. return View(model);
  132. }
  133. /// <summary>
  134. /// 获取角色列表
  135. /// </summary>
  136. /// <param name="page">当前页码</param>
  137. /// <param name="limit">每页数据量</param>
  138. /// <returns></returns>
  139. [ActionName("RoleDate")]
  140. [HttpGet]
  141. public string RoleDate(DateTime? NowDateTime, int page, int limit)
  142. {
  143. //数据结果集
  144. ResponseData dataModel = new ResponseData();
  145. string sql = "";
  146. DataTable dt = new DataTable();
  147. int recordCount = 0;
  148. Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
  149. dt = BLL.PagerBLL.GetListPager(
  150. "T_Sys_RoleInfo",
  151. "F_RoleId",
  152. "*",
  153. sql,
  154. "ORDER BY F_RoleId",
  155. limit,
  156. page,
  157. true,
  158. out recordCount);
  159. dataModel.code = 0;
  160. dataModel.count = recordCount;
  161. dataModel.data = dt;
  162. return JsonConvert.SerializeObject(dataModel);
  163. }
  164. /// <summary>
  165. /// 编辑角色
  166. /// </summary>
  167. /// <returns></returns>
  168. public ActionResult RoleEdit(int? roleId)
  169. {
  170. Model.T_Sys_RoleInfo viewModel = new Model.T_Sys_RoleInfo();
  171. if (roleId != null && roleId > 0)
  172. {
  173. viewModel = roleBLL.GetModel(int.Parse(roleId.ToString()));
  174. }
  175. return View(viewModel);
  176. }
  177. /// <summary>
  178. /// 保存编辑
  179. /// </summary>
  180. /// <param name="workOrderBaseModel"></param>
  181. /// <returns></returns>
  182. [AcceptVerbs(HttpVerbs.Post)]
  183. public bool SaveRoleEdit(T_Sys_RoleInfo roleInfoModel)
  184. {
  185. if (roleInfoModel.F_RoleId > 0)
  186. {
  187. AddAction("t_sys_roleinfo", roleInfoModel.F_RoleId.ToMyString(), "更新角色", roleInfoModel.F_RoleName);
  188. return roleBLL.Update(roleInfoModel);
  189. }
  190. else
  191. {
  192. int id = roleBLL.Add(roleInfoModel);
  193. AddAction("t_sys_roleinfo", id.ToMyString(), "添加角色", roleInfoModel.F_RoleName);
  194. return id > 0;
  195. }
  196. }
  197. /// <summary>
  198. /// 删除数据
  199. /// </summary>
  200. /// <param name="workOrderBaseModel"></param>
  201. /// <returns></returns>
  202. [AcceptVerbs(HttpVerbs.Get)]
  203. public bool DeleteRoleData(string roleId)
  204. {
  205. AddAction("t_sys_roleinfo", roleId.ToMyString(), "删除角色");
  206. return roleBLL.DeleteList(roleId);
  207. }
  208. #endregion
  209. #region 获取菜单树
  210. public class DicSeaarchModel
  211. {
  212. public string RootCode
  213. {
  214. get;
  215. set;
  216. }
  217. }
  218. /// <summary>
  219. /// 初始化字典结构
  220. /// </summary>
  221. /// <param name="rootCode"></param>
  222. /// <returns></returns>
  223. public ActionResult MenuTree(string rootCode)
  224. {
  225. DicSeaarchModel model = new DicSeaarchModel();
  226. model.RootCode = rootCode;
  227. return View(model);
  228. }
  229. /// <summary>
  230. /// 获取字典数据
  231. /// </summary>
  232. /// <param name="rootCode"></param>
  233. /// <returns></returns>
  234. public string GetMenuTreeData(int roleId)
  235. {
  236. try
  237. {
  238. return "[" + Newtonsoft.Json.JsonConvert.SerializeObject(roleBLL.GetMenuTree(roleId)).Replace("Checked", "checked") + "]";
  239. }
  240. catch (Exception ex)
  241. {
  242. return "";
  243. }
  244. }
  245. /// <summary>
  246. ///授权
  247. /// </summary>
  248. /// <returns></returns>
  249. [AcceptVerbs(HttpVerbs.Get)]
  250. public bool AcceptList(int roleId, string MenuIdStr)
  251. {
  252. bool accRersult = false;
  253. if (roleBLL.AddRolesMenuList(roleId, MenuIdStr))
  254. {
  255. accRersult = true;
  256. }
  257. return accRersult;
  258. }
  259. #endregion
  260. #region 业务类型管理
  261. BLL.T_Wo_WorkOrderType dicTittleBLL = new BLL.T_Wo_WorkOrderType();
  262. public ActionResult BusinessTypeList()
  263. {
  264. WorkOrderMyModel model = new WorkOrderMyModel();
  265. return View(model);
  266. }
  267. ///通过dic编码获取dic值
  268. /// </summary>
  269. /// <param name="fid"></param>
  270. /// <returns></returns>
  271. public string GetDicTittleJson(int parentId)
  272. {
  273. return Newtonsoft.Json.JsonConvert.SerializeObject(dicTittleBLL.GetDicTittleJsonModel(parentId));
  274. }
  275. /// <summary>
  276. /// 获取业务类型数据
  277. /// </summary>
  278. /// <param name="page">当前页码</param>
  279. /// <param name="limit">每页数据量</param>
  280. /// <returns></returns>
  281. [ActionName("OrderTypeDate")]
  282. [HttpGet]
  283. public string OrderTypeDate(DateTime? NowDateTime, int page, int limit, int? parentId)
  284. {
  285. //数据结果集
  286. ResponseData dataModel = new ResponseData();
  287. string sql = "";
  288. if (parentId != null && parentId > 0)
  289. {
  290. sql += " and F_ParentId=" + parentId;
  291. }
  292. DataTable dt = new DataTable();
  293. int recordCount = 0;
  294. Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
  295. dt = BLL.PagerBLL.GetListPager(
  296. "T_Wo_WorkOrderType",
  297. "F_WorkOrderTypeId",
  298. "*",
  299. sql,
  300. "ORDER BY F_Sort asc ",
  301. limit,
  302. page,
  303. true,
  304. out recordCount);
  305. dataModel.code = 0;
  306. dataModel.count = recordCount;
  307. dataModel.data = dt;
  308. return JsonConvert.SerializeObject(dataModel);
  309. }
  310. /// <summary>
  311. /// 编辑业务类型
  312. /// </summary>
  313. /// <param name="F_WorkOrderTypeId">当前选中id</param>
  314. /// <param name="editType">类型1、新增 2、修改</param>
  315. /// <returns></returns>
  316. public ActionResult BussinessTypeEdit(int F_WorkOrderTypeId, int editType)
  317. {
  318. Model.T_Wo_WorkOrderType viewModel = new Model.T_Wo_WorkOrderType();
  319. //当前对象实体
  320. Model.T_Wo_WorkOrderType orderTypeModel = dicTittleBLL.GetModel(F_WorkOrderTypeId);
  321. if (editType == 1)
  322. {
  323. viewModel.F_ParentId = orderTypeModel.F_WorkOrderTypeId;
  324. viewModel.F_ParentName = orderTypeModel.F_ParentName;
  325. viewModel.F_Sort = 1;
  326. }
  327. else
  328. {
  329. viewModel = orderTypeModel;
  330. }
  331. return View(viewModel);
  332. }
  333. /// <summary>
  334. /// 保存编辑
  335. /// </summary>
  336. /// <param name="workOrderBaseModel"></param>
  337. /// <returns></returns>
  338. [AcceptVerbs(HttpVerbs.Post)]
  339. public bool SaveBussiTypeData(T_Wo_WorkOrderType WorkOrderTypeModel)
  340. {
  341. ////当前用户信息
  342. //workOrderBaseModel.F_USERID = F_UserID;//id
  343. //workOrderBaseModel.F_LINKMAN = F_UserCode;//工号
  344. //workOrderBaseModel.F_REPAIRMANNAME = "12";//姓名
  345. if (WorkOrderTypeModel.F_WorkOrderTypeId > 0)
  346. {
  347. AddAction("t_wo_workordertype", WorkOrderTypeModel.F_WorkOrderTypeId.ToMyString(), "更新工单分类",WorkOrderTypeModel.F_Name);
  348. return dicTittleBLL.Update(WorkOrderTypeModel) > 0;
  349. }
  350. else
  351. {
  352. int id = dicTittleBLL.Add(WorkOrderTypeModel);
  353. AddAction("t_wo_workordertype", id.ToMyString(), "添加工单分类", WorkOrderTypeModel.F_Name);
  354. return id > 0;
  355. }
  356. }
  357. /// <summary>
  358. /// 删除数据
  359. /// </summary>
  360. /// <param name="workOrderBaseModel"></param>
  361. /// <returns></returns>
  362. [AcceptVerbs(HttpVerbs.Get)]
  363. public bool DeleteBussiTypeData(int WorkOrderTypeId)
  364. {
  365. AddAction("t_wo_workordertype", WorkOrderTypeId.ToMyString(), "删除工单分类");
  366. return dicTittleBLL.Delete(WorkOrderTypeId);
  367. }
  368. #endregion
  369. #region 字典管理
  370. BLL.T_Sys_DictionaryValue dicValueBLL = new BLL.T_Sys_DictionaryValue();
  371. BLL.T_Sys_DictionaryBase dicBaseBLL = new BLL.T_Sys_DictionaryBase();
  372. /// <summary>
  373. /// 字典列表
  374. /// </summary>
  375. /// <returns></returns>
  376. public ActionResult DictionaryList()
  377. {
  378. WorkOrderMyModel model = new WorkOrderMyModel();
  379. return View(model);
  380. }
  381. ///通过字典获取数据
  382. /// </summary>
  383. /// <param name="fid"></param>
  384. /// <returns></returns>
  385. public string GetDictionaryJsonModel(int parentId)
  386. {
  387. return Newtonsoft.Json.JsonConvert.SerializeObject(dicBaseBLL.GetDictionaryJsonModel());
  388. }
  389. /// <summary>
  390. /// 获取字典值数据
  391. /// </summary>
  392. /// <param name="page">当前页码</param>
  393. /// <param name="limit">每页数据量</param>
  394. /// <returns></returns>
  395. [ActionName("DictionaryDate")]
  396. [HttpGet]
  397. public string DictionaryDate(DateTime? NowDateTime, int page, int limit, string dictionaryFlag)
  398. {
  399. //数据结果集
  400. ResponseData dataModel = new ResponseData();
  401. string sql = "";
  402. if (!string.IsNullOrEmpty(dictionaryFlag) && dictionaryFlag != "0")
  403. {
  404. sql += " and F_DictionaryFlag='" + dictionaryFlag + "'";
  405. }
  406. DataTable dt = new DataTable();
  407. int recordCount = 0;
  408. Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
  409. if (string.IsNullOrEmpty(dictionaryFlag) || dictionaryFlag != "0")
  410. {
  411. dt = BLL.PagerBLL.GetListPager(
  412. "T_Sys_DictionaryValue",
  413. "F_DictionaryValueId",
  414. "*",
  415. sql,
  416. "ORDER BY F_Sort asc ",
  417. limit,
  418. page,
  419. true,
  420. out recordCount);
  421. }
  422. else
  423. {
  424. dt = BLL.PagerBLL.GetListPager(
  425. "T_Sys_DictionaryBase",
  426. "F_DictionaryName",
  427. "*,F_DictionaryName as F_Name",
  428. sql,
  429. "ORDER BY F_Sort asc ",
  430. limit,
  431. page,
  432. true,
  433. out recordCount);
  434. }
  435. dataModel.code = 0;
  436. dataModel.count = recordCount;
  437. dataModel.data = dt;
  438. return JsonConvert.SerializeObject(dataModel);
  439. }
  440. /// <summary>
  441. /// 字典项编辑
  442. /// </summary>
  443. /// <param name="editType">类型1、新增 2、修改</param>
  444. /// /// <returns></returns>
  445. public ActionResult DictionaryBaseEdit(string dicCode, int editType)
  446. {
  447. Model.T_Sys_DictionaryBase viewModel = new Model.T_Sys_DictionaryBase();
  448. //当前对象实体
  449. if (editType == 1)
  450. {
  451. viewModel.F_Sort = 1;
  452. }
  453. else
  454. {
  455. Model.T_Sys_DictionaryBase dicBaseModel = dicBaseBLL.GetModel(dicCode);
  456. viewModel = dicBaseModel;
  457. }
  458. return View(viewModel);
  459. }
  460. /// <summary>
  461. /// 保存字典项编辑
  462. /// </summary>
  463. /// <param name="workOrderBaseModel"></param>
  464. /// <returns></returns>
  465. [AcceptVerbs(HttpVerbs.Post)]
  466. public bool SaveDictionaryBaseData(T_Sys_DictionaryBase dicBaseModel)
  467. {
  468. if (!string.IsNullOrEmpty(dicBaseModel.F_DictionaryFlagType))
  469. {
  470. AddAction("t_sys_dictionarybase", dicBaseModel.F_DictionaryFlagType, "更新字典项");
  471. return dicBaseBLL.Update(dicBaseModel);
  472. }
  473. else
  474. {
  475. AddAction("t_sys_dictionarybase", dicBaseModel.F_DictionaryFlagType, "添加字典项");
  476. return dicBaseBLL.Add(dicBaseModel);
  477. }
  478. }
  479. /// <summary>
  480. /// 删除字典项
  481. /// </summary>
  482. /// <param name="workOrderBaseModel"></param>
  483. /// <returns></returns>
  484. [AcceptVerbs(HttpVerbs.Get)]
  485. public bool DeleteBaseData(string baseCode)
  486. {
  487. AddAction("t_sys_dictionarybase", baseCode,"删除字典项");
  488. return dicBaseBLL.Delete(baseCode);
  489. }
  490. /// <summary>
  491. /// 字典值编辑
  492. /// </summary>
  493. /// <param name="editType">类型1、新增 2、修改</param>
  494. /// /// <returns></returns>
  495. public ActionResult DictionaryValueEdit(int? valueId, string parentCode, int editType)
  496. {
  497. Model.T_Sys_DictionaryValue viewModel = new Model.T_Sys_DictionaryValue();
  498. //当前对象实体
  499. if (editType == 1)
  500. {
  501. viewModel.F_Sort = 1;
  502. viewModel.F_DictionaryFlag = parentCode;
  503. }
  504. else
  505. {
  506. Model.T_Sys_DictionaryValue dicValueModel = dicValueBLL.GetModel(int.Parse(valueId.ToString()));
  507. viewModel = dicValueModel;
  508. }
  509. return View(viewModel);
  510. }
  511. /// <summary>
  512. /// 保存字典值
  513. /// </summary>
  514. /// <param name="workOrderBaseModel"></param>
  515. /// <returns></returns>
  516. [AcceptVerbs(HttpVerbs.Post)]
  517. public bool SaveDictionaryValueData(T_Sys_DictionaryValue dicBaseModel)
  518. {
  519. if (dicBaseModel.F_DictionaryValueId > 0)
  520. {
  521. AddAction("t_sys_dictionaryvalue", dicBaseModel.F_DictionaryValueId.ToMyString(), "更新字典值");
  522. return dicValueBLL.Update(dicBaseModel);
  523. }
  524. else
  525. {
  526. int id = dicValueBLL.Add(dicBaseModel);
  527. AddAction("t_sys_dictionaryvalue", id.ToMyString(), "添加字典值");
  528. return id > 0;
  529. }
  530. }
  531. /// <summary>
  532. /// 删除字典值
  533. /// </summary>
  534. /// <param name="workOrderBaseModel"></param>
  535. /// <returns></returns>
  536. [AcceptVerbs(HttpVerbs.Get)]
  537. public bool DeleteValueData(int id)
  538. {
  539. AddAction("t_sys_dictionaryvalue", id.ToMyString(), "删除字典值");
  540. return dicValueBLL.Delete(id);
  541. }
  542. #endregion
  543. #region 菜单管理
  544. BLL.T_Sys_ModuleFunctions menuBLL = new BLL.T_Sys_ModuleFunctions();
  545. /// <summary>
  546. /// 部门列表
  547. /// </summary>
  548. /// <returns></returns>
  549. public ActionResult MenuList()
  550. {
  551. WorkOrderMyModel model = new WorkOrderMyModel();
  552. return View(model);
  553. }
  554. ///通过部门父级节点获取数据
  555. /// </summary>
  556. /// <param name="fid"></param>
  557. /// <returns></returns>
  558. public string GetMenuJsonModel(int parentId)
  559. {
  560. return Newtonsoft.Json.JsonConvert.SerializeObject(menuBLL.GetMenuJsonModel(parentId));
  561. }
  562. /// <summary>
  563. /// 获取部门数据
  564. /// </summary>
  565. /// <param name="page">当前页码</param>
  566. /// <param name="limit">每页数据量</param>
  567. /// <returns></returns>
  568. [ActionName("MenuDate")]
  569. [HttpGet]
  570. public string MenuDate(DateTime? NowDateTime, int page, int limit, int? parentId)
  571. {
  572. //数据结果集
  573. ResponseData dataModel = new ResponseData();
  574. string sql = "";
  575. if (parentId != null)
  576. {
  577. sql += " and F_ParentId=" + parentId;
  578. }
  579. DataTable dt = new DataTable();
  580. int recordCount = 0;
  581. Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
  582. dt = BLL.PagerBLL.GetListPager(
  583. "T_Sys_ModuleFunctions",
  584. "F_FunctionId",
  585. "* ,(CASE F_StateFlag WHEN 1 THEN '启用' WHEN 0 THEN '禁用' ELSE NULL END ) as F_StateFlagName",
  586. sql,
  587. "ORDER BY F_Sort asc ",
  588. limit,
  589. page,
  590. true,
  591. out recordCount);
  592. dataModel.code = 0;
  593. dataModel.count = recordCount;
  594. dataModel.data = dt;
  595. return JsonConvert.SerializeObject(dataModel);
  596. }
  597. /// <summary>
  598. /// 功能编辑
  599. /// </summary>
  600. /// <param name="editType">类型1、新增 2、修改</param>
  601. /// /// <returns></returns>
  602. public ActionResult MenuEdit(int menuId, int editType)
  603. {
  604. Model.T_Sys_ModuleFunctions viewModel = new Model.T_Sys_ModuleFunctions();
  605. //当前对象实体
  606. if (editType == 1)
  607. {
  608. viewModel.F_ParentId = menuId;
  609. viewModel.F_Sort = 1;
  610. }
  611. else
  612. {
  613. Model.T_Sys_ModuleFunctions deptModel = menuBLL.GetModel(menuId);
  614. viewModel = deptModel;
  615. }
  616. return View(viewModel);
  617. }
  618. /// <summary>
  619. /// 保存编辑
  620. /// </summary>
  621. /// <param name="workOrderBaseModel"></param>
  622. /// <returns></returns>
  623. [AcceptVerbs(HttpVerbs.Post)]
  624. public bool SaveMenuData(T_Sys_ModuleFunctions menuModel)
  625. {
  626. if (menuModel.F_FunctionId > 0)
  627. {
  628. AddAction("t_sys_modulefunctions", menuModel.F_FunctionId.ToMyString(), "更新菜单", menuModel.F_Name);
  629. return menuBLL.Update(menuModel);
  630. }
  631. else
  632. {
  633. int id = menuBLL.Add(menuModel);
  634. AddAction("t_sys_modulefunctions", id.ToMyString(), "添加菜单", menuModel.F_Name);
  635. return id > 0;
  636. }
  637. }
  638. /// <summary>
  639. /// 删除功能
  640. /// </summary>
  641. /// <param name="workOrderBaseModel"></param>
  642. /// <returns></returns>
  643. [AcceptVerbs(HttpVerbs.Get)]
  644. public bool DeleteMenuData(int menuId)
  645. {
  646. AddAction("t_sys_modulefunctions", menuId.ToMyString(), "删除菜单");
  647. return menuBLL.Delete(menuId);
  648. }
  649. #endregion
  650. #region 用户管理
  651. BLL.T_Sys_UserAccount userBLL = new BLL.T_Sys_UserAccount();
  652. /// <summary>
  653. /// 部门列表
  654. /// </summary>
  655. /// <returns></returns>
  656. public ActionResult UserList()
  657. {
  658. WorkOrderMyModel model = new WorkOrderMyModel();
  659. return View(model);
  660. }
  661. /// <summary>
  662. /// 用户编辑
  663. /// </summary>
  664. /// <param name="editType">类型1、新增 2、修改</param>
  665. /// /// <returns></returns>
  666. public ActionResult UserEdit(int? userId, int? deptId, int editType)
  667. {
  668. Model.T_Sys_UserAccount viewModel = new Model.T_Sys_UserAccount();
  669. //当前对象实体
  670. if (editType == 1)
  671. {
  672. viewModel.F_DeptId = int.Parse(deptId.ToString());
  673. }
  674. else
  675. {
  676. Model.T_Sys_UserAccount userModel = userBLL.GetModel(int.Parse(userId.ToString()));
  677. viewModel = userModel;
  678. }
  679. //获取部门列表
  680. viewModel.DepartmentList = deptBLL.GetModelList("F_ParentId=0");
  681. //获取角色列表
  682. viewModel.RoleInfoList = roleBLL.GetModelList("");
  683. return View(viewModel);
  684. }
  685. /// <summary>
  686. /// 保存编辑
  687. /// </summary>
  688. /// <param name="workOrderBaseModel"></param>
  689. /// <returns></returns>
  690. [AcceptVerbs(HttpVerbs.Post)]
  691. public bool SaveUserData(T_Sys_UserAccount userModel)
  692. {
  693. userModel.F_WorkNumber = userModel.F_UserCode;
  694. if (userModel.F_UserId > 0)
  695. {
  696. T_Sys_UserAccount oldUserModel = userBLL.GetModel(userModel.F_UserId);
  697. oldUserModel.F_WorkNumber = userModel.F_WorkNumber;
  698. oldUserModel.F_UserName = userModel.F_UserName;
  699. oldUserModel.F_UserCode = userModel.F_UserCode;
  700. oldUserModel.F_DeptId = userModel.F_DeptId;
  701. oldUserModel.F_RoleId = userModel.F_RoleId;
  702. oldUserModel.F_SexFlag = userModel.F_SexFlag;
  703. oldUserModel.F_Telephone = userModel.F_Telephone;
  704. oldUserModel.F_SeatFlag = userModel.F_SeatFlag;
  705. oldUserModel.F_SeatRight = userModel.F_SeatRight;
  706. oldUserModel.F_Password = userModel.F_Password;
  707. oldUserModel.F_Remark = userModel.F_Remark;
  708. AddAction("t_sys_useraccount", userModel.F_UserId.ToMyString(), "更新用户", userModel.F_UserName);
  709. return userBLL.Update(oldUserModel);
  710. }
  711. else
  712. {
  713. userModel.F_HJType = 0;
  714. userModel.F_GroupId = 1;
  715. if (userModel.F_SeatFlag&&false)
  716. {
  717. #region 调用接口插入用户信息
  718. try
  719. {
  720. StringBuilder returnStr = new StringBuilder();
  721. string wxAddUrl = "http://rexian.zzmetro.com/api/customer/insert";
  722. UserInfo model = new UserInfo();
  723. model.name = userModel.F_UserCode;
  724. object userInfo = JObject.Parse(JsonConvert.SerializeObject(model));
  725. string addWxResult = HttpHelper.HttpPost(wxAddUrl, userInfo);
  726. ResponseResult ResultModel = JsonConvert.DeserializeObject<ResponseResult>(addWxResult);
  727. userModel.F_PId = ResultModel.data;
  728. }
  729. catch (Exception ex)
  730. {
  731. }
  732. #endregion
  733. }
  734. int userid = userBLL.Add(userModel);
  735. AddAction("t_sys_useraccount", userid.ToMyString(), "新增用户", userModel.F_UserName);
  736. return userid > 0;
  737. }
  738. }
  739. /// <summary>
  740. /// 删除用户
  741. /// </summary>
  742. /// <param name="workOrderBaseModel"></param>
  743. /// <returns></returns>
  744. [AcceptVerbs(HttpVerbs.Get)]
  745. public bool DeleteUserData(int userId)
  746. {
  747. AddAction("t_sys_useraccount", userId.ToMyString(), "删除用户");
  748. return userBLL.Delete(userId);
  749. }
  750. /// <summary>
  751. /// 获取用户数据
  752. /// </summary>
  753. /// <param name="page">当前页码</param>
  754. /// <param name="limit">每页数据量</param>
  755. /// <returns></returns>
  756. [ActionName("UserDate")]
  757. [HttpGet]
  758. public string UserDate(DateTime? NowDateTime, int page, int limit, int? deptId)
  759. {
  760. //数据结果集
  761. ResponseData dataModel = new ResponseData();
  762. string sql = "";
  763. if (deptId != null && deptId > 0)
  764. {
  765. sql += " and F_DeptId=" + deptId;
  766. }
  767. DataTable dt = new DataTable();
  768. int recordCount = 0;
  769. Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
  770. dt = BLL.PagerBLL.GetListPager(
  771. "T_Sys_UserAccount",
  772. "F_UserId",
  773. "*"
  774. + ",(select top 1 t.F_DeptName from T_Sys_Department t where t.F_DeptId=T_Sys_UserAccount.F_DeptId) as F_DeptName "
  775. + ",(select top 1 t.F_RoleName from T_Sys_RoleInfo t where t.F_RoleId=T_Sys_UserAccount.F_RoleId) as F_RoleName "
  776. + ",(CASE F_SeatFlag WHEN 1 THEN '使用' WHEN 0 THEN '不使用' ELSE NULL END ) as F_SeatFlagName"
  777. + ",(CASE F_SeatRight WHEN 1 THEN '班长坐席' WHEN 0 THEN '普通坐席' ELSE NULL END ) as F_SeatRightName"
  778. ,
  779. sql,
  780. "ORDER BY F_UserCode asc ",
  781. limit,
  782. page,
  783. true,
  784. out recordCount);
  785. dataModel.code = 0;
  786. dataModel.count = recordCount;
  787. dataModel.data = dt;
  788. return JsonConvert.SerializeObject(dataModel);
  789. }
  790. #endregion
  791. #region 修改密码
  792. /// <summary>
  793. ///用户修改个人密码
  794. /// </summary>
  795. /// <param name="id"></param>
  796. /// <returns></returns>
  797. public ActionResult UserPwdEdit()
  798. {
  799. Model.T_Sys_UserAccount model = new Model.T_Sys_UserAccount();
  800. if (F_UserID > 0)
  801. {
  802. model = userBLL.GetModel(F_UserID);
  803. }
  804. return View(model);
  805. }
  806. /// </summary>
  807. [AcceptVerbs(HttpVerbs.Post)]
  808. public ActionResult CheckPwd(string pwd)
  809. {
  810. checkpwd.Chkrslt chkrslt = checkpwd.PasswordStrength(pwd);
  811. return Json(new
  812. {
  813. code = chkrslt.RSL ? 0 : 1,
  814. msg = chkrslt.MSG
  815. });
  816. }
  817. /// <summary>
  818. ///保存修改密码
  819. /// </summary>
  820. [AcceptVerbs(HttpVerbs.Post)]
  821. public string UpdateUserPwd(Model.T_Sys_UserAccount model)
  822. {
  823. checkpwd.Chkrslt chkrslt = checkpwd.PasswordStrength(model.password);
  824. if(!chkrslt.RSL)
  825. {
  826. return chkrslt.MSG;
  827. }
  828. string AddRersult = "false";
  829. if (model.F_UserId > 0)
  830. {
  831. Model.T_Sys_UserAccount newModel = userBLL.GetModel(model.F_UserId);
  832. if (newModel != null && newModel.F_Password == model.oldPwd)
  833. {
  834. newModel.F_Password = model.password;
  835. if (userBLL.Update(newModel))
  836. {
  837. AddAction("t_sys_useraccount", model.F_UserId.ToMyString(), "修改密码");
  838. AddRersult = "True";
  839. }
  840. }
  841. else
  842. {
  843. AddRersult = "旧密码不正确!";
  844. }
  845. }
  846. return AddRersult;
  847. }
  848. #endregion
  849. #region 基本信息
  850. /// <summary>
  851. /// 用户编辑
  852. /// </summary>
  853. /// <param name="editType">类型1、新增 2、修改</param>
  854. /// /// <returns></returns>
  855. public ActionResult UserView()
  856. {
  857. Model.T_Sys_UserAccount userModel = userBLL.GetModel(F_UserID);
  858. if (string.IsNullOrEmpty(userModel.F_HomePhone))
  859. {
  860. userModel.F_HomePhone = "/Content/images/face.jpg";
  861. }
  862. else
  863. {
  864. if (!System.IO.File.Exists(Server.MapPath(userModel.F_HomePhone)))
  865. {
  866. userModel.F_HomePhone = "/Content/images/face.jpg";
  867. }
  868. }
  869. return View(userModel);
  870. }
  871. #endregion
  872. #region 图片上传
  873. /// <summary>
  874. /// 图片上传
  875. /// </summary>
  876. /// <returns></returns>
  877. [AcceptVerbs(HttpVerbs.Post)]
  878. public ActionResult UploadFile()
  879. {
  880. try
  881. {
  882. if (Request.Files.Count > 0)
  883. {
  884. string uppath = string.Empty;
  885. string savepath = string.Empty;
  886. HttpPostedFileBase imgFile = Request.Files[0];
  887. if (imgFile != null)
  888. {
  889. //创建图片新的名称
  890. string nameImg = DateTime.Now.ToString("yyyyMMddHHmmssfff");
  891. //获得上传图片的路径
  892. string strPath = imgFile.FileName;
  893. //获得上传图片的类型(后缀名)
  894. string type = strPath.Substring(strPath.LastIndexOf(".") + 1).ToLower();
  895. //拼写数据库保存的相对路径字符串
  896. savepath = "/Content/HeadImg/images/";
  897. //拼写上传图片的路径
  898. uppath = Server.MapPath("~/Content/HeadImg/images/");
  899. if (!Directory.Exists(Path.GetDirectoryName(uppath)))
  900. {
  901. Directory.CreateDirectory(Path.GetDirectoryName(uppath));
  902. }
  903. uppath += nameImg + "." + type;
  904. savepath += nameImg + "." + type;
  905. //上传图片
  906. imgFile.SaveAs(uppath); //原图片路径
  907. }
  908. Model.T_Sys_UserAccount userModel = userBLL.GetModel(F_UserID);
  909. userModel.F_HomePhone = savepath;
  910. if (userBLL.Update(userModel))
  911. {
  912. return Json(new
  913. {
  914. code = 0,
  915. src = savepath,
  916. msg = "上传成功"
  917. });
  918. }
  919. else
  920. {
  921. return Json(new
  922. {
  923. code = 1,
  924. src = "",
  925. msg = "上传出错 请检查图片名称或图片内容"
  926. });
  927. }
  928. }
  929. else
  930. {
  931. return Json(new
  932. {
  933. code = 1,
  934. src = "",
  935. msg = "上传出错 请检查图片名称或图片内容"
  936. });
  937. }
  938. }
  939. catch (Exception ex)
  940. {
  941. return Json(new
  942. {
  943. code = 1,
  944. src = "",
  945. msg = "上传出错: " + ex.Message
  946. });
  947. }
  948. }
  949. #endregion
  950. #region 公告管理
  951. /// <summary>
  952. /// 公告管理
  953. /// </summary>
  954. /// <returns></returns>
  955. public ActionResult noticeManage()
  956. {
  957. Model.T_Msg_NoticeInfo noticeModel = new Model.T_Msg_NoticeInfo();
  958. return View(noticeModel);
  959. }
  960. public ActionResult test()
  961. {
  962. Model.T_Msg_NoticeInfo noticeModel = new Model.T_Msg_NoticeInfo();
  963. return View(noticeModel);
  964. }
  965. /// <summary>
  966. /// 获取公告数据
  967. /// </summary>
  968. /// <param name="page">当前页码</param>
  969. /// <param name="limit">每页数据量</param>
  970. /// <returns></returns>
  971. [ActionName("NoticeListDate")]
  972. [HttpGet]
  973. public string NoticeListDate(DateTime? NowDateTime, int page, int limit, int? parentId)
  974. {
  975. //数据结果集
  976. ResponseData dataModel = new ResponseData();
  977. string sql = "";
  978. if (parentId != null)
  979. {
  980. sql += " and F_ParentId=" + parentId;
  981. }
  982. DataTable dt = new DataTable();
  983. int recordCount = 0;
  984. Model.PageData<Model.T_Msg_NoticeInfo> pageModel = new Model.PageData<Model.T_Msg_NoticeInfo>();
  985. dt = BLL.PagerBLL.GetListPager(
  986. "T_Msg_NoticeInfo",
  987. "F_NoticeId",
  988. "*,CONVERT(varchar,F_CreateOn, 120 ) as F_CreateOnNew ",
  989. sql,
  990. "ORDER BY F_NoticeId desc ",
  991. limit,
  992. page,
  993. true,
  994. out recordCount);
  995. dataModel.code = 0;
  996. dataModel.count = recordCount;
  997. dataModel.data = dt;
  998. return JsonConvert.SerializeObject(dataModel);
  999. }
  1000. BLL.T_Msg_NoticeInfo noticeBLL = new BLL.T_Msg_NoticeInfo();
  1001. BLL.T_Msg_NoticeUsers noticeuserBLL = new BLL.T_Msg_NoticeUsers();
  1002. BLL.T_Sys_UserAccount usersBLL = new BLL.T_Sys_UserAccount();
  1003. /// <summary>
  1004. /// 编辑公告
  1005. /// </summary>
  1006. /// <param name="editType">类型1、新增 2、修改</param>
  1007. /// /// <returns></returns>
  1008. public ActionResult NoticeEdit(int? noticeId, int editType)
  1009. {
  1010. Model.T_Msg_NoticeInfo viewModel = new Model.T_Msg_NoticeInfo();
  1011. //当前对象实体
  1012. if (editType == 1)
  1013. {
  1014. viewModel.F_NoticeId = int.Parse(noticeId.ToString());
  1015. viewModel.UseList = userBLL.GetModelList("");
  1016. }
  1017. else
  1018. {
  1019. Model.T_Msg_NoticeInfo userModel = noticeBLL.GetModel(int.Parse(noticeId.ToString()));
  1020. viewModel = userModel;
  1021. viewModel.UseList = userBLL.GetModelList("F_DeptId=" + userModel.F_ReceiveInfo);
  1022. }
  1023. //获取部门列表
  1024. viewModel.DepartmentList = deptBLL.GetModelList("F_ParentId=0");
  1025. return View(viewModel);
  1026. }
  1027. /// <summary>
  1028. /// 查看公告
  1029. /// </summary>
  1030. /// <param name="editType">类型1、新增 2、修改</param>
  1031. /// /// <returns></returns>
  1032. public ActionResult NoticeView(int? noticeId)
  1033. {
  1034. Model.T_Msg_NoticeInfo viewModel = new Model.T_Msg_NoticeInfo();
  1035. viewModel.F_NoticeId = int.Parse(noticeId.ToString());
  1036. viewModel.UseList = userBLL.GetModelList("");
  1037. Model.T_Msg_NoticeInfo userModel = noticeBLL.GetModel(int.Parse(noticeId.ToString()));
  1038. viewModel = userModel;
  1039. viewModel.UseList = userBLL.GetModelList("F_DeptId=" + userModel.F_ReceiveInfo);
  1040. //获取部门列表
  1041. viewModel.DepartmentList = deptBLL.GetModelList("F_ParentId=0");
  1042. return View(viewModel);
  1043. }
  1044. /// <summary>
  1045. /// 保存编辑公告
  1046. /// </summary>
  1047. /// <param name="workOrderBaseModel"></param>
  1048. /// <returns></returns>
  1049. [AcceptVerbs(HttpVerbs.Post)]
  1050. public bool SaveNoticeData(T_Msg_NoticeInfo noticeinfoModel)
  1051. {
  1052. bool result = false;
  1053. DataTable dt = new DataTable();
  1054. DataTable dtuser = new DataTable();
  1055. int noticeid = 0;
  1056. Model.T_Msg_NoticeUsers noticeuserModel = new Model.T_Msg_NoticeUsers();
  1057. DateTime? readdate =null;
  1058. try
  1059. {
  1060. //获取当前用户
  1061. noticeinfoModel.F_CreateBy = F_UserID;
  1062. noticeinfoModel.F_CreateName = HttpUtility.UrlDecode(F_UserName);
  1063. if (noticeinfoModel.F_NoticeId > 0)
  1064. {
  1065. noticeid = noticeinfoModel.F_NoticeId;
  1066. Model.T_Msg_NoticeInfo oldnoticeinfoModel = noticeBLL.GetModel(int.Parse(noticeid.ToString())); ;
  1067. dt = new YTSoft.BaseCallCenter.BLL.T_Msg_NoticeInfo().GetList("1=1 and F_NoticeId= " + noticeid).Tables[0];
  1068. if (dt.Rows.Count > 0)
  1069. {
  1070. dtuser = new YTSoft.BaseCallCenter.BLL.T_Sys_UserAccount().GetList("1=1 and F_DeptId= " + Convert.ToInt32(dt.Rows[0]["F_ReceiveInfo"].ToString())).Tables[0];
  1071. foreach (DataRow dr in dtuser.Rows)
  1072. {
  1073. noticeuserModel.F_UserId = Convert.ToInt32(dr["F_UserId"].ToString());
  1074. result = noticeuserBLL.Delete(noticeid, noticeuserModel.F_UserId);
  1075. }
  1076. }
  1077. readdate =Convert.ToDateTime( oldnoticeinfoModel.F_CreateOn);
  1078. oldnoticeinfoModel.F_Code = noticeinfoModel.F_Code;
  1079. oldnoticeinfoModel.F_Title = noticeinfoModel.F_Title;
  1080. oldnoticeinfoModel.F_Resume = noticeinfoModel.F_Resume;
  1081. oldnoticeinfoModel.F_Content = noticeinfoModel.F_Content;
  1082. oldnoticeinfoModel.F_ReceiveInfo = noticeinfoModel.F_ReceiveInfo;
  1083. oldnoticeinfoModel.F_DeviceId = noticeinfoModel.F_DeviceId;
  1084. oldnoticeinfoModel.F_State = 1;
  1085. result = noticeBLL.Update(oldnoticeinfoModel);
  1086. AddAction("t_msg_noticeinfo", oldnoticeinfoModel.F_NoticeId.ToMyString(), "修改公告");
  1087. }
  1088. else
  1089. {
  1090. noticeid = 0;
  1091. noticeinfoModel.F_DeviceId = noticeinfoModel.F_UserId;
  1092. noticeinfoModel.F_State = 1;
  1093. noticeinfoModel.F_CreateOn = DateTime.Now;
  1094. readdate = noticeinfoModel.F_CreateOn;
  1095. noticeid = noticeBLL.Add(noticeinfoModel);
  1096. AddAction("t_msg_noticeinfo", noticeid.ToMyString(), "添加公告");
  1097. }
  1098. //指定方式发送公告
  1099. if (noticeinfoModel.F_DeviceId > 0)
  1100. {//指定人员发公告
  1101. noticeuserModel.F_NoticeId = noticeid;
  1102. noticeuserModel.F_UserId = Convert.ToInt32(noticeinfoModel.F_UserId);
  1103. noticeuserModel.F_UserName = noticeinfoModel.F_UserName;
  1104. if (readdate.ToString() != "")
  1105. { noticeuserModel.F_ReadDate = readdate; }
  1106. else
  1107. {
  1108. noticeuserModel.F_ReadDate = noticeinfoModel.F_CreateOn;
  1109. }
  1110. noticeuserModel.F_State = 0;
  1111. noticeuserModel.F_Type = 0;
  1112. result = noticeuserBLL.Add(noticeuserModel);
  1113. }
  1114. else
  1115. {//指定部门发公告
  1116. dt = new YTSoft.BaseCallCenter.BLL.T_Sys_UserAccount().GetList("1=1 and F_DeptId= " + noticeinfoModel.F_ReceiveInfo).Tables[0];
  1117. if (dt.Rows.Count > 0)
  1118. {
  1119. noticeuserModel.F_NoticeId = noticeid;
  1120. if (readdate.ToString()!="")
  1121. { noticeuserModel.F_ReadDate = readdate; }
  1122. else {
  1123. noticeuserModel.F_ReadDate = noticeinfoModel.F_CreateOn;
  1124. }
  1125. foreach (DataRow dr in dt.Rows)
  1126. {
  1127. noticeuserModel.F_UserId = Convert.ToInt32(dr["F_UserId"].ToString());
  1128. noticeuserModel.F_UserName = dr["F_UserName"].ToString();
  1129. noticeuserModel.F_State = 0;
  1130. noticeuserModel.F_Type = 0;
  1131. result = noticeuserBLL.Add(noticeuserModel);
  1132. }
  1133. }
  1134. }
  1135. }
  1136. catch (Exception) { }
  1137. finally
  1138. {
  1139. dt.Clear();
  1140. dt.Dispose();
  1141. }
  1142. return result;
  1143. }
  1144. /// <summary>
  1145. /// 删除公告
  1146. /// </summary>
  1147. /// <param name="workOrderBaseModel"></param>
  1148. /// <returns></returns>
  1149. [AcceptVerbs(HttpVerbs.Get)]
  1150. public bool DeleteNoticeData(int noticeId)
  1151. {
  1152. bool res = false;
  1153. DataTable dt = new DataTable();
  1154. DataTable dtuser = new DataTable();
  1155. Model.T_Msg_NoticeUsers noticeuserModel = new Model.T_Msg_NoticeUsers();
  1156. try
  1157. {
  1158. dt = noticeBLL.GetList("1=1 and F_NoticeId= " + noticeId).Tables[0];
  1159. if (dt.Rows.Count > 0)
  1160. {
  1161. res = noticeBLL.Delete(noticeId);
  1162. AddAction("t_msg_noticeinfo", noticeId.ToMyString(), "删除公告");
  1163. //指定部门发公告
  1164. dtuser = new YTSoft.BaseCallCenter.BLL.T_Sys_UserAccount().GetList("1=1 and F_DeptId= " + Convert.ToInt32( dt.Rows[0]["F_ReceiveInfo"].ToString()) ).Tables[0];
  1165. foreach (DataRow dr in dtuser.Rows)
  1166. {
  1167. noticeuserModel.F_UserId = Convert.ToInt32(dr["F_UserId"].ToString());
  1168. noticeuserBLL.Delete(noticeId, noticeuserModel.F_UserId);
  1169. }
  1170. }
  1171. }
  1172. catch (Exception) { }
  1173. finally {
  1174. dt.Clear();
  1175. dt.Dispose();
  1176. dtuser.Clear();
  1177. dtuser.Dispose();
  1178. }
  1179. return res;
  1180. }
  1181. /// <summary>
  1182. /// 未接根据recordid更新回访信息
  1183. /// </summary>
  1184. /// <param name="SetCallRecordHfInfo"></param>
  1185. /// <returns></returns>
  1186. [ActionName("SetNoticeState")]
  1187. [HttpGet]
  1188. public string SetNoticeState(string id, string timeno)
  1189. {
  1190. string res = "";
  1191. try
  1192. {
  1193. Model.T_Msg_NoticeInfo model = new Model.T_Msg_NoticeInfo();
  1194. model.F_State =1;
  1195. model.F_NoticeId = Convert.ToInt32(id);
  1196. bool bl = new BLL.T_Msg_NoticeInfo().UpdateNoticeState(model);
  1197. if (bl)
  1198. {
  1199. res = "success";
  1200. }
  1201. }
  1202. catch
  1203. { }
  1204. return res;
  1205. }
  1206. [ActionName("CookieData")]
  1207. [HttpGet]
  1208. public string CookieData() {
  1209. return F_UserID.ToString();
  1210. }
  1211. #endregion
  1212. }
  1213. #region 接口基本信息
  1214. /// <summary>
  1215. /// 用户信息
  1216. /// </summary>
  1217. public class UserInfo
  1218. {
  1219. public int id
  1220. {
  1221. get;
  1222. set;
  1223. }
  1224. public string name
  1225. {
  1226. get;
  1227. set;
  1228. }
  1229. }
  1230. /// <summary>
  1231. /// 返回结果信息
  1232. /// </summary>
  1233. public class ResponseResult
  1234. {
  1235. public int code
  1236. {
  1237. get;
  1238. set;
  1239. }
  1240. public int data
  1241. {
  1242. get;
  1243. set;
  1244. }
  1245. }
  1246. /// <summary>
  1247. /// 返回结果信息
  1248. /// </summary>
  1249. public class WXResponseResult
  1250. {
  1251. public int customer
  1252. {
  1253. get;
  1254. set;
  1255. }
  1256. public int service
  1257. {
  1258. get;
  1259. set;
  1260. }
  1261. public int total
  1262. {
  1263. get;
  1264. set;
  1265. }
  1266. }
  1267. #endregion
  1268. }