using System; using BP.DA; using BP.En; using BP.Sys; namespace BP.CCFast.CCMenu { /// /// 模块 /// public class ModuleAttr : EntityTreeAttr { /// /// 系统编号 /// public const string SystemNo = "SystemNo"; /// /// 标记 /// public const string Remark = "Remark"; /// /// 组织编号 /// public const string OrgNo = "OrgNo"; /// /// Icon /// public const string Icon = "Icon"; /// /// 是否启用? /// public const string IsEnable = "IsEnable"; } /// /// 模块 /// public class Module : EntityNoName { #region 属性 /// /// 组织编号 /// public string OrgNo { get { return this.GetValStrByKey(ModuleAttr.OrgNo); } set { this.SetValByKey(ModuleAttr.OrgNo, value); } } /// /// 系统编号 /// public string SystemNo { get { return this.GetValStrByKey(ModuleAttr.SystemNo); } set { this.SetValByKey(ModuleAttr.SystemNo, value); } } public string Icon { get { return this.GetValStrByKey(ModuleAttr.Icon); } set { this.SetValByKey(ModuleAttr.Icon, value); } } public int Idx { get { return this.GetValIntByKey(ModuleAttr.Idx); } set { this.SetValByKey(ModuleAttr.Idx, value); } } public bool IsEnable { get { return this.GetValBooleanByKey(ModuleAttr.IsEnable); } set { this.SetValByKey(ModuleAttr.IsEnable, value); } } #endregion #region 按钮权限控制 public override UAC HisUAC { get { UAC uac = new UAC(); if (BP.Web.WebUser.IsAdmin == true) { uac.IsDelete = true; uac.IsUpdate = true; uac.IsInsert = false; return uac; } else { uac.Readonly(); } return uac; } } #endregion #region 构造方法 /// /// 模块 /// public Module() { } /// /// 模块 /// /// public Module(string no) { this.No = no; this.Retrieve(); } /// /// EnMap /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("GPM_Module", "模块"); map.setEnType(EnType.App); map.setIsAutoGenerNo( false); map.AddTBStringPK(ModuleAttr.No, null, "编号", true, true, 1, 200, 20); map.AddTBString(ModuleAttr.Name, null, "名称", true, false, 0, 300, 20); map.AddDDLEntities(ModuleAttr.SystemNo, null, "隶属系统", new MySystems(), true); map.AddTBString(MenuAttr.Icon, null, "Icon", true, false, 0, 500, 50, true); map.AddTBInt(ModuleAttr.Idx, 0, "顺序", true, false); map.AddTBInt(ModuleAttr.IsEnable, 1, "IsEnable", true, false); map.AddTBString(ModuleAttr.OrgNo, null, "组织编号", true, false, 0, 50, 20); map.AddTBInt("ChildDisplayModel", 0, "ChildDisplayModel", true, false); this._enMap = map; return this._enMap; } } #endregion #region 移动方法. /// /// 向上移动 /// public void DoUp() { this.DoOrderUp(ModuleAttr.SystemNo, this.SystemNo, ModuleAttr.Idx); } /// /// 向下移动 /// public void DoDown() { this.DoOrderDown(ModuleAttr.SystemNo, this.SystemNo, ModuleAttr.Idx); } #endregion 移动方法. /// /// 业务处理. /// /// protected override bool beforeInsert() { if (DataType.IsNullOrEmpty(this.No) == true) this.No = DBAccess.GenerGUID(); this.OrgNo = BP.Web.WebUser.OrgNo; return base.beforeInsert(); } protected override bool beforeDelete() { Menus ens = new Menus(); ens.Retrieve(MenuAttr.ModuleNo, this.No); if (ens.Count != 0) throw new Exception("err@该模块下有菜单,您不能删除。"); return base.beforeDelete(); } } /// /// 模块s /// public class Modules : EntitiesNoName { #region 构造 /// /// 模块s /// public Modules() { } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new Module(); } } public override int RetrieveAll() { if (BP.Difference.SystemConfig.CCBPMRunModel == CCBPMRunModel.Single) return base.RetrieveAll("Idx"); ////集团模式下的角色体系: @0=每套组织都有自己的角色体系@1=所有的组织共享一套岗则体系. //if (BP.Difference.SystemConfig.GroupStationModel == 1) // return base.RetrieveAll("Idx"); //按照orgNo查询. return this.Retrieve("OrgNo", BP.Web.WebUser.OrgNo, "Idx"); } #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((Module)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }