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 menuList = roleBLL.GetRoleMenu(p_LoginUser.F_RoleId); List menuModelList = new List(); //获取一级菜单 foreach (T_Sys_ModuleFunctions levelModel in menuList.Where(t => t.F_ParentId == 0).ToList()) { List childMenuList = new List(); //获取二级菜单 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 电话操作日志 /// /// 获取通话记录 /// /// [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 = "
    "; #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 + "
  • "; // res = res + " "; // res = res + "
    "; // res = res + "
    待办工单:" + drwork["F_CODE"].ToString() + "
    "; // res = res + "
    "; // res = res + "
  • "; //} //显示待办工单数量 res = res + "
  • "; res = res + " "; res = res + "
    "; res = res + "
    待办工单:" + dtwork.Rows.Count + " 条
    "; res = res + "
    "; res = res + "
  • "; } #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 ISNULL(F_ModifyDate,F_CreateOn) desc").Tables[0]; List noticelist = (from r in dt.AsEnumerable() select r.Field("F_NoticeId")).ToList(); // string[] names = dt.Rows.OfType().Select(r => r["F_NoticeId"].ToString()).ToArray(); 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]; foreach (DataRow drinfo in dtinfo.Rows) { string fabushijian = ""; if (drinfo["F_ModifyDate"] != null) { if (drinfo["F_ModifyDate"].ToString() != "") { fabushijian = drinfo["F_ModifyDate"].ToString(); } else { fabushijian = drinfo["F_CreateOn"].ToString(); } } else { fabushijian = drinfo["F_CreateOn"].ToString(); } res = res + "
  • "; res = res + " "; res = res + "
    "; res = res + "
    " + drinfo["F_Title"].ToString() + "
    " + fabushijian + "
    "; res = res + "
    "; res = res + "
  • "; } //} } else { res = res + "
  • "; res = res + " "; res = res + "
    "; res = res + "
    暂无公告
    "; res = res + "
    "; res = res + "
  • "; } #endregion res = res + "
"; } catch (Exception) { res = res + "
  • "; res = res + " "; res = res + "
    "; res = res + "
    请联系管理员
    "; res = res + "
    "; res = res + "
  • "; } finally { dt.Clear(); dt.Dispose(); dtinfo.Clear(); dtinfo.Dispose(); dtwork.Clear(); dtwork.Dispose(); } return res; } #endregion } }