using System; using System.Collections.Generic; using System.Data.Common; using System.Linq; using System.Management; using System.Net; using System.Text; using System.Threading.Tasks; using ProjectBase.Data.BaseDAL; using SIMDP.DAL.IDALSQL; using SIMDP.Model; using ProjectBase.Util; namespace SIMDP.BLL { public class BlLogOperation : BaseBLL { private IDalLogOperation dalLogOperation; /// /// 构造函数 /// public BlLogOperation() : base() { base.Init(this.GetType().FullName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name); dalLogOperation = baseDal as IDalLogOperation; } /// /// 获取组织ID与组织名称的集合 /// /// public Dictionary GetGroupName() { Dictionary dic = new Dictionary(); //BlAuthoryGroup bl = new BlAuthoryGroup(); List group = BLLFactory.Instance.GetAll(); if (group.Count == 0 || group == null) { return null; } foreach (MoAuthoryGroup item in group) { dic.Add(item.GroupId, item.GroupName); } return dic; } /// /// 根据相关信息,写入用户的操作日志记录 /// /// 操作用户 /// 操作表名称 /// 操作类型 /// 操作详细表述,目前数据表不包含这个字段,赋值为空 /// 事务对象 /// public static bool OnOperationLog(string userId, string tableName, string operationType, string note = null, DbTransaction trans = null) { //虽然实现了这个事件,但是我们还需要判断该表是否在配置表里面,如果不在,则不记录操作日志。 //BlLogOperationSetting blSetting = new BlLogOperationSetting(); //MoLogOperationSetting settingInfo = BLLFactory.Instance.FindByTableName(tableName, trans); // if (settingInfo != null) // { //bool insert = operationType == "增加" && settingInfo.InsertLog; //bool update = operationType == "修改" && settingInfo.UpdateLog; //bool delete = operationType == "删除" && settingInfo.DeleteLog; //if (insert || update || delete) //{ MoLogOperation info = new MoLogOperation(); info.TableName = tableName; info.Type = operationType; info.Time = DateTime.Now; if (!string.IsNullOrEmpty(userId)) { //BlAuthoryUser blUser = new BlAuthoryUser(); MoAuthoryUser userInfo = BLLFactory.Instance.FindByID(userId, trans); if (userInfo != null) { info.Account = userId; info.Name = userInfo.UserName; info.GroupId = userInfo.GroupId; } } info.Ip = SysEnvironment.Ip; info.Mac = SysEnvironment.Mac; //BlLogOperation bl = new BlLogOperation(); return BLLFactory.Instance.Insert(info, trans); //return true; //} // } // return false; } } }