using System; using System.Collections; using BP.DA; using BP.En; using BP.Pub; namespace BP.Sys { /// /// 按钮事件类型 - 与sl 中设置的要相同。 /// public enum BtnEventType { /// /// 禁用 /// Disable = 0, /// /// 运行存储过程 /// RunSP = 1, /// /// 运行sql /// RunSQL = 2, /// /// 执行URL /// RunURL = 3, /// /// 运行webservices /// RunWS = 4, /// /// 运行Exe文件. /// RunExe = 5, /// /// 运行JS /// RunJS =6 } /// /// 按钮访问 /// public enum BtnUAC { /// /// 不处理 /// None, /// /// 按人员 /// ByEmp, /// /// 按角色 /// ByStation, /// /// 按部门 /// ByDept, /// /// 按sql /// BySQL } /// /// 按钮类型 /// public enum BtnType { /// /// 保存 /// Save=0, /// /// 打印 /// Print=1, /// /// 删除 /// Delete=2, /// /// 增加 /// Add=3, /// /// 自定义 /// Self=100 } /// /// 按钮 /// public class FrmBtnAttr : EntityMyPKAttr { /// /// Text /// public const string Lab = "Lab"; /// /// 主表 /// public const string FK_MapData = "FK_MapData"; /// /// X /// public const string X = "X"; /// /// Y /// public const string Y = "Y"; /// /// 宽度 /// public const string BtnType = "BtnType"; /// /// 颜色 /// public const string IsView = "IsView"; /// /// 风格 /// public const string IsEnable = "IsEnable"; /// /// 字体风格 /// public const string EventContext = "EventContext"; /// /// 字体 /// public const string UACContext = "UACContext"; /// /// 事件类型 /// public const string EventType = "EventType"; /// /// 控制类型 /// public const string UAC = "UAC"; /// /// MsgOK /// public const string MsgOK = "MsgOK"; /// /// MsgErr /// public const string MsgErr = "MsgErr"; /// /// 按钮ID /// public const string BtnID = "BtnID"; /// /// 分组 /// public const string GroupID = "GroupID"; } /// /// 按钮 /// public class FrmBtn : EntityMyPK { #region 属性 /// /// 所在的分组 /// public int GroupID { get { return this.GetValIntByKey(FrmBtnAttr.GroupID); } set { this.SetValByKey(FrmBtnAttr.GroupID, value); } } public string MsgOK { get { return this.GetValStringByKey(FrmBtnAttr.MsgOK); } set { this.SetValByKey(FrmBtnAttr.MsgOK, value); } } public string MsgErr { get { return this.GetValStringByKey(FrmBtnAttr.MsgErr); } set { this.SetValByKey(FrmBtnAttr.MsgErr, value); } } /// /// EventContext /// public string EventContext { get { return this.GetValStringByKey(FrmBtnAttr.EventContext).Replace("#", "@"); //return this.GetValStringByKey(FrmBtnAttr.EventContext); } set { this.SetValByKey(FrmBtnAttr.EventContext, value); } } public string UACContext { get { return this.GetValStringByKey(FrmBtnAttr.UACContext); } set { this.SetValByKey(FrmBtnAttr.UACContext, value); } } /// /// IsEnable /// public bool IsEnable { get { return this.GetValBooleanByKey(FrmBtnAttr.IsEnable); } set { this.SetValByKey(FrmBtnAttr.IsEnable, value); } } /// /// Y /// public float Y { get { return this.GetValFloatByKey(FrmBtnAttr.Y); } set { this.SetValByKey(FrmBtnAttr.Y, value); } } /// /// X /// public float X { get { return this.GetValFloatByKey(FrmBtnAttr.X); } set { this.SetValByKey(FrmBtnAttr.X, value); } } public BtnEventType HisBtnEventType { get { return (BtnEventType)this.GetValIntByKey(FrmBtnAttr.EventType); } } /// /// BtnType /// public int EventType { get { return this.GetValIntByKey(FrmBtnAttr.EventType); } set { this.SetValByKey(FrmBtnAttr.EventType, value); } } /// /// FK_MapData /// public string FK_MapData { get { return this.GetValStrByKey(FrmBtnAttr.FK_MapData); } set { this.SetValByKey(FrmBtnAttr.FK_MapData, value); } } /// /// Text /// public string Lab { get { return this.GetValStrByKey(FrmBtnAttr.Lab); } set { this.SetValByKey(FrmBtnAttr.Lab, value); } } public string TextHtml { get { //if (this.EventType) // return "" + this.GetValStrByKey(FrmBtnAttr.Text).Replace("@","
") + "
"; //else return this.GetValStrByKey(FrmBtnAttr.Lab).Replace("@", "
"); } } #endregion #region 构造方法 /// /// 按钮 /// public FrmBtn() { } /// /// 按钮 /// /// public FrmBtn(string mypk) { this.setMyPK(mypk); this.Retrieve(); } /// /// EnMap /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("Sys_FrmBtn", "按钮"); map.IndexField = FrmBtnAttr.FK_MapData; map.AddMyPK(); map.AddTBString(FrmBtnAttr.FK_MapData, null, "表单ID", true, false, 1, 100, 20); map.AddTBString(FrmBtnAttr.Lab, null, "标签", true, false, 0, 3900, 20); map.AddTBFloat(FrmBtnAttr.X, 5, "X", true, false); map.AddTBFloat(FrmBtnAttr.Y, 5, "Y", false, false); map.AddTBInt(FrmBtnAttr.IsView, 0, "是否可见", false, false); map.AddTBInt(FrmBtnAttr.IsEnable, 0, "是否起用", false, false); //map.AddTBInt(FrmBtnAttr.BtnType, 0, "类型", false, false); map.AddTBInt(FrmBtnAttr.UAC, 0, "控制类型", false, false); map.AddTBString(FrmBtnAttr.UACContext, null, "控制内容", true, false, 0, 3900, 20); map.AddTBInt(FrmBtnAttr.EventType, 0, "事件类型", false, false); map.AddTBString(FrmBtnAttr.EventContext, null, "事件内容", true, false, 0, 3900, 20); map.AddTBString(FrmBtnAttr.MsgOK, null, "运行成功提示", true, false, 0, 500, 20); map.AddTBString(FrmBtnAttr.MsgErr, null, "运行失败提示", true, false, 0, 500, 20); map.AddTBString(FrmBtnAttr.BtnID, null, "按钮ID", true, false, 0, 128, 20); map.AddTBInt(FrmBtnAttr.GroupID, 0, "所在分组", false, false); this._enMap = map; return this._enMap; } } #endregion } /// /// 按钮s /// public class FrmBtns : EntitiesMyPK { #region 构造 /// /// 按钮s /// public FrmBtns() { } /// /// 按钮s /// /// s public FrmBtns(string fk_mapdata) { this.Retrieve(FrmBtnAttr.FK_MapData, fk_mapdata); } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new FrmBtn(); } } #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((FrmBtn)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }