Пример #1
0
        /// <summary>
        /// 依据id获取
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public TLogsOperateLog GetById(long id)
        {
            TLogsOperateLog result = null;

            using (var conn = DapperHelper.CreateConnection())
            {
                result = conn.Query <TLogsOperateLog>(@"SELECT  operateLogs.system_code AS SystemCode ,
                                operateLogs.machine_name AS MachineName ,
                                operateLogs.ip_address AS IpAddress ,
                                operateLogs.process_id AS ProcessId ,
                                operateLogs.process_name AS ProcessName ,
                                operateLogs.thread_id AS ThreadId ,
                                operateLogs.thread_name AS ThreadName ,
                                operateLogs.appdomain_name AS AppdomainName ,
                                operateLogs.operated_time AS OperatedTime ,
                                operateLogs.user_id AS UserId ,
                                operateLogs.user_name AS UserName ,
                                operateLogs.operate_module AS OperateModule ,
                                operateLogs.operate_type AS OperateType ,
                                operateLogs.modify_before AS ModifyBefore ,
                                operateLogs.modify_after AS ModifyAfter ,
                                operateLogs.created_time AS CreatedTime ,
                                operateLogs.client_ip AS ClientIp ,
                                operateLogs.corp_id AS CorpId,
                                operateLogs.corp_name AS CorpName,
                                *
                        FROM    dbo.t_logs_operate_log (NOLOCK) AS operateLogs
                        WHERE   operateLogs.id = @Id;", new { @Id = id }).FirstOrDefault();
            }

            return(result);
        }
Пример #2
0
        /// <summary>
        /// 详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Detail(long id)
        {
            TLogsOperateLog operateLog = null;
            var             rs         = _operateLogService.GetById(id);

            if (rs.ReturnCode == ReturnCodeType.Success)
            {
                operateLog = rs.Content;
            }

            return(View(operateLog));
        }
Пример #3
0
        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="item">待插入的记录</param>
        public bool Insert(TLogsOperateLog item)
        {
            using (var conn = DapperHelper.CreateConnection())
            {
                var effectedRows = conn.Execute(@"INSERT INTO dbo.t_logs_operate_log VALUES  (@SystemCode ,@Source ,@MachineName ,@IpAddress ,@ProcessId ,@ProcessName ,@ThreadId ,@ThreadName ,@AppdomainName ,@OperatedTime ,@UserId ,@UserName ,@OperateModule ,@OperateType ,@ModifyBefore ,@ModifyAfter ,@CreatedTime, @ClientIp, @CorpId, @CorpName, @Remark);", item);
                if (effectedRows > 0)
                {
                    return(true);
                }
            }

            return(false);
        }