コード例 #1
0
 /// <summary>
 /// 对象删除 的日志
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="user"></param>
 /// <param name="tag"></param>
 /// <param name="t"></param>
 /// <param name="ip"></param>
 public async Task RemoveLogAsync <T>(CurrentUser curUser, string tag, T t) where T : class, new()
 {
     OperateLog log = new OperateLog
     {
         Tag        = tag,
         Content    = ObjectToStr(t),
         Operator   = curUser.RealName,
         OperatorId = curUser.Id,
         IP         = curUser.LoginIPAddress
     };
     await OperateLogRep.AddAsync(log);
 }
コード例 #2
0
        /// <summary>
        /// 对象添加 的日志
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="user"></param>
        /// <param name="tag"></param>
        /// <param name="t"></param>
        /// <param name="ip"></param>
        public async Task InsertLogAsync <T>(CurrentUser curUser, string tag, T t) where T : class, new()
        {
            OperateLog log = new OperateLog
            {
                Tag        = tag,
                Content    = ObjectToStr(t, "UpdatePerson,UpdateDate"),
                Operator   = curUser.RealName,
                OperatorId = curUser.Id,
                IP         = curUser.LoginIPAddress
            };

            log.Id = log.CreateId();
            await OperateLogRep.AddAsync(log);
        }
コード例 #3
0
        /// <summary>
        /// 对象编辑 的日志
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="user"></param>
        /// <param name="tag"></param>
        /// <param name="ip"></param>
        /// <param name="before"></param>
        /// <param name="after"></param>
        public async Task EditLogAsync <T>(CurrentUser curUser, string tag, T before, T after) where T : class, new()
        {
            OperateLog log = new OperateLog
            {
                Tag        = tag,
                Content    = ObjectEquals(before, after, "CreatePerson,CreateDate,UpdatePerson,UpdateDate"),
                Operator   = curUser.RealName,
                OperatorId = curUser.Id,
                IP         = curUser.LoginIPAddress
            };

            if (!string.IsNullOrEmpty(log.Content))
            {
                await OperateLogRep.AddAsync(log);
            }
        }
コード例 #4
0
        /// <summary>
        /// 自定义 日志内容
        /// </summary>
        /// <param name="uinfo"></param>
        /// <param name="tag"></param>
        /// <param name="content"></param>
        public async Task CustomLogAsync(CurrentUser curUser, string tag, string content)
        {
            OperateLog log = new OperateLog
            {
                Tag        = tag,
                Content    = content,
                Operator   = curUser.RealName,
                OperatorId = curUser.Id,
                IP         = curUser.LoginIPAddress
            };

            if (!string.IsNullOrWhiteSpace(content))
            {
                await OperateLogRep.AddAsync(log);
            }
        }