using System; using System.Data; using BP.DA; using BP.En; namespace BP.Cloud { /// /// 部门角色人员对应 /// public class DeptEmpStationAttr { #region 基本属性 /// /// 部门 /// public const string FK_Dept="FK_Dept"; /// /// 角色 /// public const string FK_Station="FK_Station"; /// /// 人员 /// public const string FK_Emp = "FK_Emp"; /// /// 组织编号 /// public const string OrgNo = "OrgNo"; #endregion } /// /// 部门角色人员对应 的摘要说明。 /// public class DeptEmpStation : EntityMyPK { #region 基本属性 /// /// UI界面上的访问控制 /// public override UAC HisUAC { get { UAC uac = new UAC(); uac.OpenForSysAdmin(); return uac; } } /// /// 人员 /// public string FK_Emp { get { return this.GetValStringByKey(DeptEmpStationAttr.FK_Emp); } set { SetValByKey(DeptEmpStationAttr.FK_Emp, value); this.setMyPK(this.FK_Dept + "_" + this.FK_Emp+"_"+this.FK_Station); } } /// /// 部门 /// public string FK_Dept { get { return this.GetValStringByKey(DeptEmpStationAttr.FK_Dept); } set { SetValByKey(DeptEmpStationAttr.FK_Dept, value); this.setMyPK(this.FK_Dept + "_" + this.FK_Emp + "_" + this.FK_Station); } } public string FK_StationT { get { //return this.GetValRefTextByKey(DeptEmpStationAttr.FK_Station); return this.GetValStringByKey(DeptEmpStationAttr.FK_Station); } } /// ///角色 /// public string FK_Station { get { return this.GetValStringByKey(DeptEmpStationAttr.FK_Station); } set { SetValByKey(DeptEmpStationAttr.FK_Station, value); this.setMyPK(this.FK_Dept + "_" + this.FK_Emp + "_" + this.FK_Station); } } public string OrgNo { get { return this.GetValStringByKey(DeptEmpStationAttr.OrgNo); } set { SetValByKey(DeptEmpStationAttr.OrgNo, value); } } #endregion #region 构造函数 /// /// 工作部门角色人员对应 /// public DeptEmpStation() { } /// /// 重写基类方法 /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("Port_DeptEmpStation", "部门角色人员对应"); map.AddTBStringPK("MyPK", null, "主键MyPK", false, true, 1, 150, 10); map.AddTBString(DeptEmpStationAttr.FK_Dept, null, "部门", false, false, 1, 50, 1); map.AddTBString(DeptEmpStationAttr.FK_Station, null, "角色", false, false, 1, 50, 1); map.AddTBString(DeptEmpStationAttr.FK_Emp, null, "操作员", false, false, 1, 100, 1); map.AddTBString(DeptEmpStationAttr.OrgNo, null, "OrgNo", false, false, 0, 50, 1); this._enMap = map; return this._enMap; } } #endregion /// /// 更新删除前做的事情 /// /// protected override bool beforeUpdateInsertAction() { this.setMyPK(this.FK_Dept + "_" + this.FK_Emp + "_" + this.FK_Station); return base.beforeUpdateInsertAction(); } } /// /// 部门角色人员对应 /// public class DeptEmpStations : EntitiesMyPK { #region 构造 /// /// 工作部门角色人员对应 /// public DeptEmpStations() { } #endregion #region 方法 /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new DeptEmpStation(); } } #endregion 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((DeptEmpStation)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. #region 删除方法 public void DelteNotInEmp() { string sql = "DELETE FROM Port_DeptEmpStation WHERE FK_Emp NOT IN (SELECT No FROM Port_Emp)"; DBAccess.RunSQL(sql); } #endregion } }