/// <summary> /// This is called to create a default file /// </summary> public virtual void InitDefaults() { GlobalMap.Add(new ViewAction() { EventName = "Click", EventHandlerName = "EventHandler", EventArgsName = "EventArgs" }); var textBoxAction = new ViewActions(); textBoxAction.Add(new ViewAction() { EventName = "TextChanged", EventHandlerName = "EventHandler", EventArgsName = "EventArgs" }); ControlActionMap.Add(new ViewControlAction() { ControlType = "TextBox", ControlActions = textBoxAction }); var comboBoxAction = new ViewActions(); comboBoxAction.Add(new ViewAction() { EventName = "CheckedChanged", EventHandlerName = "EventHandler", EventArgsName = "EventArgs" }); ControlActionMap.Add(new ViewControlAction() { ControlType = "CheckBox", ControlActions = comboBoxAction }); }
/// <summary> /// 通过controller和anction 获取每天访问次数 /// </summary> /// <returns></returns> public ActionResult ActionLogStatEveryDayByFunction(string _controller, string _action, int userId = 0) { string functionName = string.Empty; ControlActionMap item = ncBase.CurrentEntities.ControlActionMap.Where(m => m.Controller == _controller && m.Action == _action).FirstOrDefault(); if (item.IsNoNull()) { functionName = item.FunctionName; } if (string.IsNullOrEmpty(functionName)) { functionName = _controller + "/" + _action; } string userName = string.Empty; if (userId > 0) { PublicUserModel user = userBll.GetUserById(userId); if (user.IsNoNull()) { userName = user.Name; } } ViewBag.FunctionName = functionName; ViewBag.Controller = _controller; ViewBag.Action = _action; ViewBag.UserId = userId; ViewBag.UserName = userName; return(View()); }
/// <summary> /// 改变功能描述的状态(是否重点功能) /// </summary> /// <param name="newItem"></param> /// <returns></returns> public JsonResult EditControlActionMapStatus(ControlActionMap newItem) { ControlActionMap itemMap = ncBase.CurrentEntities.ControlActionMap.Where(m => m.Controller == newItem.Controller && m.Action == newItem.Action).FirstOrDefault(); if (itemMap.IsNoNull()) { itemMap.Status = newItem.Status; ncBase.CurrentEntities.SaveChanges(); return(Json(new { status = 1 })); } return(Json(new { status = 0 })); }
/// <summary> /// 添加或者修改功能描述 /// </summary> /// <param name="newItem"></param> /// <returns></returns> public JsonResult EditControlActionMap(ControlActionMap newItem) { ControlActionMap itemMap = ncBase.CurrentEntities.ControlActionMap.Where(m => m.Controller == newItem.Controller && m.Action == newItem.Action).FirstOrDefault(); if (itemMap.IsNoNull()) { itemMap.Status = 1; itemMap.FunctionName = newItem.FunctionName; ncBase.CurrentEntities.SaveChanges(); } else { newItem.Status = 1; ncBase.CurrentEntities.ControlActionMap.AddObject(newItem); ncBase.CurrentEntities.SaveChanges(); } return(Json(new { status = 1 })); }