using System; using System.Data; using System.Collections; using BP.DA; using BP.En; using BP.Sys; namespace BP.Cloud { /// /// 角色属性 /// public class StationAttr : EntityNoNameAttr { /// /// 角色类型 /// public const string FK_StationType = "FK_StationType"; /// /// OrgNo /// public const string OrgNo = "OrgNo"; } /// /// 角色 /// public class Station : EntityNoName { #region 实现基本的方法 public override UAC HisUAC { get { UAC uac = new UAC(); uac.OpenForSysAdmin(); return uac; } } /// /// Idx. /// public int Idx { get { return this.GetValIntByKey(EmpAttr.Idx); } set { this.SetValByKey(EmpAttr.Idx, value); } } /// /// 组织编号. /// public string OrgNo { get { return this.GetValStrByKey(EmpAttr.OrgNo); } set { this.SetValByKey(EmpAttr.OrgNo, value); } } /// /// 角色类型 /// public string FK_StationType { get { return this.GetValStrByKey(StationAttr.FK_StationType); } set { this.SetValByKey(StationAttr.FK_StationType, value); } } #endregion #region 构造方法 /// /// 角色 /// public Station() { } /// /// 角色 /// /// 角色编号 public Station(string no) { this.No = no.Trim(); if (this.No.Length == 0) throw new Exception("@要查询的角色编号为空。"); this.Retrieve(); } /// /// EnMap /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("Port_Station", "角色"); map.AddTBStringPK(EmpAttr.No, null, "编号", true, false, 1, 40, 4); map.AddTBString(EmpAttr.Name, null, "名称", true, false, 0, 100, 100); map.AddTBString(StationAttr.FK_StationType, null, "类型", true, false, 0, 100, 100); map.AddTBString(StationAttr.OrgNo, null, "隶属组织编号", true, true, 0, 100, 100); map.AddTBInt(EmpAttr.Idx, 0, "Idx", true, false); //增加隐藏查询条件. map.AddHidden(StationTypeAttr.OrgNo, "=", BP.Web.WebUser.OrgNo); this._enMap = map; return this._enMap; } } #endregion protected override bool beforeDelete() { DeptEmpStations ensD = new DeptEmpStations(); ensD.Retrieve(DeptEmpStationAttr.FK_Station, this.No); if (ensD.Count > 0) throw new Exception("err@删除角色错误,该角色下有人员。"); return base.beforeDelete(); } } /// /// 角色s /// public class Stations : EntitiesNoName { /// /// 角色 /// public Stations() { } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new Station(); } } public override int RetrieveAll() { return this.Retrieve(EmpAttr.OrgNo, BP.Web.WebUser.OrgNo); } #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((Station)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }