This commit is contained in:
jl
2024-01-04 15:30:23 +08:00
parent 40557a235e
commit 36a20b88ce
10 changed files with 316 additions and 286 deletions

View File

@ -10,24 +10,21 @@ using static Epost.DAL.Enum.SqlLogType;
namespace Epost.DAL
{
public class ErrorLogDAL
public class ErrorLogDAL
{
DataBaseOpration.OprationSqlDAL db = DB_DLL.GetInstance();
DataBaseOpration.OprationSqlDAL db = DB_DLL.GetInstance();
#region
public bool InsertErrorLog(ErrorLogModel model)
{
try
{
string sql = string.Format("insert into errorlog(username,ControlIP,ControlID,Address,ErrorDate,Type,BkAddress,Remark) values('{0}','{1}','{2}','{3}','{4}',{5},'{6}','{7}')",
string sql = string.Format("insert into errorlog(username,ErrorDate,Type,title,Remark) values('{0}','{1}','{2}','{3}','{4}')",
model.UserName,
model.ControlIP,
model.ControlID,
model.Address,
DateTime.Now.ToString(),
model.Type,
model.BkAddress,
model.Title,
model.Remark);
int x = db.InsertSql(sql);
if (x > 0)
@ -84,7 +81,7 @@ namespace Epost.DAL
}
else
{
strSql.Append("order by Id asc");
strSql.Append("order by Id desc");
}
strSql.Append(")AS Row, T.* from ErrorLog T WITH(NOLOCK) ");
if (!string.IsNullOrEmpty(strWhere.Trim()))
@ -114,10 +111,25 @@ namespace Epost.DAL
{
LogHelper.WriteLog(GetType(), ex.Message);
recordCount = 0;
return new List<Model.ErrorLogModel>();
return new List<ErrorLogModel>();
}
}
#endregion
public long DeleteLog(string type)
{
string strwhere = string.Empty;
if (!string.IsNullOrEmpty(type))
{
strwhere = " and type ='" + type + "'";
}
string sql = string.Format("delete from errorlog where 1=1 " + strwhere + "");
return db.DeleteSql(sql);
}
}
}