|
using WIDESEA_Core.BaseProvider;
|
using WIDESEA_Core.Extensions.AutofacManager;
|
using WIDESEA_Entity.DomainModels;
|
using System.Linq;
|
using WIDESEA_Core.Utilities;
|
using System.Linq.Expressions;
|
using WIDESEA_Core.Extensions;
|
using Microsoft.EntityFrameworkCore;
|
using System.Threading.Tasks;
|
using System;
|
using Newtonsoft.Json;
|
using WIDESEA_Core.ManageUser;
|
|
namespace WIDESEA_Services.Services
|
{
|
public partial class dt_trackloginfoService
|
{
|
/// <summary>
|
/// 记录日志
|
/// </summary>
|
/// <param name="saveModel">参数</param>
|
/// <param name="content">返回结果</param>
|
/// <param name="logName">日志名称</param>
|
/// <param name="logCode">日志代码</param>
|
/// <param name="description">操作说明</param>
|
/// <returns></returns>
|
public WebResponseContent AddTrackLog(SaveModel saveModel, WebResponseContent content, string logName, string logCode, string description)
|
{
|
WebResponseContent content1 = new WebResponseContent();
|
try
|
{
|
//saveModel = null;
|
if (saveModel == null || content == null)
|
return content1;
|
object para;
|
if (saveModel.MainData != null)
|
para = saveModel.MainData;
|
else if (saveModel.DelKeys != null)
|
para = saveModel.DelKeys;
|
else
|
para = saveModel.DetailData;
|
|
dt_trackloginfo trackloginfo = new dt_trackloginfo { tracklog_name = logName, tracklog_content = JsonConvert.SerializeObject(para), tracklog_createtime = DateTime.Now, tracklog_type = content.Status ? "成功" : "失败", tracklog_code = content.Status ? logCode : ("4" + logCode), tracklog_des = description, tracklog_message = content.Status ? "" : content.Message, tracklog_operator = "admin"/*UserContext.Current.UserName*/ };
|
repository.Add(trackloginfo, true);
|
|
}
|
catch (Exception ex)
|
{
|
content1.Message = ex.Message;
|
}
|
return content1;
|
}
|
|
/// <summary>
|
/// 记录日志
|
/// </summary>
|
/// <typeparam name="TEntity"></typeparam>
|
/// <param name="entity">参数</param>
|
/// <param name="content">返回结果</param>
|
/// <param name="logName">日志名称</param>
|
/// <param name="logCode">日志代码</param>
|
/// <param name="description">操作说明</param>
|
/// <returns></returns>
|
public WebResponseContent AddTrackLog<T>(T entity, WebResponseContent content, string logName, string logCode, string description)
|
{
|
WebResponseContent content1 = new WebResponseContent();
|
try
|
{
|
if (entity == null || content == null)
|
return content1;
|
|
dt_trackloginfo trackloginfo = new dt_trackloginfo { tracklog_name = logName, tracklog_content = JsonConvert.SerializeObject(entity), tracklog_createtime = DateTime.Now, tracklog_type = content.Status ? "成功" : "失败", tracklog_code = content.Status ? logCode : ("4" + logCode), tracklog_des = description, tracklog_message = content.Status ? "" : content.Message, tracklog_operator = "admin"/*UserContext.Current.UserName*/ };
|
|
repository.Add(trackloginfo, true);
|
}
|
catch (Exception ex)
|
{
|
content1.Message = ex.Message;
|
}
|
return content1;
|
}
|
|
}
|
}
|