DS7/WebSqlHelper/LogHelper.cs

67 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Common;
using System.Text.RegularExpressions;
namespace WebSqlHelper
{
public class LogHelper
{
public int UserID { set; get; }
public string UserLoginName { set; get; }
public int DepartID { set; get; }
public int CompneyID { set; get; }
public string ModuleID { set; get; }
public string UrlString { set; get; }
/// <summary>
/// 操作类型
/// </summary>
public string Otype { set; get; }
public void ExecLoger(DbCommand dbcomm)
{
try
{
SqlDbHelper db = new SqlDbHelper();
string sqlstr = @"INSERT INTO [tSys_OperLog]
([Logid]
,[Opertor]
,[LoginName]
,[Companyid]
,[Departid]
,[ModulId]
,[Url]
,[OType]
,[ESS])
VALUES
(@Logid
,@Opertor
,@LoginName
,@Companyid
,@Departid
,@ModulId
,@Url
,@OType
,@ESS)";
int logid = db.GetNext("tSys_OperLog", "Logid");
if (string.IsNullOrEmpty(Otype)) Otype = "未指定";
db.SetSqlStrNonQuery(null, sqlstr,
db.GetParameter("Logid", logid),
db.GetParameter("Opertor", UserID),
db.GetParameter("LoginName", UserLoginName),
db.GetParameter("Companyid", CompneyID),
db.GetParameter("Departid", DepartID),
db.GetParameter("ModulId", ModuleID),
db.GetParameter("Url", UrlString),
db.GetParameter("OType", Otype),
db.GetParameter("ESS", dbcomm.CommandText));
}
catch (Exception ex)
{
}
}
}
}