using System;
using System.Data;
using BP.DA;
using BP.En;
using BP.Port;
namespace BP.Demo
{
///
/// 班级 属性
///
public class BanJiAttr: EntityNoNameAttr
{
///
/// 班主任
///
public const string BZR = "BZR";
///
/// 电话
///
public const string Tel = "Tel";
///
/// 位置
///
public const string WZ = "WZ";
}
///
/// 班级
///
public class BanJi :BP.En.EntityNoName
{
#region 基本属性
///
/// 班主任
///
public string BZR
{
get
{
return this.GetValStrByKey(BanJiAttr.BZR);
}
set
{
this.SetValByKey(BanJiAttr.BZR, value);
}
}
public string WZ
{
get
{
return this.GetValStrByKey(BanJiAttr.WZ);
}
set
{
this.SetValByKey(BanJiAttr.WZ, value);
}
}
#endregion
#region 构造函数
///
/// 实体的权限控制
///
public override UAC HisUAC
{
get
{
UAC uac = new UAC();
if (BP.Web.WebUser.No == "zhoupeng" || BP.Web.WebUser.No.Equals("admin")==true)
{
uac.IsDelete = true;
uac.IsUpdate = true;
uac.IsInsert = true;
}
else
{
uac.IsDelete = false;
uac.IsUpdate = false;
uac.IsInsert = false;
}
return uac;
}
}
///
/// 班级
///
public BanJi(){}
public BanJi(string no):base(no)
{
}
///
/// Map
///
public override Map EnMap
{
get
{
if (this._enMap!=null)
return this._enMap;
Map map = new Map("Demo_BanJi","班级");
#region 基本属性
map.DepositaryOfEntity=Depositary.None; //实体存放位置.
map.IsAllowRepeatName = true;
map.EnType=EnType.App;
map.CodeStruct="3"; //让其编号为3位, 从001 到 999 .
#endregion
#region 字段
map.AddTBStringPK(BanJiAttr.No, null, "编号", true, true, 3, 3, 50);
map.AddTBString(BanJiAttr.Name,null,"名称",true,false,0,50,200);
map.AddTBString(BanJiAttr.BZR, null, "班主任", true, false, 0, 50, 200);
map.AddTBString(BanJiAttr.Tel, null, "班主任电话", true, false, 0, 50, 200);
map.AddTBString(BanJiAttr.WZ, null, "位置", true, false, 0, 50, 200);
#endregion
this._enMap=map;
return this._enMap;
}
}
public override Entities GetNewEntities
{
get { return new BanJis(); }
}
#endregion
}
///
/// 班级s
///
public class BanJis : BP.En.EntitiesNoName
{
#region 重写
///
/// 得到它的 Entity
///
public override Entity GetNewEntity
{
get
{
return new BanJi();
}
}
#endregion
#region 构造方法
///
/// 班级s
///
public BanJis(){}
#endregion
}
}