using System; using System.Collections; using BP.DA; using BP.En; using BP.En; using BP.Port; //using BP.ZHZS.Base; namespace BP.WF.Template { /// /// 可撤销的节点属性 /// public class NodeCancelAttr { /// /// 节点 /// public const string FK_Node = "FK_Node"; /// /// 撤销到 /// public const string CancelTo = "CancelTo"; } /// /// 可撤销的节点 /// 节点的撤销到有两部分组成. /// 记录了从一个节点到其他的多个节点. /// 也记录了到这个节点的其他的节点. /// public class NodeCancel : EntityMM { #region 基本属性 /// ///撤销到 /// public int CancelTo { get { return this.GetValIntByKey(NodeCancelAttr.CancelTo); } set { this.SetValByKey(NodeCancelAttr.CancelTo, value); } } /// /// 工作流程 /// public int NodeID { get { return this.GetValIntByKey(NodeCancelAttr.FK_Node); } set { this.SetValByKey(NodeCancelAttr.FK_Node, value); } } #endregion #region 构造方法 /// /// 可撤销的节点 /// public NodeCancel() { } /// /// 重写基类方法 /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("WF_NodeCancel", "可撤销的节点"); map.IndexField = NodeEmpAttr.FK_Node; map.AddTBIntPK(NodeCancelAttr.FK_Node, 0, "节点", true, true); map.AddTBIntPK(NodeCancelAttr.CancelTo, 0, "撤销到", true, true); this._enMap = map; return this._enMap; } } #endregion } /// /// 可撤销的节点 /// public class NodeCancels : EntitiesMM { #region 构造与属性. /// /// 他的撤销到 /// public Nodes HisNodes { get { Nodes ens = new Nodes(); foreach (NodeCancel ns in this) { ens.AddEntity(new Node(ns.CancelTo)); } return ens; } } /// /// 可撤销的节点 /// public NodeCancels() { } /// /// 可撤销的节点 /// /// 节点ID public NodeCancels(int NodeID) { QueryObject qo = new QueryObject(this); qo.AddWhere(NodeCancelAttr.FK_Node, NodeID); qo.DoQuery(); } /// /// 可撤销的节点 /// /// NodeNo public NodeCancels(string NodeNo) { QueryObject qo = new QueryObject(this); qo.AddWhere(NodeCancelAttr.CancelTo, NodeNo); qo.DoQuery(); } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new NodeCancel(); } } #endregion 构造与属性. #region 公共方法. /// /// 可撤销的节点s /// /// 可撤销的节点 /// public Nodes GetHisNodes(Nodes sts) { Nodes nds = new Nodes(); Nodes tmp = new Nodes(); foreach (Node 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 NodeNo) { QueryObject qo = new QueryObject(this); qo.AddWhere(NodeCancelAttr.CancelTo, NodeNo); qo.DoQuery(); Nodes ens = new Nodes(); foreach (NodeCancel en in this) { ens.AddEntity(new Node(en.NodeID)); } return ens; } /// /// 转向此节点的集合的Nodes /// /// 此节点的ID /// 转向此节点的集合的Nodes (FromNodes) public Nodes GetHisNodes(int nodeID) { QueryObject qo = new QueryObject(this); qo.AddWhere(NodeCancelAttr.FK_Node, nodeID); qo.DoQuery(); Nodes ens = new Nodes(); foreach (NodeCancel en in this) { ens.AddEntity(new Node(en.CancelTo)); } return ens; } #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((NodeCancel)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }