using BookingJieFeng.DB; using BookingJieFeng.DB.Model; using BookingJieFeng.Models; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace BookingJieFeng.Helper { public static class LogHelper { private static BookingDB bookingDB = new BookingDB(); 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; bookingDB.Logs.Add(log); bookingDB.SaveChanges(); return true; } return false; } } }