using System;
using System.Collections;
using BP.DA;
using BP.En;
namespace BP.GPM
{
///
/// 人员信息块
///
public class BarEmpAttr : EntityNoNameAttr
{
///
/// 顺序
///
public const string Idx = "Idx";
///
/// 信息快
///
public const string FK_Bar = "FK_Bar";
///
/// 人员
///
public const string FK_Emp = "FK_Emp";
///
/// 是否显示?
///
public const string IsShow = "IsShow";
///
/// 标题?
///
public const string Title = "Title";
}
///
/// 人员信息块
///
public class BarEmp : EntityMyPK
{
#region 属性
public int Idx
{
get
{
return this.GetValIntByKey(BarEmpAttr.Idx);
}
set
{
this.SetValByKey(BarEmpAttr.Idx, value);
}
}
public string FK_Bar
{
get
{
return this.GetValStringByKey(BarEmpAttr.FK_Bar);
}
set
{
this.SetValByKey(BarEmpAttr.FK_Bar, value);
}
}
public string FK_Emp
{
get
{
return this.GetValStringByKey(BarEmpAttr.FK_Emp);
}
set
{
this.SetValByKey(BarEmpAttr.FK_Emp, value);
}
}
public bool IsShow
{
get
{
return this.GetValBooleanByKey(BarEmpAttr.IsShow);
}
set
{
this.SetValByKey(BarEmpAttr.IsShow, value);
}
}
public string Title
{
get
{
return this.GetValStringByKey(BarEmpAttr.Title);
}
set
{
this.SetValByKey(BarEmpAttr.Title, value);
}
}
#endregion
#region 构造方法
///
/// 人员信息块
///
public BarEmp()
{
}
///
/// EnMap
///
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("GPM_BarEmp", "人员信息块");
map.setEnType(EnType.Sys);
map.AddMyPK(); // 主键是由: FK_Bar+"_"+FK_Emp 组成的,它是一个复合主键.
map.AddTBString(BarEmpAttr.FK_Bar, null, "信息块编号", true, false, 0, 90, 20);
map.AddTBString(BarEmpAttr.FK_Emp, null, "人员编号", true, false, 0, 90, 20);
map.AddTBString(BarEmpAttr.Title, null, "标题", true, false, 0, 3900, 20);
map.AddTBInt(BarEmpAttr.IsShow, 1, "是否显示", false, true);
map.AddTBInt(BarEmpAttr.Idx, 0, "显示顺序", false, true);
this._enMap = map;
return this._enMap;
}
}
#endregion
#region 显示与隐藏.
public void DoUp()
{
this.DoOrderUp(BarEmpAttr.FK_Bar, this.FK_Bar, BarEmpAttr.Idx);
}
public void DoDown()
{
this.DoOrderDown(BarEmpAttr.FK_Bar, this.FK_Bar, BarEmpAttr.Idx);
}
public void DoHidShow()
{
this.IsShow = this.IsShow;
this.Update();
}
#endregion 显示与隐藏.
}
///
/// 人员信息块s
///
public class BarEmps : EntitiesMyPK
{
#region 构造
///
/// 人员信息块s
///
public BarEmps()
{
}
///
/// 得到它的 Entity
///
public override Entity GetNewEntity
{
get
{
return new BarEmp();
}
}
#endregion
public string InitMyBars()
{
Bars bars = new Bars();
bars.RetrieveAll();
foreach (Bar b in bars)
{
BarEmp be = new BarEmp();
be.setMyPK( b.No + "_" + BP.Web.WebUser.No);
if (be.RetrieveFromDBSources() == 1)
continue;
be.FK_Bar = b.No;
be.FK_Emp = BP.Web.WebUser.No;
be.IsShow = true;
be.Title = b.Name;
be.Insert();
}
return "执行成功";
}
#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((BarEmp)this[i]);
}
return list;
}
#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
}