using System; using System.Collections; using BP.DA; using BP.En; using BP.Difference; using BP; namespace BP.Sys { /// /// 用户日志 /// public class UserLogAttr { /// /// 名称 /// public const string EmpNo = "EmpNo"; /// /// 用户名 /// public const string EmpName = "EmpName"; /// /// 日志标记 /// public const string LogFlag = "LogFlag"; public const string LevelText = "LevelText"; /// /// 处理内容 /// public const string Docs = "Docs"; /// /// 记录日期 /// public const string RDT = "RDT"; /// /// IP地址 /// public const string IP = "IP"; } /// /// 用户日志 /// public class UserLog: EntityMyPK { public override UAC HisUAC { get { UAC uac = new UAC(); uac.Readonly(); return uac; } } #region 基本属性 public string IP { get { return this.GetValStringByKey(UserLogAttr.IP); } set { this.SetValByKey(UserLogAttr.IP, value); } } /// /// 日志标记键 /// public string LogFlag { get { return this.GetValStringByKey(UserLogAttr.LogFlag); } set { this.SetValByKey(UserLogAttr.LogFlag, value); } } /// /// FK_Emp /// public string EmpNo { get { return this.GetValStringByKey(UserLogAttr.EmpNo) ; } set { this.SetValByKey(UserLogAttr.EmpNo, value) ; } } public string EmpName { get { return this.GetValStringByKey(UserLogAttr.EmpName); } set { this.SetValByKey(UserLogAttr.EmpName, value); } } public string RDT { get { return this.GetValStringByKey(UserLogAttr.RDT); } set { this.SetValByKey(UserLogAttr.RDT, value); } } public string Docs { get { return this.GetValStringByKey(UserLogAttr.Docs); } set { this.SetValByKey(UserLogAttr.Docs, value); } } #endregion #region 构造方法 /// /// 用户日志 /// public UserLog() { } /// /// EnMap /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("Sys_UserLogT", "用户日志"); map.AddMyPK(); map.AddTBString(UserLogAttr.EmpNo, null, "用户账号", true, true, 0, 50, 20); map.AddTBString(UserLogAttr.EmpName, null, "用户名", true, true, 0, 30, 20); map.AddTBString(UserLogAttr.RDT, null, "记录日期", true, true, 0, 20, 20); map.AddTBString(UserLogAttr.IP, null, "IP", true, true, 0, 200, 20); map.AddTBStringDoc(UserLogAttr.Docs, null, "说明", true, true, true); //map.AddDDLEntities(UserLogAttr.LogFlag, null, "类型", new UserLogTypes(), false); //map.AddDDLEntities(UserLogAttr.Level, null, "级别", new UserLogLevels(), false); map.AddTBString(UserLogAttr.LogFlag, null, "类型", true, true, 0, 200, 20); map.AddTBString(UserLogAttr.LevelText, null, "级别", true, true, 0, 200, 20); map.DTSearchKey = UserLogAttr.RDT; map.DTSearchWay = DTSearchWay.ByDate; //查询条件. map.AddSearchAttr(UserLogAttr.LevelText); map.AddSearchAttr(UserLogAttr.LogFlag); this._enMap = map; return this._enMap; } } #endregion protected override bool beforeInsert() { this.setMyPK(DBAccess.GenerGUID()); this.RDT = DataType.CurrentDateTime; if (BP.Difference.SystemConfig.isBSsystem) this.IP = BP.Difference.Glo.GetIP; if (DataType.IsNullOrEmpty(this.EmpNo) == true) { this.EmpNo = BP.Web.WebUser.No; this.EmpName = BP.Web.WebUser.Name; } return base.beforeInsert(); } #region 重写 public override Entities GetNewEntities { get { return new UserLogs(); } } #endregion 重写 } /// /// 用户日志s /// public class UserLogs : EntitiesMyPK { #region 构造 public UserLogs() { } /// /// /// /// public UserLogs(string emp) { QueryObject qo = new QueryObject(this); qo.AddWhere(UserLogAttr.EmpNo, emp); qo.DoQuery(); } #endregion #region 重写 /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new UserLog(); } } #endregion #region 为了适应自动翻译成java的需要,把实体转换成List. /// /// 转化成list /// /// List public System.Collections.Generic.List Tolist() { System.Collections.Generic.List list = new System.Collections.Generic.List(); for (int i = 0; i < this.Count; i++) { list.Add((UserLog)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. #region 为了适应自动翻译成java的需要,把实体转换成IList, c#代码调用会出错误。 /// /// 转化成list /// /// List public System.Collections.Generic.IList ToJavaList() { return (System.Collections.Generic.IList)this; } #endregion 为了适应自动翻译成java的需要,把实体转换成IList, c#代码调用会出错误。 } }