using BP.En; using BP.Sys; using BP.WF.Template; namespace BP.WF.Port.Admin2Group { /// /// 组织管理员 /// public class OAFrmTreeAttr : BP.En.EntityMyPKAttr { /// /// 关联的二级管理员 /// public const string RefOrgAdminer = "RefOrgAdminer"; /// /// 管理员 /// public const string FK_Emp = "FK_Emp"; /// /// 组织 /// public const string OrgNo = "OrgNo"; public const string FrmTreeNo = "FrmTreeNo"; } /// /// 组织管理员- /// public class OAFrmTree : EntityMyPK { #region 属性 public string FK_Emp { get { return this.GetValStringByKey(OAFrmTreeAttr.FK_Emp); } set { this.SetValByKey(OAFrmTreeAttr.FK_Emp, value); } } public string OrgNo { get { return this.GetValStringByKey(OAFrmTreeAttr.OrgNo); } set { this.SetValByKey(OAFrmTreeAttr.OrgNo, value); } } #endregion #region 构造方法 /// /// 组织管理员 /// public OAFrmTree() { } /// /// 组织管理员 /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("Port_OrgAdminerFrmTree", "表单目录权限"); map.AddMyPK(); map.AddTBString(OAFrmTreeAttr.OrgNo, null, "组织", true, false, 0, 100, 20); map.AddTBString(OAFrmTreeAttr.FK_Emp, null, "管理员", true, false, 0, 100, 20); map.AddTBString(OAFrmTreeAttr.RefOrgAdminer, null, "组织管理员", true, false, 0, 100, 20); //map.AddDDLEntities(OAFrmTreeAttr.FK_Emp, null, "管理员", new Emps(), false); //map.AddDDLEntities(OAFrmTreeAttr.RefOrgAdminer, null, "管理员", new Emps(), false); map.AddDDLEntities(OAFrmTreeAttr.FrmTreeNo, null, "表单目录", new SysFormTrees(), false); this._enMap = map; return this._enMap; } } #endregion protected override bool beforeInsert() { string str = this.GetValStringByKey("RefOrgAdminer"); this.MyPK = this.GetValStringByKey("RefOrgAdminer") + "_" + this.GetValStringByKey("FrmTreeNo"); OrgAdminer oa = new OrgAdminer(str); this.OrgNo = oa.OrgNo; this.FK_Emp = oa.FK_Emp; return base.beforeInsert(); } protected override void afterInsert() { //插入入后更改OrgAdminer中 string str = ""; SysFormTrees enTrees = new SysFormTrees(); enTrees.RetrieveInSQL("SELECT FrmTreeNo FROM Port_OrgAdminerFrmTree WHERE FK_Emp='" + this.FK_Emp + "' AND OrgNo='" + this.OrgNo + "'"); foreach (SysFormTree item in enTrees) { str += "(" + item.No + ")" + item.Name + ";"; } OrgAdminer adminer = new OrgAdminer(this.GetValStringByKey("RefOrgAdminer")); adminer.SetValByKey("FrmTrees", str); adminer.Update(); base.afterInsert(); } } /// /// 组织管理员s /// public class OAFrmTrees : EntitiesMyPK { #region 构造 /// /// 组织s /// public OAFrmTrees() { } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new OAFrmTree(); } } #endregion #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((OAFrmTree)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }