コード例 #1
0
        public static void Main(string[] args)
        {
            var list = WorkListItemsDBOperate.GetWeekModifyList();
            var ids  = list.Select(a => a.Id).ToArray();

            WorkListItemsDBOperate.ModifyWeekList(ids);
            SystemLogDBOperate.AddSystemLog(new Dto.SystemLog()
            {
                CreateDate  = DateTime.Now,
                LogLevel    = LogLevel.Success.ToString(),
                MainContent = CommonMethod.ToJson(ids),
                MainKey     = "WeekModify",
                UserName    = "******",
                MainRequest = "系统自动更新工单时间"
            });
        }
コード例 #2
0
        /// <summary>
        /// 记录日志
        /// </summary>
        /// <param name="key">关键字</param>
        /// <param name="request">请求</param>
        /// <param name="content">日志内容</param>
        /// <param name="logLevel">日志等级</param>
        public void AddLog(string key, string request, string content, LogLevel logLevel = LogLevel.Warn)
        {
            SystemLog log = new SystemLog()
            {
                Ip          = CommonMethod.GetClientIP,
                MainContent = content,
                MainKey     = key,
                MainRequest = request,
                LogLevel    = logLevel.ToString(),
            };
            var user = CookieOperate.MemberCookie;

            if (user != null)
            {
                log.UserId = user.Id; log.UserName = user.Name;
            }
            SystemLogDBOperate.AddSystemLog(log);
        }