地铁二期项目正式开始

MainController.cs 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.Mvc;
  7. using YTSoft.BaseCallCenter.Model;
  8. using YTSoft.BaseCallCenter.MVCWeb.Models;
  9. using YTSoft.Common;
  10. namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
  11. {
  12. public class MainController : BaseController
  13. {
  14. BLL.T_Sys_RoleInfo roleBLL = new BLL.T_Sys_RoleInfo();
  15. public ActionResult Index()
  16. {
  17. string userid = "0";
  18. IndexModel model = new IndexModel();
  19. YTSoft.BaseCallCenter.Model.T_Sys_UserAccount p_LoginUser = new YTSoft.BaseCallCenter.Model.T_Sys_UserAccount();
  20. try
  21. {
  22. model.IsSeat = "false";
  23. if (Request.Cookies["BaseCallCenter_T_User"] != null)
  24. {
  25. userid = Request.Cookies["BaseCallCenter_T_User"]["F_UserId"];
  26. }
  27. int u = Convert.ToInt32(userid);
  28. }
  29. catch
  30. { }
  31. if (userid != "0")
  32. {
  33. p_LoginUser = new BLL.T_Sys_UserAccount().GetModel(Convert.ToInt32(userid));
  34. if (p_LoginUser != null)
  35. {
  36. if (Request.Cookies["BaseCallCenter_T_User"] != null)
  37. {
  38. p_LoginUser.F_ExtensionNumber = Request.Cookies["BaseCallCenter_T_User"]["F_ExtensionNumber"];
  39. }
  40. if (string.IsNullOrEmpty(p_LoginUser.F_HomePhone))
  41. {
  42. p_LoginUser.F_HomePhone = "/Content/images/face.jpg";
  43. }
  44. else
  45. {
  46. if (!System.IO.File.Exists(Server.MapPath(p_LoginUser.F_HomePhone)))
  47. {
  48. p_LoginUser.F_HomePhone = "/Content/images/face.jpg";
  49. }
  50. }
  51. model.UserAccountModel = p_LoginUser;
  52. model.IsSeat = "false";
  53. if (p_LoginUser.F_SeatFlag.ToString().ToLower() == "true")
  54. {
  55. model.IsSeat = "true";
  56. //ClientScript.RegisterClientScriptBlock(this.GetType(), "", "$.ligerDialog.waitting('电话服务连接中...');");
  57. }
  58. if (p_LoginUser.F_HJType == 1)
  59. {
  60. model.UserAccountModel.F_GroupId = 1001;//呼出组
  61. }
  62. BLL.T_Sys_SystemConfig bll_T_Sys_SystemConfig = new BLL.T_Sys_SystemConfig();
  63. string CTIserverIP = bll_T_Sys_SystemConfig.GetParamValueByParamCode("AcdServerIp");//CTIIP
  64. if (!string.IsNullOrEmpty(CTIserverIP))
  65. {
  66. model.CTIserverIP = CTIserverIP;
  67. }
  68. try
  69. {
  70. string CTIserverPort = bll_T_Sys_SystemConfig.GetParamValueByParamCode("AcdServerPort");//CTIIP
  71. if (!string.IsNullOrEmpty(CTIserverPort))
  72. {
  73. model.CTIserverPort = CTIserverPort;
  74. }
  75. }
  76. catch
  77. { }
  78. try
  79. {
  80. if (p_LoginUser.F_RoleId > 0)
  81. {
  82. List<T_Sys_ModuleFunctions> menuList = roleBLL.GetRoleMenu(p_LoginUser.F_RoleId);
  83. List<T_Sys_ModuleFunctions> menuModelList = new List<T_Sys_ModuleFunctions>();
  84. //获取一级菜单
  85. foreach (T_Sys_ModuleFunctions levelModel in menuList.Where(t => t.F_ParentId == 0).ToList())
  86. {
  87. List<T_Sys_ModuleFunctions> childMenuList = new List<T_Sys_ModuleFunctions>();
  88. //获取二级菜单
  89. foreach(T_Sys_ModuleFunctions childModel in menuList.Where(t=>t.F_ParentId==levelModel.F_FunctionId).ToList())
  90. {
  91. childMenuList.Add(childModel);
  92. }
  93. levelModel.ChildMenuModelList = childMenuList;
  94. menuModelList.Add(levelModel);
  95. }
  96. model.MenuModelList = menuModelList;
  97. }
  98. }
  99. catch(Exception ex)
  100. {
  101. }
  102. }
  103. }
  104. else
  105. {
  106. Response.Redirect("/Default/Login");
  107. }
  108. return View(model);
  109. }
  110. public ActionResult IndexCenter()
  111. {
  112. string userid = "0";
  113. IndexCenterModel model = new IndexCenterModel();
  114. model.RoleName = "";
  115. YTSoft.BaseCallCenter.Model.T_Sys_UserAccount p_LoginUser = new YTSoft.BaseCallCenter.Model.T_Sys_UserAccount();
  116. try
  117. {
  118. if (Request.Cookies["BaseCallCenter_T_User"] != null)
  119. {
  120. userid = Request.Cookies["BaseCallCenter_T_User"]["F_UserId"];
  121. }
  122. int u = Convert.ToInt32(userid);
  123. }
  124. catch
  125. { }
  126. if (userid != "0")
  127. {
  128. p_LoginUser = new BLL.T_Sys_UserAccount().GetModel(Convert.ToInt32(userid));
  129. if (p_LoginUser != null)
  130. {
  131. if (Request.Cookies["BaseCallCenter_T_User"] != null)
  132. {
  133. p_LoginUser.F_ExtensionNumber = Request.Cookies["BaseCallCenter_T_User"]["F_ExtensionNumber"];
  134. }
  135. model.UserAccountModel = p_LoginUser;
  136. try
  137. {
  138. model.RoleName = new BLL.T_Sys_RoleInfo().GetModel(p_LoginUser.F_RoleId).F_RoleName;
  139. }
  140. catch
  141. { }
  142. }
  143. }
  144. else
  145. {
  146. Response.Redirect("/Default/Login");
  147. }
  148. return View(model);
  149. }
  150. public ActionResult PhoneCall()
  151. {
  152. return View();
  153. }
  154. public ActionResult MainTabFrame()
  155. {
  156. return View();
  157. }
  158. public ActionResult iframeocx()
  159. {
  160. return View();
  161. }
  162. #region 电话操作日志
  163. /// <summary>
  164. /// 获取通话记录
  165. /// </summary>
  166. /// <returns></returns>
  167. [ActionName("InsertCallLogs")]
  168. [HttpGet]
  169. public string InsertCallLogs(string serverip, string ctiusercode)
  170. {
  171. string res = "error";
  172. return res;
  173. }
  174. #endregion
  175. #region 显示公告信息
  176. [ActionName("NoticeData")]
  177. [HttpGet]
  178. public string NoticeData(string timeno)
  179. {
  180. string res = "";
  181. DataTable dt = new DataTable();
  182. DataTable dtinfo = new DataTable();
  183. DataTable dtwork = new DataTable();
  184. try {
  185. res = " <ul class=\"layui-timeline\" id=\"notice\">";
  186. #region 待办工单数
  187. dtwork = new YTSoft.BaseCallCenter.BLL.T_Wo_WorkOrderBase().GetList(" 1=1 and F_WORKORDERTYPEID=1 and F_WORKORDERSTATEID=1 and F_CREATEBY=" + F_UserID).Tables[0];
  188. if (dtwork.Rows.Count > 0)
  189. {
  190. //显示所有待办工单
  191. //foreach (DataRow drwork in dtwork.Rows)
  192. //{
  193. // res = res + " <li class=\"layui-timeline-item\">";
  194. // res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: red; \">&#xe617;</i>";
  195. // res = res + "<div class=\"layui-timeline-content layui-text\">";
  196. // res = res + " <div class=\"layui-timeline-title\" style=\"color:#FF7F24;cursor: pointer;\" onclick=\"view(" + drwork["F_WORKORDERID"].ToString() + ");\" > 待办工单:" + drwork["F_CODE"].ToString() + " </div>";
  197. // res = res + " </div>";
  198. // res = res + " </li>";
  199. //}
  200. //显示待办工单数量
  201. res = res + " <li class=\"layui-timeline-item\">";
  202. res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: red; \">&#xe617;</i>";
  203. res = res + "<div class=\"layui-timeline-content layui-text\">";
  204. res = res + " <div class=\"layui-timeline-title\" style=\"color:#FF7F24;cursor: pointer;\" > 待办工单:" + dtwork.Rows.Count + "&nbsp;条</div>";
  205. res = res + " </div>";
  206. res = res + " </li>";
  207. }
  208. #endregion
  209. #region 显示公告
  210. dt = new YTSoft.BaseCallCenter.BLL.T_Msg_NoticeUsers().GetList("1=1 and F_UserId= " + F_UserID + "order by F_ReadDate desc").Tables[0];
  211. if (dt.Rows.Count>0) {
  212. foreach (DataRow dr in dt.Rows)
  213. {
  214. dtinfo = new YTSoft.BaseCallCenter.BLL.T_Msg_NoticeInfo().GetList("1=1 and F_State=1 and F_NoticeId= " + Convert.ToInt32(dr["F_NoticeId"].ToString())+ "order by F_CreateOn asc").Tables[0];
  215. foreach (DataRow drinfo in dtinfo.Rows)
  216. {
  217. res = res + " <li class=\"layui-timeline-item\">";
  218. res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: yellow; \">&#xe617;</i>";
  219. res = res + "<div class=\"layui-timeline-content layui-text\">";
  220. res = res + " <div class=\"layui-timeline-title\" style=\"color:#63B8FF;cursor: pointer;\" onclick=\"view(" + drinfo["F_NoticeId"].ToString() + ");\" > " + drinfo["F_Title"].ToString() + " </div>";
  221. res = res + " </div>";
  222. res = res + " </li>";
  223. }
  224. }
  225. }
  226. else {
  227. res = res + " <li class=\"layui-timeline-item\">";
  228. res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: yellow; \">&#xe617;</i>";
  229. res = res + "<div class=\"layui-timeline-content layui-text\">";
  230. res = res + " <div class=\"layui-timeline-title\">暂无公告</div>";
  231. res = res + " </div>";
  232. res = res + " </li>";
  233. }
  234. #endregion
  235. res = res + " </ul>";
  236. }
  237. catch (Exception)
  238. {
  239. res = res + " <li class=\"layui-timeline-item\">";
  240. res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: red; \">&#xe617;</i>";
  241. res = res + "<div class=\"layui-timeline-content layui-text\">";
  242. res = res + " <div class=\"layui-timeline-title\">请联系管理员</div>";
  243. res = res + " </div>";
  244. res = res + " </li>";
  245. }
  246. finally {
  247. dt.Clear();
  248. dt.Dispose();
  249. dtinfo.Clear();
  250. dtinfo.Dispose();
  251. dtwork.Clear();
  252. dtwork.Dispose();
  253. }
  254. return res;
  255. }
  256. #endregion
  257. }
  258. }