using BP.En; using BP.Port; namespace BP.WF.Template.CCEn { /// /// 节点到人员属性 /// public class CCEmpAttr { /// /// 节点 /// public const string FK_Node="FK_Node"; /// /// 到人员 /// public const string FK_Emp="FK_Emp"; } /// /// 节点到人员 /// 节点的到人员有两部分组成. /// 记录了从一个节点到其他的多个节点. /// 也记录了到这个节点的其他的节点. /// public class CCEmp :EntityMM { #region 基本属性 /// ///节点 /// public int FK_Node { get { return this.GetValIntByKey(CCEmpAttr.FK_Node); } set { this.SetValByKey(CCEmpAttr.FK_Node,value); } } /// /// 到人员 /// public string FK_Emp { get { return this.GetValStringByKey(CCEmpAttr.FK_Emp); } set { this.SetValByKey(CCEmpAttr.FK_Emp,value); } } public string FK_EmpT { get { return this.GetValRefTextByKey(CCEmpAttr.FK_Emp); } } #endregion #region 构造方法 /// /// 节点到人员 /// public CCEmp(){} /// /// 重写基类方法 /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("WF_CCEmp", "抄送人员"); map.IndexField = CCEmpAttr.FK_Node; map.AddTBIntPK(CCEmpAttr.FK_Node, 0, "节点", true, true); map.AddDDLEntitiesPK(CCEmpAttr.FK_Emp, null, "人员", new Emps(), true); this._enMap = map; return this._enMap; } } #endregion } /// /// 节点到人员 /// public class CCEmps : EntitiesMM { /// /// 他的到人员 /// public BP.Port.Emps HisEmps { get { BP.Port.Emps ens = new BP.Port.Emps(); foreach (CCEmp ns in this) { ens.AddEntity(new BP.Port.Emp(ns.FK_Emp)); } return ens; } } /// /// 他的工作节点 /// public Nodes HisNodes { get { Nodes ens = new Nodes(); foreach (CCEmp ns in this) { ens.AddEntity(new Node(ns.FK_Node)); } return ens; } } /// /// 节点到人员 /// public CCEmps() { } /// /// 节点到人员 /// /// 节点ID public CCEmps(int NodeID) { QueryObject qo = new QueryObject(this); qo.AddWhere(CCEmpAttr.FK_Node, NodeID); qo.DoQuery(); } /// /// 节点到人员 /// /// EmpNo public CCEmps(string EmpNo) { QueryObject qo = new QueryObject(this); qo.AddWhere(CCEmpAttr.FK_Emp, EmpNo); qo.DoQuery(); } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new CCEmp(); } } /// /// 取到一个到人员集合能够访问到的节点s /// /// 到人员集合 /// public Nodes GetHisNodes(Emps sts) { Nodes nds = new Nodes(); Nodes tmp = new Nodes(); foreach (Emp st in sts) { tmp = this.GetHisNodes(st.No); foreach (Node nd in tmp) { if (nds.Contains(nd)) continue; nds.AddEntity(nd); } } return nds; } /// /// 到人员对应的节点 /// /// 到人员编号 /// 节点s public Nodes GetHisNodes(string EmpNo) { QueryObject qo = new QueryObject(this); qo.AddWhere(CCEmpAttr.FK_Emp, EmpNo); qo.DoQuery(); Nodes ens = new Nodes(); foreach (CCEmp en in this) { ens.AddEntity(new Node(en.FK_Node)); } return ens; } /// /// 转向此节点的集合的 Nodes /// /// 此节点的ID /// 转向此节点的集合的Nodes (FromNodes) public Emps GetHisEmps(int nodeID) { QueryObject qo = new QueryObject(this); qo.AddWhere(CCEmpAttr.FK_Node, nodeID); qo.DoQuery(); Emps ens = new Emps(); foreach (CCEmp en in this) { ens.AddEntity(new Emp(en.FK_Emp)); } return ens; } #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((CCEmp)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }