using System; using System.Collections; using BP.DA; using BP.En; namespace BP.Sys { /// /// 全局变量 /// public class GloVarExt : EntityNoName { #region 属性 public object ValOfObject { get { return this.GetValByKey(GloVarAttr.Val); } set { this.SetValByKey(GloVarAttr.Val, value); } } public string Val { get { return this.GetValStringByKey(GloVarAttr.Val); } set { this.SetValByKey(GloVarAttr.Val, value); } } public float ValOfFloat { get { try { return this.GetValFloatByKey(GloVarAttr.Val); } catch { return 0; throw new Exception("@" + this.Name + ", 没有设置默认值." + this.Val); } } set { this.SetValByKey(GloVarAttr.Val, value); } } public int ValOfInt { get { try { return this.GetValIntByKey(GloVarAttr.Val); } catch(Exception ex) { return 0; throw new Exception("@" + this.Name + ", 没有设置默认值." + this.Val); } } set { this.SetValByKey(GloVarAttr.Val, value); } } public decimal ValOfDecimal { get { try { return this.GetValDecimalByKey(GloVarAttr.Val); } catch { return 0; throw new Exception("@" + this.Name + ", 没有设置默认值."+ this.Val); } } set { this.SetValByKey(GloVarAttr.Val, value); } } public bool ValOfBoolen { get { return this.GetValBooleanByKey(GloVarAttr.Val); } set { this.SetValByKey(GloVarAttr.Val, value); } } /// /// note /// public string Note { get { return this.GetValStringByKey(GloVarAttr.Note); } set { this.SetValByKey(GloVarAttr.Note, value); } } /// /// 分组值 /// public string GroupKey { get { return this.GetValStringByKey(GloVarAttr.GroupKey); } set { this.SetValByKey(GloVarAttr.GroupKey, value); } } #endregion #region 构造方法 /// /// 全局变量 /// public GloVarExt() { } /// /// 全局变量 /// /// public GloVarExt(string no) { this.No = no; this.Retrieve(); } /// /// 全局变量s /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("Sys_GloVar", "全局变量"); map.AddTBStringPK(GloVarAttr.No, null, "键", true, false, 1, 50, 20); map.AddTBString(GloVarAttr.Name, null, "名称", true, false, 0, 120, 20); map.AddTBString(GloVarAttr.Val, null, "值/表达式", true, false, 0, 2000, 20,true); map.AddTBString(GloVarAttr.GroupKey, null, "分组值", false, false, 0, 120, 20, false); map.AddTBStringDoc(GloVarAttr.Note, null, "备注", true, false,true); map.AddTBInt(GloVarAttr.Idx, 0, "顺序号", true, true); this._enMap = map; return this._enMap; } } #endregion } /// /// 全局变量s /// public class GloVarExts : EntitiesNoName { #region 构造 /// /// 全局变量s /// public GloVarExts() { } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new GloVarExt(); } } #endregion #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((GloVarExt)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }