/// <summary> /// 操作日志 /// </summary> /// <param name="logContent">日志内容</param> /// <param name="companyId">渠道编号</param> /// <param name="businessType">业务类型1网贷2保险3信用卡</param> /// <param name="relationId">关联编号</param> /// <returns>操作日志添加结果</returns> static public int OperationLogAdd(int relationId, string logContent, int companyId = 1, int businessType = 1) { int result = -1; try { int userId = -1; string realName = string.Empty; int departmentId = -1; string departmentName = string.Empty; LoginUserCookie currentUser = MerchantFrontCookieBLL.GetMerchantFrontUserCookie(); if (currentUser != null) { UsersBLL op = new UsersBLL(); Users model = new Users(); model = op.GetModel(currentUser.LoginUserID); userId = currentUser.LoginUserID; departmentId = model.DepartmentID; if (model != null) { realName = model.UserName; DepartmentInfoBLL opDepartment = new DepartmentInfoBLL(); DepartmentInfo modelDepartmentInfo = new DepartmentInfo(); modelDepartmentInfo = opDepartment.GetModel(departmentId); if (modelDepartmentInfo != null) { departmentName = modelDepartmentInfo.DepartmentName; } } } StackTrace st = new StackTrace(true); MethodBase mb = st.GetFrame(1).GetMethod(); string clsString = mb.DeclaringType.FullName; string mName = mb.Name; OperationLogBLL opOperationLog = new OperationLogBLL(); OperationLog modelOperationLog = new OperationLog(); modelOperationLog.BusinessType = businessType; modelOperationLog.RelationId = relationId; modelOperationLog.LogContent = logContent; modelOperationLog.Ip = System.Web.HttpContext.Current.Request.UserHostAddress; modelOperationLog.UserId = userId; modelOperationLog.RealName = realName; modelOperationLog.CreateDate = DateTime.Now; modelOperationLog.DepartmentId = departmentId; modelOperationLog.DepartmentName = departmentName; modelOperationLog.CreateDate = DateTime.Now; result = opOperationLog.Add(modelOperationLog); } catch (Exception ex) { ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }