using Ninject; using System; using System.Data; using System.Web.Mvc; using WX.CRM.Common; using WX.CRM.WebHelper; namespace WX.CRM.WEB.Controllers.WeWork { /// /// 企业微信列表 /// public class WorkWxController : BaseController { [Inject] public WX.CRM.IBLL.WeWork.ICorpInfo bicorpinfo { get; set; } [Inject] public WX.CRM.IBLL.WeWork.IRcontact ircontact { get; set; } // // GET: /WorkWx/ [AuthorizeRedirect(Roles = InitRights.CONST_企业微信列表)] public ActionResult Index() { //ToolBar ToolBar tool = new ToolBar(); string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.企业微信列表, userRightId); tool.AllowButton(toolbtn); tool.AddOtherButton("Other1", "聊天记录", "icon-detail", "ChatRecord_Click", true); ViewBag.ToolBar = tool; string tableId = "tablist"; Table tab = new Table(tableId); tab.AddHeadCol("vid", "", "企微ID"); tab.AddHeadCol("name", "", "姓名"); tab.AddHeadCol("jobname", "", "职位"); tab.AddHeadCol("corpname", "", "企业名称"); tab.AddHeadCol("corpid", "", "企业ID"); tab.AddHeadCol("version", "", "模块版本"); tab.AddHeadCol("logtime", "", "企微心跳"); tab.AddHeadCol("crmtime", "", "微信CRM心跳"); tab.AddHeadCol("metea", "", "手机版本"); tab.AddHeadCol("alias", "", "登陆微信"); tab.AddHeadRow(); ViewBag.gridTable = tab.GetHead(); //+ Pagination.GetPage(pager, tableId, "5,10,15,20"); ViewBag.CorpInfo = bicorpinfo.CortpInfo_Get(); return View(); } [HttpPost] [AuthorizeRedirect(Roles = InitRights.CONST_企业微信列表)] public JsonResult GetWeWorktHtmlList(string corpid, string name, string columns) { var list = bicorpinfo.WorkList_Get(corpid, name); Table table = new Table(columns, true); DateTime nowtime = DateTime.Now; //table.gridPager = pager; foreach (DataRow model in list.Rows) { table.AddCol(model["vid"]); table.AddCol(model["name"]); table.AddCol(model["corpposition"]); table.AddCol(model["corpname"]); table.AddCol(model["corpid"]); table.AddCol(model["version"]); if (model["logtime"] != DBNull.Value) { DateTime time = Convert.ToDateTime(model["logtime"]); if ((nowtime - time).TotalMinutes < 15)//大于20不在线 { table.AddCol("" + time.ToUnityString(2) + ""); } else { table.AddCol("" + time.ToUnityString(2) + ""); } } else { table.AddCol(""); } if (model["crmtime"] != DBNull.Value) { DateTime time = Convert.ToDateTime(model["crmtime"]); if ((nowtime - time).TotalMinutes < 15)//大于20不在线 { table.AddCol("" + time.ToUnityString(2) + ""); } else { table.AddCol("" + time.ToUnityString(2) + ""); } } else { table.AddCol(""); } table.AddCol(model["metea"]); table.AddCol(model["alias"]); table.AddRow(); } var json = new { rowsList = table.GetRows() }; return Json(json, JsonRequestBehavior.AllowGet); } [AuthorizeToolBar(InitRights.CONST_企业微信列表, InitToolBar.CONST_Other1)] public ActionResult Message(string vid, string vname, string column) { ViewBag.vid = vid; ViewBag.vname = vname; ViewBag.rcontact = ircontact.Rcontact_Get(vid); return View(); } } }