You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4 KiB
C#

11 months ago
using BookingWeb.DB;
using BookingWeb.DB.Model;
using BookingWeb.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace BookingWeb.Helper
{
public static class LogHelper
{
private static InfoDB infoDB = new InfoDB();
public static bool Log(OpLogModule module, OpLogType type, string billNO, string mblno, string json)
{
if (HttpContext.Current.Session["UserInfo"] != null
&& HttpContext.Current.Session["CompanyInfo"] != null)
{
CurrentUser user = HttpContext.Current.Session["UserInfo"] as CurrentUser;
CurrentCompany compnay = HttpContext.Current.Session["CompanyInfo"] as CurrentCompany;
OP_LOG log = new OP_LOG();
log.OpTime = DateTime.Now;
log.OpUserId = user.GID;
log.OpUserName = user.NAME;
log.OpCompanyId = compnay.GID;
log.OpCompanyName = compnay.COMPANY_NAME;
log.Module = module.ToString();
log.Type = type.ToString();
log.BillNO = billNO;
log.MBLNO = mblno;
log.JsonValue = json;
infoDB.Logs.Add(log);
infoDB.SaveChanges();
return true;
}
return false;
}
}
}