| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using YTSoft.BaseCallCenter.Model;
- using YTSoft.BaseCallCenter.MVCWeb.Models;
- using YTSoft.Common;
- namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
- {
- public class MainController : BaseController
- {
- BLL.T_Sys_RoleInfo roleBLL = new BLL.T_Sys_RoleInfo();
- public ActionResult Index()
- {
- string userid = "0";
- IndexModel model = new IndexModel();
- YTSoft.BaseCallCenter.Model.T_Sys_UserAccount p_LoginUser = new YTSoft.BaseCallCenter.Model.T_Sys_UserAccount();
- try
- {
- model.IsSeat = "false";
- if (Request.Cookies["BaseCallCenter_T_User"] != null)
- {
- userid = Request.Cookies["BaseCallCenter_T_User"]["F_UserId"];
- }
- int u = Convert.ToInt32(userid);
- }
- catch
- { }
- if (userid != "0")
- {
- p_LoginUser = new BLL.T_Sys_UserAccount().GetModel(Convert.ToInt32(userid));
- if (p_LoginUser != null)
- {
- if (Request.Cookies["BaseCallCenter_T_User"] != null)
- {
- p_LoginUser.F_ExtensionNumber = Request.Cookies["BaseCallCenter_T_User"]["F_ExtensionNumber"];
- }
- if (string.IsNullOrEmpty(p_LoginUser.F_HomePhone))
- {
- p_LoginUser.F_HomePhone = "/Content/images/face.jpg";
- }
- else
- {
- if (!System.IO.File.Exists(Server.MapPath(p_LoginUser.F_HomePhone)))
- {
- p_LoginUser.F_HomePhone = "/Content/images/face.jpg";
- }
- }
- model.UserAccountModel = p_LoginUser;
- model.IsSeat = "false";
- if (p_LoginUser.F_SeatFlag.ToString().ToLower() == "true")
- {
- model.IsSeat = "true";
- //ClientScript.RegisterClientScriptBlock(this.GetType(), "", "$.ligerDialog.waitting('电话服务连接中...');");
- }
- if (p_LoginUser.F_HJType == 1)
- {
- model.UserAccountModel.F_GroupId = 1001;//呼出组
- }
- BLL.T_Sys_SystemConfig bll_T_Sys_SystemConfig = new BLL.T_Sys_SystemConfig();
- string CTIserverIP = bll_T_Sys_SystemConfig.GetParamValueByParamCode("AcdServerIp");//CTIIP
- if (!string.IsNullOrEmpty(CTIserverIP))
- {
- model.CTIserverIP = CTIserverIP;
- }
- try
- {
- string CTIserverPort = bll_T_Sys_SystemConfig.GetParamValueByParamCode("AcdServerPort");//CTIIP
- if (!string.IsNullOrEmpty(CTIserverPort))
- {
- model.CTIserverPort = CTIserverPort;
- }
- }
- catch
- { }
- try
- {
- if (p_LoginUser.F_RoleId > 0)
- {
- List<T_Sys_ModuleFunctions> menuList = roleBLL.GetRoleMenu(p_LoginUser.F_RoleId);
- List<T_Sys_ModuleFunctions> menuModelList = new List<T_Sys_ModuleFunctions>();
- //获取一级菜单
- foreach (T_Sys_ModuleFunctions levelModel in menuList.Where(t => t.F_ParentId == 0).ToList())
- {
- List<T_Sys_ModuleFunctions> childMenuList = new List<T_Sys_ModuleFunctions>();
- //获取二级菜单
- foreach(T_Sys_ModuleFunctions childModel in menuList.Where(t=>t.F_ParentId==levelModel.F_FunctionId).ToList())
- {
- childMenuList.Add(childModel);
- }
- levelModel.ChildMenuModelList = childMenuList;
- if (levelModel.F_Name.Contains("微信客服") || levelModel.F_Name.Contains("微博客服"))
- {
- levelModel.F_OptUrl += F_PId;
- }
- menuModelList.Add(levelModel);
- }
- model.MenuModelList = menuModelList;
- }
- }
- catch(Exception ex)
- {
- }
- }
- }
- else
- {
- Response.Redirect("/Default/Login");
- }
- return View(model);
- }
- public ActionResult IndexCenter()
- {
- string userid = "0";
- IndexCenterModel model = new IndexCenterModel();
- model.RoleName = "";
- YTSoft.BaseCallCenter.Model.T_Sys_UserAccount p_LoginUser = new YTSoft.BaseCallCenter.Model.T_Sys_UserAccount();
- try
- {
- if (Request.Cookies["BaseCallCenter_T_User"] != null)
- {
- userid = Request.Cookies["BaseCallCenter_T_User"]["F_UserId"];
- }
- int u = Convert.ToInt32(userid);
- }
- catch
- { }
- if (userid != "0")
- {
- p_LoginUser = new BLL.T_Sys_UserAccount().GetModel(Convert.ToInt32(userid));
- if (p_LoginUser != null)
- {
- if (Request.Cookies["BaseCallCenter_T_User"] != null)
- {
- p_LoginUser.F_ExtensionNumber = Request.Cookies["BaseCallCenter_T_User"]["F_ExtensionNumber"];
- }
- model.UserAccountModel = p_LoginUser;
- try
- {
- model.RoleName = new BLL.T_Sys_RoleInfo().GetModel(p_LoginUser.F_RoleId).F_RoleName;
- }
- catch
- { }
- }
- }
- else
- {
- Response.Redirect("/Default/Login");
- }
- return View(model);
- }
- public ActionResult PhoneCall()
- {
- return View();
- }
- public ActionResult MainTabFrame()
- {
- return View();
- }
- public ActionResult iframeocx()
- {
- return View();
- }
- #region 电话操作日志
- /// <summary>
- /// 获取通话记录
- /// </summary>
- /// <returns></returns>
- [ActionName("InsertCallLogs")]
- [HttpGet]
- public string InsertCallLogs(string serverip, string ctiusercode)
- {
- string res = "error";
- return res;
- }
- #endregion
- #region 显示公告信息
- [ActionName("NoticeData")]
- [HttpGet]
- public string NoticeData(string timeno)
- {
- string res = "";
- DataTable dt = new DataTable();
- DataTable dtinfo = new DataTable();
- DataTable dtwork = new DataTable();
- try {
- res = " <ul class=\"layui-timeline\" id=\"notice\">";
- #region 待办工单数
- 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];
- if (dtwork.Rows.Count > 0)
- {
- //显示所有待办工单
- //foreach (DataRow drwork in dtwork.Rows)
- //{
- // res = res + " <li class=\"layui-timeline-item\">";
- // res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: red; \"></i>";
- // res = res + "<div class=\"layui-timeline-content layui-text\">";
- // res = res + " <div class=\"layui-timeline-title\" style=\"color:#FF7F24;cursor: pointer;\" onclick=\"view(" + drwork["F_WORKORDERID"].ToString() + ");\" > 待办工单:" + drwork["F_CODE"].ToString() + " </div>";
- // res = res + " </div>";
- // res = res + " </li>";
- //}
- //显示待办工单数量
- res = res + " <li class=\"layui-timeline-item\">";
- res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: red; \"></i>";
- res = res + "<div class=\"layui-timeline-content layui-text\">";
- res = res + " <div class=\"layui-timeline-title\" style=\"color:#FF7F24;cursor: pointer;\" > 待办工单:" + dtwork.Rows.Count + " 条</div>";
- res = res + " </div>";
- res = res + " </li>";
- }
- #endregion
- #region 显示公告
- dt = new YTSoft.BaseCallCenter.BLL.T_Msg_NoticeUsers().GetList("1=1 and F_UserId= " + F_UserID + "order by F_ReadDate desc").Tables[0];
- if (dt.Rows.Count>0) {
- foreach (DataRow dr in dt.Rows)
- {
- 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];
- foreach (DataRow drinfo in dtinfo.Rows)
- {
- res = res + " <li class=\"layui-timeline-item\">";
- res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: yellow; \"></i>";
- res = res + "<div class=\"layui-timeline-content layui-text\">";
- res = res + " <div class=\"layui-timeline-title\" style=\"color:#63B8FF;cursor: pointer;\" onclick=\"view(" + drinfo["F_NoticeId"].ToString() + ");\" > " + drinfo["F_Title"].ToString() + " </div>";
- res = res + " </div>";
- res = res + " </li>";
- }
- }
- }
- else {
- res = res + " <li class=\"layui-timeline-item\">";
- res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: yellow; \"></i>";
- res = res + "<div class=\"layui-timeline-content layui-text\">";
- res = res + " <div class=\"layui-timeline-title\">暂无公告</div>";
- res = res + " </div>";
- res = res + " </li>";
- }
- #endregion
- res = res + " </ul>";
-
- }
- catch (Exception)
- {
- res = res + " <li class=\"layui-timeline-item\">";
- res = res + " <i class=\"layui-icon layui-timeline-axis\" style=\"color: red; \"></i>";
- res = res + "<div class=\"layui-timeline-content layui-text\">";
- res = res + " <div class=\"layui-timeline-title\">请联系管理员</div>";
- res = res + " </div>";
- res = res + " </li>";
- }
- finally {
- dt.Clear();
- dt.Dispose();
- dtinfo.Clear();
- dtinfo.Dispose();
- dtwork.Clear();
- dtwork.Dispose();
- }
- return res;
- }
- #endregion
- }
- }
|