using System;
using System.Data;
using BP.DA;
using BP.En;
namespace BP.Port
{
///
/// 部门人员信息
///
public class DeptEmpAttr
{
#region 基本属性
///
/// 部门
///
public const string FK_Dept = "FK_Dept";
///
/// 人员
///
public const string FK_Emp = "FK_Emp";
///
/// 组织编码
///
public const string OrgNo = "OrgNo";
#endregion
}
///
/// 部门人员信息 的摘要说明。
///
public class DeptEmp : EntityMyPK
{
#region 基本属性
///
/// UI界面上的访问控制
///
public override UAC HisUAC
{
get
{
UAC uac = new UAC();
uac.OpenForSysAdmin();
return uac;
}
}
///
/// 人员
///
public string FK_Emp
{
get
{
return this.GetValStringByKey(DeptEmpAttr.FK_Emp);
}
set
{
SetValByKey(DeptEmpAttr.FK_Emp, value);
this.setMyPK(this.FK_Dept + "_" + this.FK_Emp);
}
}
///
/// 部门
///
public string FK_Dept
{
get
{
return this.GetValStringByKey(DeptEmpAttr.FK_Dept);
}
set
{
SetValByKey(DeptEmpAttr.FK_Dept, value);
this.setMyPK(this.FK_Dept + "_" + this.FK_Emp);
}
}
public string OrgNo
{
get
{
return this.GetValStringByKey(DeptEmpAttr.OrgNo);
}
set
{
SetValByKey(DeptEmpAttr.OrgNo, value);
}
}
#endregion
#region 构造函数
///
/// 工作部门人员信息
///
public DeptEmp() { }
///
/// 重写基类方法
///
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("Port_DeptEmp", "部门人员信息");
map.IndexField = DeptEmpAttr.FK_Dept;
map.AddMyPK();
map.AddTBString(DeptEmpAttr.FK_Dept, null, "部门", false, false, 1, 50, 1);
map.AddDDLEntities(DeptEmpAttr.FK_Emp, null, "操作员", new BP.Port.Emps(), false);
map.AddTBString(DeptEmpAttr.OrgNo, null, "组织编码", false, false, 0, 50, 50);
//For Vue3版本.
map.AddTBString("DeptName", null, "部门名称(Vue3)", false, false, 0, 500, 36);
map.AddTBString("StationNo", null, "岗位编号(Vue3)", false, false, 0, 500, 36);
map.AddTBString("StationNoT", null, "岗位名称(Vue3)", false, false, 0, 500, 36);
this._enMap = map;
return this._enMap;
}
}
#endregion
protected override bool beforeDelete()
{
BP.Sys.Base.Glo.WriteUserLog("删除:" + this.ToJson(), "组织数据操作");
return base.beforeDelete();
}
protected override bool beforeInsert()
{
BP.Sys.Base.Glo.WriteUserLog("新建:" + this.ToJson(), "组织数据操作");
return base.beforeInsert();
}
///
/// 更新前做的事情
///
///
protected override bool beforeUpdateInsertAction()
{
if (BP.Difference.SystemConfig.CCBPMRunModel != Sys.CCBPMRunModel.Single && DataType.IsNullOrEmpty(this.OrgNo))
this.OrgNo = BP.Web.WebUser.OrgNo;
if (DataType.IsNullOrEmpty(this.MyPK) == true)
{
if (BP.Difference.SystemConfig.CCBPMRunModel == Sys.CCBPMRunModel.SAAS)
{
this.setMyPK(this.FK_Dept + "_" + this.FK_Emp.Replace(this.OrgNo+"_",""));
}
else
{
this.setMyPK(this.FK_Dept + "_" + this.FK_Emp);
}
}
return base.beforeUpdateInsertAction();
}
}
///
/// 部门人员信息
///
public class DeptEmps : EntitiesMyPK
{
#region 构造
///
/// 工作部门人员信息
///
public DeptEmps()
{
}
#endregion
#region 方法
///
/// 得到它的 Entity
///
public override Entity GetNewEntity
{
get
{
return new DeptEmp();
}
}
#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((DeptEmp)this[i]);
}
return list;
}
#endregion 为了适应自动翻译成java的需要,把实体转换成List.
#region 删除方法
public string DelteNotInEmp()
{
string sql = "DELETE FROM Port_DeptEmp WHERE FK_Emp NOT IN (SELECT No FROM Port_Emp)";
DBAccess.RunSQL(sql);
return "删除成功";
}
#endregion
}
}