using System; using System.Collections; using BP.DA; using BP.En; namespace BP.Sys { /// /// 属性 /// public class CFieldAttr { /// /// 属性Key /// public const string EnsName="EnsName"; /// /// 工作人员 /// public const string FK_Emp="FK_Emp"; /// /// 列选择 /// public const string Attrs="Attrs"; } /// /// 列选择 /// public class CField: EntityMyPK { #region 基本属性 /// /// 列选择 /// public string Attrs { get { return this.GetValStringByKey(CFieldAttr.Attrs ) ; } set { this.SetValByKey(CFieldAttr.Attrs,value) ; } } /// /// 操作员ID /// public string FK_Emp { get { return this.GetValStringByKey(CFieldAttr.FK_Emp ) ; } set { this.SetValByKey(CFieldAttr.FK_Emp,value) ; } } /// /// 属性 /// public string EnsName { get { return this.GetValStringByKey(CFieldAttr.EnsName ) ; } set { this.SetValByKey(CFieldAttr.EnsName,value) ; } } #endregion #region 构造方法 /// /// 列选择 /// public CField() { } /// /// 列选择 /// /// 工作人员ID /// 类名称 /// 属性 /// 值 public CField(string FK_Emp, string className) { int i = this.Retrieve(CFieldAttr.FK_Emp, FK_Emp, CFieldAttr.EnsName, className); if (i == 0) { this.EnsName = className; this.FK_Emp = FK_Emp; this.Insert(); } } /// /// map /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("Sys_UserRegedit","列选择"); map.AddMyPK(); map.AddTBString(CFieldAttr.EnsName, null, "实体类名称", false, true, 0, 100, 10); map.AddTBString(CFieldAttr.FK_Emp, null, "工作人员", false, true, 0, 100, 10); map.AddTBStringDoc(CFieldAttr.Attrs, null, "属性s", true, false); this._enMap = map; return this._enMap; } } #endregion protected override bool beforeUpdateInsertAction() { if(DataType.IsNullOrEmpty(this.MyPK)==true) this.setMyPK(this.EnsName + "_" + this.FK_Emp); return base.beforeUpdateInsertAction(); } public static Attrs GetMyAttrs(Entities ens, Map map) { string vals = BP.Difference.SystemConfig.GetConfigXmlEns("ListAttrs", ens.ToString()); if (vals == null) return map.Attrs; Attrs attrs=new Attrs(); foreach (Attr attr in map.Attrs) { if ( vals.Contains(","+attr.Key+",") ) attrs.Add(attr); } return attrs; } } /// /// 列选择s /// public class CFields : EntitiesMyPK { /// /// 列选择s /// public CFields() { } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new CField(); } } #region 为了适应自动翻译成java的需要,把实体转换成List. /// /// 转化成 java list,C#不能调用. /// /// List public System.Collections.Generic.IList ToJavaList() { return (System.Collections.Generic.IList)this; } /// /// 转化成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((CField)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }