using BP.DA;
using BP.En;
namespace BP.Demo
{
///
/// 注册用户 属性
///
public class BPUserAttr : EntityNoNameAttr
{
#region 基本属性
///
/// 密码
///
public const string Pass = "Pass";
///
/// 性别
///
public const string XB = "XB";
///
/// 地址
///
public const string Addr = "Addr";
///
/// 年月
///
public const string FK_NY = "FK_NY";
///
/// 年月
///
public const string Age = "Age";
///
/// 邮件
///
public const string Email = "Email";
///
/// 电话
///
public const string Tel = "Tel";
///
/// 注册时间
///
public const string RegDate = "RegDate";
#endregion
}
///
/// 注册用户
///
public class BPUser : EntityNoName
{
#region 属性
///
/// 密码
///
public string Pass
{
get
{
return this.GetValStringByKey(BPUserAttr.Pass);
}
set
{
this.SetValByKey(BPUserAttr.Pass, value);
}
}
///
/// 年龄
///
public int Age
{
get
{
return this.GetValIntByKey(BPUserAttr.Age);
}
set
{
this.SetValByKey(BPUserAttr.Age, value);
}
}
///
/// 性别
///
public int XB
{
get
{
return this.GetValIntByKey(BPUserAttr.XB);
}
set
{
this.SetValByKey(BPUserAttr.XB, value);
}
}
///
/// 性别名称
///
public string XBText
{
get
{
return this.GetValRefTextByKey(BPUserAttr.XB);
}
}
///
/// 地址
///
public string Addr
{
get
{
return this.GetValStringByKey(BPUserAttr.Addr);
}
set
{
this.SetValByKey(BPUserAttr.Addr, value);
}
}
///
/// 注册年月
///
public string FK_NY
{
get
{
return this.GetValStringByKey(BPUserAttr.FK_NY);
}
set
{
this.SetValByKey(BPUserAttr.FK_NY, value);
}
}
///
/// 邮件
///
public string Email
{
get
{
return this.GetValStringByKey(BPUserAttr.Email);
}
set
{
this.SetValByKey(BPUserAttr.Email, value);
}
}
///
/// 电话
///
public string Tel
{
get
{
return this.GetValStringByKey(BPUserAttr.Tel);
}
set
{
this.SetValByKey(BPUserAttr.Tel, value);
}
}
///
/// 注册日期
///
public string RegDate
{
get
{
return this.GetValStringByKey(BPUserAttr.RegDate);
}
set
{
this.SetValByKey(BPUserAttr.RegDate, value);
}
}
#endregion
#region 构造函数
///
/// 注册用户
///
public BPUser()
{
}
///
/// 重写基类方法
///
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("Demo_BPUser", "注册用户");
// 普通字段
map.AddTBStringPK(BPUserAttr.No, null, "用户名", true, false, 1, 100, 100);
map.AddTBString(BPUserAttr.Pass, null, "密码", true, false, 0, 200, 10);
map.AddTBString(BPUserAttr.Name, null, "名称", true, false, 0, 200, 10);
map.AddTBInt(BPUserAttr.Age, 0, "年龄", true, false);
map.AddTBString(BPUserAttr.Addr, null, "地址", true, false, 0, 200, 10);
map.AddTBString(BPUserAttr.Tel, null, "电话", true, false, 0, 200, 10);
map.AddTBString(BPUserAttr.Email, null, "邮件", true, false, 0, 200, 10);
map.AddTBDateTime(BPUserAttr.RegDate, null, "注册日期", true, true);
//枚举字段
map.AddDDLSysEnum(BPUserAttr.XB, 0,"性别", false, true, BPUserAttr.XB, "@0=女@1=男");
//外键字段.
// map.AddDDLEntities(BPUserAttr.FK_NY, null, "隶属年月", new BP.Pub.NYs(),true);
//设置查询条件。
map.AddSearchAttr(BPUserAttr.XB);
// map.AddSearchAttr(BPUserAttr.FK_NY);
this._enMap = map;
return this._enMap;
}
}
#endregion
///
/// 重写基类的方法.
///
///
protected override bool beforeInsert()
{
//在插入之前设置注册时间.
this.RegDate = DataType.CurrentDateTime;
return base.beforeInsert();
}
}
///
/// 注册用户s
///
public class BPUsers : EntitiesNoName
{
#region 方法
///
/// 得到它的 Entity
///
public override Entity GetNewEntity
{
get
{
return new BPUser();
}
}
///
/// 注册用户s
///
public BPUsers() { }
#endregion
}
}