using System; using System.Data; using BP.DA; using BP.En; namespace BP.Port { /// /// 部门角色人员对应 /// 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 OrgNo { get { return this.GetValStringByKey(DeptEmpStationAttr.OrgNo); } set { SetValByKey(DeptEmpStationAttr.OrgNo, value); } } /// /// 人员 /// public string EmpNo { get { return this.GetValStringByKey(DeptEmpStationAttr.FK_Emp); } set { SetValByKey(DeptEmpStationAttr.FK_Emp, value); this.setMyPK(this.DeptNo + "_" + this.EmpNo + "_"+this.StationNo); } } /// /// 部门 /// public string DeptNo { get { return this.GetValStringByKey(DeptEmpStationAttr.FK_Dept); } set { SetValByKey(DeptEmpStationAttr.FK_Dept, value); this.setMyPK(this.DeptNo + "_" + this.EmpNo + "_" + this.StationNo); } } public string StationT { get { return this.GetValStringByKey(DeptEmpStationAttr.FK_Station); } } /// ///角色 /// public string StationNo { get { return this.GetValStringByKey(DeptEmpStationAttr.FK_Station); } set { SetValByKey(DeptEmpStationAttr.FK_Station, value); this.setMyPK(this.DeptNo + "_" + this.EmpNo + "_" + this.StationNo); } } #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, "部门", true, true, 1, 100, 1); map.AddTBString(DeptEmpStationAttr.FK_Station, null, "角色", true, true, 1, 50, 1); map.AddTBString(DeptEmpStationAttr.FK_Emp, null, "操作员", true, true, 1, 100, 1); map.AddTBString(DeptEmpAttr.OrgNo, null, "组织编码", true, true, 0, 50, 50); this._enMap = map; return this._enMap; } } #endregion /// /// 更新删除前做的事情 /// /// protected override bool beforeUpdateInsertAction() { //if(BP.Difference.SystemConfig.CCBPMRunModel == BP.Sys.CCBPMRunModel.SAAS) // this.setMyPK(this.DeptNo + "_" + this.EmpNo.Replace(this.OrgNo+"_","") + "_" + this.StationNo); //else this.setMyPK(this.DeptNo + "_" + this.EmpNo + "_" + this.StationNo); return base.beforeUpdateInsertAction(); } } /// /// 部门角色人员对应 /// public class DeptEmpStations : EntitiesMyPK { #region 构造 /// /// 工作部门角色人员对应 /// public DeptEmpStations() { } #endregion #region 方法 /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new DeptEmpStation(); } } #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((DeptEmpStation)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. #region 删除方法 public string DelteNotInEmp() { string sql = "DELETE FROM Port_DeptEmpStation WHERE FK_Emp NOT IN (SELECT No FROM Port_Emp)"; DBAccess.RunSQL(sql); return "删除成功"; } #endregion } }