TG.WXCRM.V4/NetCore.BLL/qw/hg_excute_log_bll.cs

75 lines
2.5 KiB
C#

using Dapper;
using NetCore.Model.enums;
using NetCore.Model.qw;
using System.Data;
namespace NetCore.BLL
{
public class hg_excute_log_bll
{
private string comcode;
public hg_excute_log_bll(string _comcode)
{
comcode = _comcode;
}
/// <summary>
/// 记录执行日志
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool Log(hg_excute_log model)
{
using (IDbConnection con = ConnectionFactory.CreateConnection(ContextType.qwContext, comcode))
{
if (model.message.Length > 240)
{
model.message = model.message.Substring(0, 240);//排除多余得字符
}
return con.Execute(@"insert into hg_excute_log(pici,corpid,name,tablename,seq,starttime,endtime,exscend,message,status)
values(@pici,@corpid,@name,@tablename,@seq,@starttime,@endtime,@exscend,@message,@status)", model) > 0;
}
}
/// <summary>
/// 记录执行日志
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool LogCrm(hg_excete_log_crm model)
{
using (IDbConnection con = ConnectionFactory.CreateConnection(ContextType.crmContext, comcode))
{
if (model.message.Length > 240)
{
model.message = model.message.Substring(0, 240);//排除多余得字符
}
return con.Execute(@"insert into hg_excute_log
(id, type, starttime, endtime, exscend, message, status)
values
(pack_base.Seq_smallid_get, :type, :starttime, :endtime, :exscend, :message, :status)", model) > 0;
}
}
/// <summary>
/// 记录执行日志
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool LogWX(hg_excete_log_crm model)
{
using (IDbConnection con = ConnectionFactory.CreateConnection(ContextType.wxContext, comcode))
{
if (model.message.Length > 240)
{
model.message = model.message.Substring(0, 240);//排除多余得字符
}
return con.Execute(@"insert into hg_excute_log
(type, starttime, endtime, exscend, message, status,tablename)
values
( @type, @starttime, @endtime, @exscend, @message, @status,@tablename)", model) > 0;
}
}
}
}