/// <summary> /// 详情页 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Detail(int id) { TLogsErrorLog errorLog = null; var rs = _errorLogService.GetErrorLogById(id); if (rs.ReturnCode == ReturnCodeType.Success) { errorLog = rs.Content; } return(View(errorLog)); }
/// <summary> /// 插入 /// </summary> /// <param name="item">待插入的记录</param> public bool Insert(TLogsErrorLog item) { using (var conn = DapperHelper.CreateConnection()) { var effectRows = conn.Execute(@"INSERT INTO dbo.t_logs_error_log VALUES (@SystemCode ,@Source ,@MachineName ,@IpAddress ,@ProcessId ,@ProcessName ,@ThreadId ,@ThreadName ,@AppdomainName ,@CreatedTime ,@Detail ,@Message, @ClientIp);", item); if (effectRows > 0) { return(true); } } return(false); }
/// <summary> /// 依id查询 /// </summary> /// <param name="id">id</param> /// <returns></returns> public TLogsErrorLog GetById(int id) { TLogsErrorLog result = null; using (var conn = DapperHelper.CreateConnection()) { result = conn.Query <TLogsErrorLog>(@"SELECT errorLogs.system_code AS SystemCode , errorLogs.machine_name AS MachineName , errorLogs.ip_address AS IpAddress , errorLogs.client_ip AS ClientIp, errorLogs.process_id AS ProcessId , errorLogs.process_name AS ProcessName , errorLogs.thread_id AS ThreadId , errorLogs.thread_name AS ThreadName , errorLogs.appdomain_name AS AppdomainName , errorLogs.created_time AS CreatedTime , * FROM dbo.t_logs_error_log AS errorLogs WHERE errorLogs.id = @Id;", new { @Id = id }).FirstOrDefault(); } return(result); }