using System; using System.Collections; using BP.En; namespace BP.En { /// /// 工作模式 /// public enum Dot2DotModel { /// /// 默认模式 /// Default, /// /// 树模式 /// TreeDept, /// /// 树叶子模式 /// TreeDeptEmp } /// /// SearchKey 的摘要说明。 /// 用来处理一条记录的存放,问题。 /// public class AttrOfOneVSM { #region 基本属性 /// /// 工作模式 /// public Dot2DotModel Dot2DotModel = Dot2DotModel.Default; /// /// 树 /// public EntitiesTree EnsTree = null; /// /// 默认的分组key. /// public string DefaultGroupAttrKey = null; /// /// 树的根节点 /// public string RootNo = null; /// /// 显示的扩展列 /// public string ExtShowCols = null; /// /// 关联的树字段 /// public string RefTreeAttr =null; /// /// 多对多的实体. /// private Entities _ensOfMM=null; public string GroupName = ""; /// /// 多对多的实体集合 /// public Entities EnsOfMM { get { return _ensOfMM; } set { _ensOfMM=value; } } /// /// 多对多的实体 /// private Entities _ensOfM=null; /// /// 多对多的实体集合 /// public Entities EnsOfM { get { return _ensOfM; } set { _ensOfM=value; } } /// /// M的实体属性在多对多的实体中 /// public string Desc=null; /// /// 一的实体属性在多对多的实体中. /// private string _AttrOfOneInMM=null; /// /// 一的实体属性在多对多的实体中 /// public string AttrOfOneInMM { get { return _AttrOfOneInMM; } set { _AttrOfOneInMM=value; } } /// /// M的实体属性在多对多的实体中 /// public string AttrOfMInMM = null; /// /// 标签 /// public string AttrOfMText = null; /// /// Value /// public string AttrOfMValue = null; #endregion #region 构造方法 /// /// AttrOfOneVSM /// public AttrOfOneVSM() { } /// /// AttrOfOneVSM /// /// /// /// /// /// /// public AttrOfOneVSM(Entities _ensOfMM, Entities _ensOfM, string AttrOfOneInMM, string AttrOfMInMM , string AttrOfMText, string AttrOfMValue, string desc) { this.EnsOfM=_ensOfM; this.EnsOfMM=_ensOfMM; this.AttrOfOneInMM=AttrOfOneInMM; this.AttrOfMInMM=AttrOfMInMM; this.AttrOfMText=AttrOfMText; this.AttrOfMValue=AttrOfMValue; this.Desc=desc; } #endregion } /// /// AttrsOfOneVSM 集合 /// public class AttrsOfOneVSM : System.Collections.CollectionBase { public string GroupName = ""; public AttrsOfOneVSM() { } public AttrOfOneVSM this[int index] { get { return (AttrOfOneVSM)this.InnerList[index]; } } /// /// 增加一个SearchKey . /// /// SearchKey public void Add(AttrOfOneVSM attr) { if (this.IsExits(attr)) return ; attr.GroupName = this.GroupName; this.InnerList.Add(attr); } /// /// 是不是存在集合里面 /// /// 要检查的EnDtl /// true/false public bool IsExits(AttrOfOneVSM en) { foreach (AttrOfOneVSM attr in this ) { if (attr.EnsOfMM == en.EnsOfMM ) { return true; } } return false; } /// /// 增加一个属性 /// /// 多对多的实体 /// 多实体 /// 点实体,在MM中的属性 /// 多实体主键在MM中的属性 /// /// /// 描述 public void Add(Entities _ensOfMM, Entities _ensOfM, string AttrOfOneInMM, string AttrOfMInMM , string AttrOfMText, string AttrOfMValue, string desc, Dot2DotModel model= Dot2DotModel.Default, EntitiesTree ensTree=null, string refTreeAttr=null) { //属性. AttrOfOneVSM en = new AttrOfOneVSM(_ensOfMM,_ensOfM,AttrOfOneInMM,AttrOfMInMM,AttrOfMText,AttrOfMValue,desc); //工作模式. en.Dot2DotModel = model; en.EnsTree = ensTree; en.RefTreeAttr = refTreeAttr; this.Add(en); } /// /// 绑定树模式 /// /// 比如 BP.WF.NodeDepts /// 比如: BP.Port.Depts /// 跟节点 /// 比如:FK_Node /// 比如:FK_Dept /// 比如:节点绑定部门 /// 一般是Name /// 一般是No /// 根目录节点 public void AddBranches(Entities _ensOfMM, Entities _ensOfM, string AttrOfOneInMM, string AttrOfMInMM, string desc, string AttrOfMText = "Name", string AttrOfMValue = "No", string rootNo = "0",string expShowCols=null) { //属性. AttrOfOneVSM en = new AttrOfOneVSM(_ensOfMM, _ensOfM, AttrOfOneInMM, AttrOfMInMM, AttrOfMText, AttrOfMValue, desc); //工作模式. en.Dot2DotModel = Dot2DotModel.TreeDept; //分组模式. en.RootNo = rootNo; //默认的根目录. en.ExtShowCols = expShowCols; //显示的列. this.Add(en); } /// /// 增加树杆叶子类型 /// /// /// /// /// /// /// /// /// /// 根目录编号 /// 显示的扩展列 , @FK_DeptName=部门名称@OrgName=组织名称 public void AddBranchesAndLeaf(Entities _ensOfMM, Entities _ensOfM, string AttrOfOneInMM, string AttrOfMInMM, string desc, string defaultGroupKey = null, string AttrOfMText = "Name", string AttrOfMValue = "No", string rootNo="0",string extShowCols=null) { //属性. AttrOfOneVSM en = new AttrOfOneVSM(_ensOfMM, _ensOfM, AttrOfOneInMM, AttrOfMInMM, AttrOfMText, AttrOfMValue, desc); //工作模式. en.Dot2DotModel = Dot2DotModel.TreeDeptEmp; //分组模式. //默认的分组字段,可以是一个类名或者枚举. en.DefaultGroupAttrKey = defaultGroupKey; en.RootNo = rootNo; //默认的根目录. en.ExtShowCols = extShowCols; //显示的扩展列 , @FK_DeptName=部门名称@OrgName=组织名称. this.Add(en); } /// /// 增加分组列表模式 /// /// /// /// /// /// /// /// /// /// public void AddGroupListModel(Entities _ensOfMM, Entities _ensOfM, string AttrOfOneInMM, string AttrOfMInMM, string desc, string defaultGroupKey = null, string AttrOfMText = "Name", string AttrOfMValue = "No") { //属性. AttrOfOneVSM en = new AttrOfOneVSM(_ensOfMM, _ensOfM, AttrOfOneInMM, AttrOfMInMM, AttrOfMText, AttrOfMValue, desc); //工作模式. en.Dot2DotModel = Dot2DotModel.TreeDeptEmp; //分组模式. //默认的分组字段,可以是一个类名或者枚举. en.DefaultGroupAttrKey = defaultGroupKey; en.RootNo = "0"; this.Add(en); } /// /// 绑定分组列表平铺模式 /// /// /// /// /// /// 标签或者描述 /// 显示的标签,一般为 Name /// 存储的值字段,一般为 No /// 默认的分组外键或者枚举,如果为空就不分组. public void AddGroupPanelModel(Entities _ensOfMM, Entities _ensOfM, string AttrOfOneInMM, string AttrOfMInMM, string desc, string defaultGroupKey = null, string AttrOfMText = "Name", string AttrOfMValue = "No") { //属性. AttrOfOneVSM en = new AttrOfOneVSM(_ensOfMM, _ensOfM, AttrOfOneInMM, AttrOfMInMM, AttrOfMText, AttrOfMValue, desc); //工作模式. en.Dot2DotModel = Dot2DotModel.Default; //分组模式. //默认的分组字段,可以是一个类名或者枚举. en.DefaultGroupAttrKey = defaultGroupKey; this.Add(en); } } }