/// <summary> /// 写入用户登录日志 /// </summary> public static void LoginLog(string UserName, string Msg) { try { Bll_Sys_LoginLog instance = new Bll_Sys_LoginLog(); Sys_LoginLog model = new Sys_LoginLog() { EL_Date = DateTime.Now, EL_UserCode = UserName, EL_UserName = SessionConfig.UserName(), EL_IP = HttpContext.Current.Request.UserHostAddress, EL_Mac = "", EL_Company = SessionConfig.Company(), EL_Dept = SessionConfig.DeptName(), EL_Success = Msg }; instance.Insert(model); } catch (System.Exception ex) { PlateLog.WriteInFile(SessionConfig.UserId(), SessionConfig.UserName(), HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.ToString(), ex.Message, PlateLog.LogMessageType.Error, ex); } }
/// <summary> /// 写入操作日志 /// </summary> /// <param name="Module">模块编码 </param> /// <param name="ModuleName">模块名称</param> /// <param name="Message">异常信息</param> public static void OpLog(string Module, string ModuleName, string Message) { var IS_OPEN_PERMISSION = ConfigHelper.GetApp("IS_OPEN_FUNCATIONLOG"); if (!string.IsNullOrEmpty(IS_OPEN_PERMISSION) && IS_OPEN_PERMISSION == "true") { try { PlateLog.WriteOp(SessionConfig.UserId(), SessionConfig.UserName(), HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.ToString(), Message, PlateLog.LogMessageType.Info, Module, ModuleName); } catch (System.Exception ex) { PlateLog.WriteInFile(SessionConfig.UserId(), SessionConfig.UserName(), HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.ToString(), Message, PlateLog.LogMessageType.Error, ex); } } }