82 lines
2.3 KiB
C#
82 lines
2.3 KiB
C#
using System;
|
|
|
|
namespace REPORT_API_ver6.Services
|
|
{
|
|
public class Log
|
|
{
|
|
static readonly log4net.ILog logger = log4net.LogManager.GetLogger(typeof(Log));
|
|
|
|
/// <summary>
|
|
/// 로그인 로그 기록
|
|
/// </summary>
|
|
/// <param name="userEmail">User</param>
|
|
public static void insertLoginLog(string userEmail)
|
|
{
|
|
DAL dal = new DAL();
|
|
var connection = dal.ConnectReport();
|
|
|
|
try
|
|
{
|
|
string sqlString = " INSERT INTO dbo.TB_LOGIN_LOG(M_USER, L_IP) VALUES('" + userEmail + "', '" + Common.GetRemoteIP() + "'); ";
|
|
|
|
dal.ExecuteSQL(sqlString, connection);
|
|
dal.Disconnect(connection);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Fatal("Log > " + System.Reflection.MethodBase.GetCurrentMethod().Name + " : " + ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
dal.Disconnect(connection);
|
|
}
|
|
}
|
|
|
|
public static void InsertSiteLog(string mkey, string pkey, string logTitle, string logContent)
|
|
{
|
|
DAL dal = new DAL();
|
|
var connection = dal.ConnectReport();
|
|
try
|
|
{
|
|
string logString = "{\"PKEY\":\"" + pkey + "\", \"LOGTITLE\":\"" + logTitle + "\", \"LOGCONTENT\":" + logContent + "}";
|
|
string userIP = Common.GetRemoteIP();
|
|
string insertString = "insert into TB_SITE_LOG(M_USER, S_PAGE_INFO, S_IP) values ('" + mkey + "','" + logString + "','" + userIP + "')";
|
|
dal.ExecuteSQL(insertString, connection);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Fatal("Log > " + System.Reflection.MethodBase.GetCurrentMethod().Name + " : " + ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
dal.Disconnect(connection);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Visit Log 작성
|
|
/// </summary>
|
|
/// <param name="mkey">User Key</param>
|
|
/// <param name="logContent">로그 내용</param>
|
|
public static void InsertVisitLog(string mkey, string pkey, string logContent)
|
|
{
|
|
DAL dal = new DAL();
|
|
var connection = dal.ConnectReport();
|
|
try
|
|
{
|
|
string userIP = Common.GetRemoteIP();
|
|
string insertString = "insert into TB_VISIT_LOG(M_USER, V_PAGE_INFO, V_PKEY, V_IP) values ('" + mkey + "','" + logContent + "','" + pkey + "','" + userIP + "')";
|
|
dal.ExecuteSQL(insertString, connection);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Fatal("Log > " + System.Reflection.MethodBase.GetCurrentMethod().Name + " : " + ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
dal.Disconnect(connection);
|
|
}
|
|
}
|
|
}
|
|
}
|