using System; using BP.DA; using BP.En; using BP.Sys; namespace BP.CCFast.CCMenu { /// /// 权限中心 /// public class PowerCenterAttr : EntityTreeAttr { /// /// 控制对象 /// public const string CtrlObj = "CtrlObj"; /// /// 分组 /// public const string CtrlGroup = "CtrlGroup"; /// /// 控制模式 /// public const string CtrlModel = "CtrlModel"; /// /// IDs /// public const string IDs = "IDs"; /// /// 名称 /// public const string IDNames = "IDNames"; /// /// 控制对象Val /// public const string CtrlPKVal = "CtrlPKVal"; /// /// 编号 /// public const string OrgNo = "OrgNo"; public const string Idx = "Idx"; } /// /// 权限中心 /// public class PowerCenter : EntityMyPK { #region 属性 /// /// 控制主键 /// public string CtrlPKVal { get { return this.GetValStrByKey(PowerCenterAttr.CtrlPKVal); } } public string IDNames { get { return this.GetValStrByKey(PowerCenterAttr.IDNames); } } public string IDs { get { return this.GetValStrByKey(PowerCenterAttr.IDs); } } public string CtrlModel { get { return this.GetValStrByKey(PowerCenterAttr.CtrlModel); } } public string CtrlGroup { get { return this.GetValStrByKey(PowerCenterAttr.CtrlGroup); } } public string CtrlObj { get { return this.GetValStrByKey(PowerCenterAttr.CtrlObj); } } #endregion #region 按钮权限控制 public override UAC HisUAC { get { UAC uac = new UAC(); uac.OpenForAppAdmin(); return uac; } } #endregion #region 构造方法 /// /// 权限中心 /// public PowerCenter() { } /// /// 权限中心 /// /// public PowerCenter(string mypk) { this.setMyPK(mypk); this.Retrieve(); } /// /// EnMap /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("GPM_PowerCenter", "权限中心"); map.AddMyPK(); // System,Module,Menus map.AddTBString(PowerCenterAttr.CtrlObj, null, "控制对象(SystemMenus)", true, false, 0, 300, 20); map.AddTBString(PowerCenterAttr.CtrlPKVal, null, "控制对象ID", true, false, 0, 300, 20); //Menus, Frm map.AddTBString(PowerCenterAttr.CtrlGroup, null, "隶属分组(可为空)", true, false, 0, 300, 20); //AnyOne,Adminer,Depts map.AddTBString(PowerCenterAttr.CtrlModel, null, "控制模式", true, false, 0, 300, 20); map.AddTBStringDoc(PowerCenterAttr.IDs, null, "主键s(Stas,Depts等)", true, false); map.AddTBStringDoc(PowerCenterAttr.IDNames, null, "IDNames", true, false); map.AddTBString(PowerCenterAttr.OrgNo, null, "编号", true, false, 0, 100, 20); map.AddTBString(PowerCenterAttr.Idx, null, "Idx", true, false, 0, 100, 20); this._enMap = map; return this._enMap; } } #endregion protected override bool beforeUpdateInsertAction() { if (BP.Web.WebUser.IsAdmin == false) throw new Exception("err@非管理员不能操作..."); return base.beforeUpdateInsertAction(); } protected override bool beforeInsert() { this.setMyPK(DBAccess.GenerGUID()); return base.beforeInsert(); } } /// /// 权限中心s /// public class PowerCenters : EntitiesMyPK { public override int RetrieveAll() { if (BP.Difference.SystemConfig.CCBPMRunModel != CCBPMRunModel.SAAS) return base.RetrieveAll(); //集团模式下的角色体系: @0=每套组织都有自己的角色体系@1=所有的组织共享一套岗则体系. if (BP.Difference.SystemConfig.GroupStationModel == 1) return base.RetrieveAll(); //按照orgNo查询. return this.Retrieve("OrgNo", BP.Web.WebUser.OrgNo); } #region 构造 /// /// 权限中心s /// public PowerCenters() { } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new PowerCenter(); } } #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((PowerCenter)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }