Ejemplo n.º 1
0
        /// <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());
        }
Ejemplo n.º 2
0
        /// <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 }));
        }
Ejemplo n.º 3
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 }));
        }