83 lines
2.4 KiB
C#
83 lines
2.4 KiB
C#
using System;
|
|
using KART_API.Utils;
|
|
|
|
namespace KART_API.Services
|
|
{
|
|
public class LogService
|
|
{
|
|
static readonly log4net.ILog logger = log4net.LogManager.GetLogger(typeof(LogService));
|
|
|
|
/// <summary>
|
|
/// 로그인 로그 기록
|
|
/// </summary>
|
|
/// <param name="userEmail">User</param>
|
|
public static void insertLoginLog(string userEmail)
|
|
{
|
|
MSDAL msdal = new MSDAL();
|
|
var connection = msdal.ConnectReport();
|
|
|
|
try
|
|
{
|
|
string sqlString = " INSERT INTO dbo.TB_LOGIN_LOG(M_USER, L_IP) VALUES('" + userEmail + "', '" + Common.GetRemoteIP() + "'); ";
|
|
|
|
msdal.ExecuteSQL(sqlString, connection);
|
|
msdal.Disconnect(connection);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Fatal("Log > " + System.Reflection.MethodBase.GetCurrentMethod().Name + " : " + ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
msdal.Disconnect(connection);
|
|
}
|
|
}
|
|
|
|
public static void InsertSiteLog(string mkey, string projectCode, string logTitle, string logContent)
|
|
{
|
|
MSDAL msdal = new MSDAL();
|
|
var connection = msdal.ConnectReport();
|
|
try
|
|
{
|
|
string logString = "{\"projectCode\":\"" + projectCode + "\", \"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 + "')";
|
|
msdal.ExecuteSQL(insertString, connection);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Fatal("Log > " + System.Reflection.MethodBase.GetCurrentMethod().Name + " : " + ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
msdal.Disconnect(connection);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Visit Log 작성
|
|
/// </summary>
|
|
/// <param name="mkey">User Key</param>
|
|
/// <param name="logContent">로그 내용</param>
|
|
public static void InsertVisitLog(string mkey, string projectCode, string logContent)
|
|
{
|
|
MSDAL msdal = new MSDAL();
|
|
var connection = msdal.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 + "','" + projectCode + "','" + userIP + "')";
|
|
msdal.ExecuteSQL(insertString, connection);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Fatal("Log > " + System.Reflection.MethodBase.GetCurrentMethod().Name + " : " + ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
msdal.Disconnect(connection);
|
|
}
|
|
}
|
|
}
|
|
}
|