地铁二期项目正式开始

MainController.cs 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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. if (levelModel.F_Name.Contains("微信客服") || levelModel.F_Name.Contains("微博客服"))
  95. {
  96. levelModel.F_OptUrl += F_PId;
  97. }
  98. menuModelList.Add(levelModel);
  99. }
  100. model.MenuModelList = menuModelList;
  101. }
  102. }
  103. catch(Exception ex)
  104. {
  105. }
  106. }
  107. }
  108. else
  109. {
  110. Response.Redirect("/Default/Login");
  111. }
  112. return View(model);
  113. }
  114. public ActionResult IndexCenter()
  115. {
  116. string userid = "0";
  117. IndexCenterModel model = new IndexCenterModel();
  118. model.RoleName = "";
  119. YTSoft.BaseCallCenter.Model.T_Sys_UserAccount p_LoginUser = new YTSoft.BaseCallCenter.Model.T_Sys_UserAccount();
  120. try
  121. {
  122. if (Request.Cookies["BaseCallCenter_T_User"] != null)
  123. {
  124. userid = Request.Cookies["BaseCallCenter_T_User"]["F_UserId"];
  125. }
  126. int u = Convert.ToInt32(userid);
  127. }
  128. catch
  129. { }
  130. if (userid != "0")
  131. {
  132. p_LoginUser = new BLL.T_Sys_UserAccount().GetModel(Convert.ToInt32(userid));
  133. if (p_LoginUser != null)
  134. {
  135. if (Request.Cookies["BaseCallCenter_T_User"] != null)
  136. {
  137. p_LoginUser.F_ExtensionNumber = Request.Cookies["BaseCallCenter_T_User"]["F_ExtensionNumber"];
  138. }
  139. model.UserAccountModel = p_LoginUser;
  140. try
  141. {
  142. model.RoleName = new BLL.T_Sys_RoleInfo().GetModel(p_LoginUser.F_RoleId).F_RoleName;
  143. }
  144. catch
  145. { }
  146. }
  147. }
  148. else
  149. {
  150. Response.Redirect("/Default/Login");
  151. }
  152. return View(model);
  153. }
  154. public ActionResult PhoneCall()
  155. {
  156. return View();
  157. }
  158. public ActionResult MainTabFrame()
  159. {
  160. return View();
  161. }
  162. public ActionResult iframeocx()
  163. {
  164. return View();
  165. }
  166. #region 电话操作日志
  167. /// <summary>
  168. /// 获取通话记录
  169. /// </summary>
  170. /// <returns></returns>
  171. [ActionName("InsertCallLogs")]
  172. [HttpGet]
  173. public string InsertCallLogs(string serverip, string ctiusercode)
  174. {
  175. string res = "error";
  176. return res;
  177. }
  178. #endregion
  179. #region 显示公告信息
  180. [ActionName("NoticeData")]
  181. [HttpGet]
  182. public string NoticeData(string timeno)
  183. {
  184. string res = "";
  185. DataTable dt = new DataTable();
  186. DataTable dtinfo = new DataTable();
  187. DataTable dtwork = new DataTable();
  188. try {
  189. res = " <ul class=\"layui-timeline\" id=\"notice\">";
  190. #region 待办工单数
  191. 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];
  192. if (dtwork.Rows.Count > 0)
  193. {
  194. //显示所有待办工单
  195. //foreach (DataRow drwork in dtwork.Rows)
  196. //{
  197. // res = res + " <li class=\"layui-timeline-item\">";
  198. // res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: red; \">&#xe617;</i>";
  199. // res = res + "<div class=\"layui-timeline-content layui-text\">";
  200. // res = res + " <div class=\"layui-timeline-title\" style=\"color:#FF7F24;cursor: pointer;\" onclick=\"view(" + drwork["F_WORKORDERID"].ToString() + ");\" > 待办工单:" + drwork["F_CODE"].ToString() + " </div>";
  201. // res = res + " </div>";
  202. // res = res + " </li>";
  203. //}
  204. //显示待办工单数量
  205. res = res + " <li class=\"layui-timeline-item\">";
  206. res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: red; \">&#xe617;</i>";
  207. res = res + "<div class=\"layui-timeline-content layui-text\">";
  208. res = res + " <div class=\"layui-timeline-title\" style=\"color:#FF7F24;cursor: pointer;\" > 待办工单:" + dtwork.Rows.Count + "&nbsp;条</div>";
  209. res = res + " </div>";
  210. res = res + " </li>";
  211. }
  212. #endregion
  213. #region 显示公告
  214. dt = new YTSoft.BaseCallCenter.BLL.T_Msg_NoticeUsers().GetList("1=1 and F_UserId= " + F_UserID + "order by F_ReadDate desc").Tables[0];
  215. if (dt.Rows.Count>0) {
  216. //foreach (DataRow dr in dt.Rows)
  217. //{
  218. // 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 ISNULL(F_ModifyDate,F_CreateOn) desc").Tables[0];
  219. List<int> noticelist = (from r in dt.AsEnumerable() select r.Field<int>("F_NoticeId")).ToList<int>();
  220. // string[] names = dt.Rows.OfType<DataRow>().Select(r => r["F_NoticeId"].ToString()).ToArray();
  221. dtinfo = new YTSoft.BaseCallCenter.BLL.T_Msg_NoticeInfo().GetList("1=1 and F_State=1 and F_NoticeId in ( '" + string.Join("','", noticelist) + "') order by ISNULL(F_ModifyDate,F_CreateOn) desc").Tables[0];
  222. foreach (DataRow drinfo in dtinfo.Rows)
  223. {
  224. string fabushijian = "";
  225. if (drinfo["F_ModifyDate"] != null)
  226. {
  227. if (drinfo["F_ModifyDate"].ToString() != "")
  228. {
  229. fabushijian = drinfo["F_ModifyDate"].ToString();
  230. }
  231. else
  232. {
  233. fabushijian = drinfo["F_CreateOn"].ToString();
  234. }
  235. }
  236. else
  237. {
  238. fabushijian = drinfo["F_CreateOn"].ToString();
  239. }
  240. res = res + " <li class=\"layui-timeline-item\">";
  241. res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: yellow; \">&#xe617;</i>";
  242. res = res + "<div class=\"layui-timeline-content layui-text\">";
  243. res = res + " <div class=\"layui-timeline-title\" style=\"color:#63B8FF;cursor: pointer;\" onclick=\"view(" + drinfo["F_NoticeId"].ToString() + ");\" > " + drinfo["F_Title"].ToString() + "<div style=\"float:right\">" + fabushijian + " </div> </div>";
  244. res = res + " </div>";
  245. res = res + " </li>";
  246. }
  247. //}
  248. }
  249. else {
  250. res = res + " <li class=\"layui-timeline-item\">";
  251. res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: yellow; \">&#xe617;</i>";
  252. res = res + "<div class=\"layui-timeline-content layui-text\">";
  253. res = res + " <div class=\"layui-timeline-title\">暂无公告</div>";
  254. res = res + " </div>";
  255. res = res + " </li>";
  256. }
  257. #endregion
  258. res = res + " </ul>";
  259. }
  260. catch (Exception)
  261. {
  262. res = res + " <li class=\"layui-timeline-item\">";
  263. res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: red; \">&#xe617;</i>";
  264. res = res + "<div class=\"layui-timeline-content layui-text\">";
  265. res = res + " <div class=\"layui-timeline-title\">请联系管理员</div>";
  266. res = res + " </div>";
  267. res = res + " </li>";
  268. }
  269. finally {
  270. dt.Clear();
  271. dt.Dispose();
  272. dtinfo.Clear();
  273. dtinfo.Dispose();
  274. dtwork.Clear();
  275. dtwork.Dispose();
  276. }
  277. return res;
  278. }
  279. [HttpPost]
  280. public bool addOPeratorLog(string typeName)
  281. {
  282. return AddAction("",F_UserName,typeName,"","坐席操作记录");
  283. }
  284. #endregion
  285. }
  286. }