using System;
using System.Collections;
using BP.DA;
using BP.En;
using BP.Sys;
using BP.Difference;
namespace BP.Port
{
///
/// 角色类型
///
public class StationTypeAttr : EntityNoNameAttr
{
///
/// 排序字段
///
public const string Idx = "Idx";
///
/// 组织机构编号
///
public const string OrgNo = "OrgNo";
}
///
/// 角色类型
///
public class StationType : EntityNoName
{
#region 属性
///
/// 组织编码
///
public string OrgNo
{
get
{
return this.GetValStrByKey(StationAttr.OrgNo);
}
set
{
this.SetValByKey(StationAttr.OrgNo, value);
}
}
public string FK_StationType
{
get
{
return this.GetValStrByKey(StationAttr.FK_StationType);
}
set
{
this.SetValByKey(StationAttr.FK_StationType, value);
}
}
public string FK_StationTypeText
{
get
{
return this.GetValRefTextByKey(StationAttr.FK_StationType);
}
}
#endregion
#region 实现基本的方方法
public override UAC HisUAC
{
get
{
UAC uac = new UAC();
uac.OpenForSysAdmin();
return uac;
}
}
#endregion
#region 构造方法
///
/// 角色类型
///
public StationType()
{
}
///
/// 角色类型
///
///
public StationType(string _No) : base(_No) { }
#endregion
///
/// 角色类型Map
///
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("Port_StationType", "角色类型");
map.CodeStruct = "2";
map.AddTBStringPK(StationTypeAttr.No, null, "编号", true, true, 1, 40, 40);
map.AddTBString(StationTypeAttr.Name, null, "名称", true, false, 1, 50, 20);
map.AddTBInt(StationTypeAttr.Idx, 0, "顺序", true, false);
if (BP.Difference.SystemConfig.CCBPMRunModel == CCBPMRunModel.SAAS)
{
map.AddTBString(StationAttr.OrgNo, null, "隶属组织", false, false, 0, 50, 250);
map.AddHidden(StationAttr.OrgNo, "=", "@WebUser.OrgNo"); //加隐藏条件.
}
if (BP.Difference.SystemConfig.CCBPMRunModel == CCBPMRunModel.GroupInc)
{
map.AddTBString(StationAttr.OrgNo, null, "隶属组织", true, true, 0, 50, 250);
if (BP.Difference.SystemConfig.GroupStationModel == 0)
map.AddHidden(StationAttr.OrgNo, "=", "@WebUser.OrgNo");//每个组织都有自己的岗责体系的时候. 加隐藏条件.
if(BP.Difference.SystemConfig.GroupStationModel == 2)
{
map.AddTBString(StationAttr.FK_Dept, null, "隶属部门", false, false, 0, 50, 250);
map.AddHidden(StationAttr.FK_Dept, "=", "@WebUser.FK_Dept");
}
}
this._enMap = map;
return this._enMap;
}
}
protected override bool beforeUpdateInsertAction()
{
if (DataType.IsNullOrEmpty(this.Name) == true)
throw new Exception("请输入名称");
if (BP.Difference.SystemConfig.CCBPMRunModel != CCBPMRunModel.Single)
this.OrgNo = BP.Web.WebUser.OrgNo;
if (BP.Difference.SystemConfig.GroupStationModel == 2)
this.SetValByKey(StationAttr.FK_Dept, BP.Web.WebUser.FK_Dept);
return base.beforeUpdateInsertAction();
}
}
///
/// 角色类型
///
public class StationTypes : EntitiesNoName
{
#region 构造方法..
///
/// 角色类型s
///
public StationTypes() { }
///
/// 得到它的 Entity
///
public override Entity GetNewEntity
{
get
{
return new StationType();
}
}
#endregion 构造方法..
#region 查询..
///
/// 查询全部
///
/// 排序
///
public override int RetrieveAll(string orderBy)
{
if (BP.Difference.SystemConfig.CCBPMRunModel == CCBPMRunModel.Single)
return base.RetrieveAll(orderBy);
//集团模式下的角色体系: @0=每套组织都有自己的角色体系@1=所有的组织共享一套岗则体系.
if (BP.Difference.SystemConfig.GroupStationModel == 0)
return base.Retrieve("OrgNo", BP.Web.WebUser.OrgNo, orderBy);
if (BP.Difference.SystemConfig.GroupStationModel == 1)
return base.RetrieveAll();
//if (BP.Difference.SystemConfig.GroupStationModel == 2)
// return base.Retrieve("FK_Dept", BP.Web.WebUser.FK_Dept, orderBy);
//按照orgNo查询.
return this.Retrieve("OrgNo", BP.Web.WebUser.OrgNo, orderBy);
}
///
/// 查询全部
///
///
public override int RetrieveAll()
{
if (BP.Difference.SystemConfig.CCBPMRunModel == CCBPMRunModel.Single)
return base.RetrieveAll("Idx");
//集团模式下的角色体系: @0=每套组织都有自己的角色体系@1=所有的组织共享一套岗则体系.
if (BP.Difference.SystemConfig.GroupStationModel == 1)
return base.RetrieveAll("Idx");
//按照orgNo查询.
return this.Retrieve("OrgNo", BP.Web.WebUser.OrgNo,"Idx");
}
#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((StationType)this[i]);
}
return list;
}
#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
}