using System;
using System.Data;
using BP.DA;
using BP.En;
using BP.Web;
namespace BP.GPM.AD
{
///
/// 部门属性
///
public class DeptAttr : EntityTreeAttr
{
///
/// 单位全名
///
public const string NameOfPath = "NameOfPath";
}
///
/// 部门
///
public class Dept : EntityTree
{
#region 属性
///
/// 全名
///
public string NameOfPath
{
get
{
return this.GetValStrByKey(DeptAttr.NameOfPath);
}
set
{
this.SetValByKey(DeptAttr.NameOfPath, value);
}
}
///
/// 父节点的ID
///
public new string ParentNo
{
get
{
return this.GetValStrByKey(DeptAttr.ParentNo);
}
set
{
this.SetValByKey(DeptAttr.ParentNo, value);
}
}
private Depts _HisSubDepts = null;
///
/// 它的子节点
///
public Depts HisSubDepts
{
get
{
if (_HisSubDepts == null)
_HisSubDepts = new Depts(this.No);
return _HisSubDepts;
}
}
#endregion
#region 构造函数
///
/// 部门
///
public Dept() { }
///
/// 部门
///
/// 编号
public Dept(string no) : base(no) { }
#endregion
#region 重写方法
public override UAC HisUAC
{
get
{
UAC uac = new UAC();
uac.OpenForSysAdmin();
return uac;
}
}
///
/// Map
///
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("Port_Dept", "部门");
map.AddTBStringPK(DeptAttr.No, null, "编号", true, true, 1, 50, 20);
//比如xx分公司财务部
map.AddTBString(DeptAttr.Name, null, "名称", true, false, 0, 100, 30);
//比如:\\驰骋集团\\南方分公司\\财务部
map.AddTBString(DeptAttr.NameOfPath, null, "部门路径", true, true, 0, 300, 30, true);
map.AddTBString(DeptAttr.ParentNo, null, "父节点编号", true, false, 0, 100, 30);
//顺序号.
map.AddTBInt(DeptAttr.Idx, 0, "顺序号", true, false);
this._enMap = map;
return this._enMap;
}
}
#endregion
}
///
///部门集合
///
public class Depts : EntitiesTree
{
///
/// 得到一个新实体
///
public override Entity GetNewEntity
{
get
{
return new Dept();
}
}
///
/// 部门集合
///
public Depts()
{
}
///
/// 部门集合
///
/// 父部门No
public Depts(string parentNo)
{
this.Retrieve(DeptAttr.ParentNo, parentNo);
}
public override int RetrieveAll()
{
QueryObject qo = new QueryObject(this);
qo.addOrderBy(GPM.DeptAttr.Idx);
return qo.DoQuery();
}
#region 为了适应自动翻译成java的需要,把实体转换成IList, c#代码调用会出错误。
///
/// 转化成 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((Dept)this[i]);
}
return list;
}
#endregion 为了适应自动翻译成java的需要,把实体转换成IList, c#代码调用会出错误。
}
}