/// <summary> /// 记录操作日志 /// </summary> /// <param name="content">操作内容</param> public static void Insert(string content) { MUserInfo uInfo = null; bool isLogin = EyouSoft.Security.Membership.UserProvider.IsLogin(out uInfo); if (!isLogin) { return; } MComLocationInfo locationInfo = EyouSoft.Security.Membership.UserProvider.GetLocation(uInfo.SysId); EyouSoft.Model.SysStructure.MSysLogHandleInfo info = new EyouSoft.Model.SysStructure.MSysLogHandleInfo(); info.CompanyId = uInfo.CompanyId; info.Content = content; info.DeptId = uInfo.DeptId; info.DeptName = string.Empty; info.IssueTime = DateTime.Now; info.LogId = Guid.NewGuid().ToString(); info.Menu1Id = locationInfo.Menu1Id; info.Menu2Id = locationInfo.Menu2Id; info.Operator = uInfo.Name; info.OperatorId = uInfo.UserId; info.RemoteIp = EyouSoft.Toolkit.Utils.GetRemoteIP(); new BSysLogHandle().Insert(info); }
/// <summary> /// 获取当前位置信息 /// </summary> /// <param name="sysId">系统编号</param> /// <returns></returns> public static MComLocationInfo GetLocation(string sysId) { //分销商、供应商端怎么处理???待解决。 int? defaultMenu2Id = EyouSoft.Toolkit.Utils.GetIntNullable(HttpContext.Current.Request.QueryString["sl"], null); string currentExecutionFilePath = HttpContext.Current.Request.CurrentExecutionFilePath.ToLower(); if (currentExecutionFilePath == "/default.aspx") { defaultMenu2Id = 0; } if (currentExecutionFilePath.IndexOf("/groupend/distribution") > -1) { defaultMenu2Id = -1; } if (currentExecutionFilePath.IndexOf("/groupend/suppliers") > -1) { defaultMenu2Id = -2; } if (defaultMenu2Id == null) { throw new System.Exception("未设置系统默认二级栏目编号,请确保在URL查询参数中包含系统默认二级栏目编号参数:sl(这里是L不是1)。"); } MComLocationInfo locationInfo = new MComLocationInfo() { DefaultMenu2Id = 0, Menu1Id = 0, Menu1Name = string.Empty, Menu2Id = 0, Menu2Name = string.Empty }; if (string.IsNullOrEmpty(sysId)) { MSysDomain domainInfo = GetDomain(); if (domainInfo != null) { sysId = domainInfo.SysId; } } if (string.IsNullOrEmpty(sysId)) { return(locationInfo); } IList <MComMenu1Info> menus = GetComMenus(sysId); if (menus == null || menus.Count < 1) { return(locationInfo); } bool isFind = false; foreach (var item1 in menus) { if (item1 == null || item1.Menu2s == null || item1.Menu2s.Count < 1) { continue; } foreach (var item2 in item1.Menu2s) { if (item2 == null) { continue; } if (item2.DefaultMenu2Id == defaultMenu2Id.Value) { locationInfo.DefaultMenu2Id = defaultMenu2Id.Value; locationInfo.Menu1Id = item1.MenuId; locationInfo.Menu1Name = item1.Name; locationInfo.Menu2Id = item2.MenuId; locationInfo.Menu2Name = item2.Name; isFind = true; break; } } if (isFind) { break; } } return(locationInfo); }