using System; using BP.En; namespace BP.Demo { /// /// 客户属性 /// public class CustomerAttr : BP.En.EntityNoNameAttr { #region 基本属性 /// /// 部门 /// public const string FK_Dept = "FK_Dept"; public const string Addr = "Addr"; /// /// 密码 /// public const string Pass = "Pass"; /// /// Linker /// public const string Linker = "Linker"; /// /// 手机号码 /// public const string Tel = "Tel"; public const string KeHuMingCheng = "KeHuMingCheng"; public const string ShouHuoDiZhi = "ShouHuoDiZhi"; public const string ShouHuoRen = "ShouHuoRen"; public const string LianXiFangShi = "LianXiFangShi"; public const string Creater = "Creater"; public const string CreaterName = "CreaterName"; public const string CreatRDT = "CreatRDT"; #endregion public const string SiJiName = "SiJiName"; public const string SiJiTel = "SiJiTel"; public const string SiJiCPH = "SiJiCPH"; public const string NumOfPrj = "NumOfPrj"; public const string NumOfOK = "NumOfOK"; } /// /// Customer 的摘要说明。 /// public class Customer : EntityNoName { #region 属性. public string CreatRDT { get { return this.GetValStrByKey(CustomerAttr.CreatRDT); } set { this.SetValByKey(CustomerAttr.CreatRDT, value); } } public string CreaterName { get { return this.GetValStrByKey(CustomerAttr.CreaterName); } set { this.SetValByKey(CustomerAttr.CreaterName, value); } } public string Creater { get { return this.GetValStrByKey(CustomerAttr.Creater); } set { this.SetValByKey(CustomerAttr.Creater, value); } } public string FK_Dept { get { return this.GetValStrByKey(CustomerAttr.FK_Dept); } set { this.SetValByKey(CustomerAttr.FK_Dept, value); } } public string Addr { get { return this.GetValStrByKey(CustomerAttr.Addr); } set { this.SetValByKey(CustomerAttr.Addr, value); } } public string Tel { get { return this.GetValStrByKey(CustomerAttr.Tel); } set { this.SetValByKey(CustomerAttr.Tel, value); } } public string ShouHuoDiZhi { get { return this.GetValStrByKey(CustomerAttr.ShouHuoDiZhi); } set { this.SetValByKey(CustomerAttr.ShouHuoDiZhi, value); } } public string ShouHuoRen { get { return this.GetValStrByKey(CustomerAttr.ShouHuoRen); } set { this.SetValByKey(CustomerAttr.ShouHuoRen, value); } } public string LianXiFangShi { get { return this.GetValStrByKey(CustomerAttr.LianXiFangShi); } set { this.SetValByKey(CustomerAttr.LianXiFangShi, value); } } #endregion 属性. /// /// 客户 /// public Customer() { } /// /// 客户编号 /// /// No public Customer(string no) { this.No = no; this.Retrieve(); } /// /// UI界面上的访问控制 /// public override UAC HisUAC { get { UAC uac = new UAC(); uac.OpenForAppAdmin(); uac.IsUpdate = true; uac.IsDelete = true; uac.IsInsert = true; return uac; } } /// /// 重写基类方法 /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("Demo_Customer", "客户"); map.IsAutoGenerNo = true; map.CodeStruct = "4"; #region 字段 /*关于字段属性的增加 */ map.AddTBStringPK(CustomerAttr.No, null, "编号", true, true, 4, 4, 4); map.AddTBString(CustomerAttr.Name, null, "名称", true, false, 0, 100, 100); map.AddTBString(CustomerAttr.Linker, null, "联系人", true, false, 0, 100, 100); map.AddTBString(CustomerAttr.Tel, null, "联系电话", true, false, 0, 100, 100); map.AddTBString(CustomerAttr.Addr, null, "地址", false, false, 0, 200, 100, true); map.AddTBDate(CustomerAttr.CreatRDT, null, "创建日期", true, true); #endregion 字段 map.DTSearchKey = CustomerAttr.CreatRDT; map.DTSearchWay = Sys.DTSearchWay.ByDate; map.DTSearchLabel = "创建日期"; // map.AddSearchAttr(CustomerAttr.FK_Dept); //查询条件. this._enMap = map; return this._enMap; } } public override Entities GetNewEntities { get { return new Customers(); } } } /// /// 客户s /// public class Customers : EntitiesNoName { /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new Customer(); } } /// /// 客户s /// public Customers() { } #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((Customer)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }