Пример #1
0
        /// <summary>
        /// 记录用户操作日志
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="projectName"></param>
        /// <param name="clientPath"></param>
        /// <param name="action"></param>
        public static void ActionLog(int projectId, string projectName, string clientPath, ActionType action)
        {
            BLL.UserLogBll     logBll   = new UserLogBll();
            Model.UserLogModel logModel = new UserLogModel();
            logModel.AddTime      = DateTime.Now;
            logModel.UserID       = UserInfo.ID;
            logModel.UserName     = UserInfo.UserName;
            logModel.UserRealName = UserInfo.RealName;
            logModel.Ip           = GetIP();

            logModel.ProjectID   = projectId;
            logModel.ProjectName = projectName;
            logModel.ClientPath  = clientPath;
            logModel.ActionType  = action.ToString();
            logModel.ActionName  = GetActionName(action);
            logBll.Add(logModel);
        }
Пример #2
0
        public JsonResult GetLogs()
        {
            string datetime = Request.Form["dateTime"];
            string stime = ""; string etime = "";

            if (string.IsNullOrEmpty(datetime))
            {
            }
            else
            {
                stime = datetime.Split('—')[0].Trim() + " 00:00:00";
                etime = datetime.Split('—')[1].Trim() + " 23:59:59";
            }
            int            offset   = Convert.ToInt32(Request.Form["offset"]);
            int            pageSize = Convert.ToInt32(Request.Form["pagesize"]);
            string         login    = Request.Cookies["MT4User"]["login"];
            int            total    = 0;
            List <UserLog> log      = new UserLogBll().GetLogsByLogin(pageSize, offset, login, stime, etime, out total);
            var            data     = new { rows = log, total = total };

            return(Json(data));
        }
Пример #3
0
        public JsonResult GetLog()
        {
            int    offset = int.Parse(Request.Form["offset"]);
            int    pageSize = int.Parse(Request.Form["pageSize"]);
            string dateTime = Request.Form["dateTime"];
            string search = Request.Form["search"].Trim();
            string stime = ""; string etime = "";

            if (!string.IsNullOrEmpty(dateTime))
            {
                stime = dateTime.Split('—')[0].Trim() + " 00:00:00";
                etime = dateTime.Split('—')[1].Trim() + " 23:59:59";
            }
            else
            {
                stime = "1970-01-01 00:00:00"; etime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
            int            total    = 0;
            List <UserLog> log      = new UserLogBll().GetLogsBySearch(offset, pageSize, search, stime, etime, out total);
            var            gridData = new { rows = log, total = total };

            return(Json(gridData));
        }
Пример #4
0
        /// <summary>
        /// 获取用户最近的操作记录
        /// </summary>
        /// <returns></returns>
        public static Model.UserLogModel GetUserLastLog(string userName)
        {
            UserLogBll logBll = new UserLogBll();

            return(logBll.GetModel(userName, 1) ?? new Model.UserLogModel());
        }