using System; using System.Collections; using BP.DA; using BP.En; using BP.Sys.FrmUI; using BP.Difference; using BP.Web; namespace BP.Sys { /// /// 图片应用类型 /// public enum ImgAppType { /// /// 图片 /// Img, /// /// 图片公章 /// Seal, /// /// 北京安证通公章CA /// SealESA, /// /// 二维码 /// QRCode } /// /// 图片 /// public class FrmImgAttr : EntityMyPKAttr { /// /// Text /// public const string Text = "Text"; /// /// 主表 /// public const string FrmID = "FK_MapData"; /// /// URL /// public const string ImgURL = "ImgURL"; /// /// 文件路径 /// public const string ImgPath = "ImgPath"; /// /// LinkURL /// public const string LinkURL = "LinkURL"; /// /// LinkTarget /// public const string LinkTarget = "LinkTarget"; /// /// GUID /// public const string GUID = "GUID"; /// /// 应用类型 /// public const string ImgAppType = "ImgAppType"; /// /// 参数 /// public const string Tag0 = "Tag0"; /// /// 数据来源类型 0=本地 , 1=外部. /// public const string ImgSrcType = "ImgSrcType"; /// /// 是否可以编辑 /// public const string IsEdit = "IsEdit"; /// /// 中文名称 /// public const string Name = "Name"; /// /// 英文名称 /// public const string EnPK = "EnPK"; } /// /// 图片 /// public class FrmImg : EntityMyPK { #region 属性 /// /// 中文名称 /// public string Name { get { return this.GetValStringByKey(FrmImgAttr.Name); } set { this.SetValByKey(FrmImgAttr.Name, value); } } /// /// 对应字段名称 /// public string KeyOfEn { get { return this.GetValStringByKey(MapAttrAttr.KeyOfEn); } set { this.SetValByKey(MapAttrAttr.KeyOfEn, value); } } /// /// 英文名称 /// public string EnPK { get { return this.GetValStringByKey(FrmImgAttr.EnPK); } set { this.SetValByKey(FrmImgAttr.EnPK, value); } } /// /// 是否可以编辑 /// public int ItIsEdit { get { return this.GetValIntByKey(FrmImgAttr.IsEdit); } set { this.SetValByKey(FrmImgAttr.IsEdit, (int)value); } } /// /// 应用类型 /// public ImgAppType HisImgAppType { get { return (ImgAppType)this.GetValIntByKey(FrmImgAttr.ImgAppType); } set { this.SetValByKey(FrmImgAttr.ImgAppType, (int)value); } } /// /// 数据来源 /// public int ImgSrcType { get { return this.GetValIntByKey(FrmImgAttr.ImgSrcType); } set { this.SetValByKey(FrmImgAttr.ImgSrcType, value); } } public string Tag0 { get { return this.GetValStringByKey(FrmImgAttr.Tag0); } set { this.SetValByKey(FrmImgAttr.Tag0, value); } } public string LinkTarget { get { return this.GetValStringByKey(FrmImgAttr.LinkTarget); } set { this.SetValByKey(FrmImgAttr.LinkTarget, value); } } /// /// URL /// public string LinkURL { get { return this.GetValStringByKey(FrmImgAttr.LinkURL); } set { this.SetValByKey(FrmImgAttr.LinkURL, value); } } public string ImgPath { get { string src = this.GetValStringByKey(FrmImgAttr.ImgPath); if (DataType.IsNullOrEmpty(src)) { string appPath = HttpContextHelper.RequestApplicationPath; src = appPath + "DataUser/ICON/" + BP.Difference.SystemConfig.CustomerNo + "/LogBiger.png"; } return src; } set { this.SetValByKey(FrmImgAttr.ImgPath, value); } } public string ImgURL { get { string src = this.GetValStringByKey(FrmImgAttr.ImgURL); if (DataType.IsNullOrEmpty(src) || src.Contains("component/Img")) { string appPath = HttpContextHelper.RequestApplicationPath; src = appPath + "DataUser/ICON/" + BP.Difference.SystemConfig.CustomerNo + "/LogBiger.png"; } return src; } set { this.SetValByKey(FrmImgAttr.ImgURL, value); } } /// /// FK_MapData /// public string FrmID { get { return this.GetValStrByKey(FrmImgAttr.FrmID); } set { this.SetValByKey(FrmImgAttr.FrmID, value); } } public float UIWidth { get { return this.GetValFloatByKey(MapAttrAttr.UIWidth); } set { this.SetValByKey(MapAttrAttr.UIWidth, value); } } /// /// X /// public float UIHeight { get { return this.GetValFloatByKey(MapAttrAttr.UIHeight); } set { this.SetValByKey(MapAttrAttr.UIHeight, value); } } #endregion #region 构造方法 /// /// 图片 /// public FrmImg() { } /// /// 图片 /// /// public FrmImg(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_FrmImg", "图片"); map.IndexField = FrmImgAttr.FrmID; map.AddMyPK(); map.AddTBString(FrmImgAttr.FrmID, null, "FK_MapData", true, false, 1, 100, 20); map.AddTBString(MapAttrAttr.KeyOfEn, null, "对应字段", true, false, 1, 100, 20); map.AddTBInt(FrmImgAttr.ImgAppType, 0, "应用类型", false, false); //map.AddTBFloat(MapAttrAttr.X, 5, "X", true, false); //map.AddTBFloat(MapAttrAttr.Y, 5, "Y", false, false); map.AddTBFloat(MapAttrAttr.UIWidth, 200, "H", true, false); map.AddTBFloat(MapAttrAttr.UIHeight, 160, "H", true, false); map.AddTBString(FrmImgAttr.ImgURL, null, "ImgURL", true, false, 0, 200, 20); map.AddTBString(FrmImgAttr.ImgPath, null, "ImgPath", true, false, 0, 200, 20); map.AddTBString(FrmImgAttr.LinkURL, null, "LinkURL", true, false, 0, 200, 20); map.AddTBString(FrmImgAttr.LinkTarget, "_blank", "LinkTarget", true, false, 0, 200, 20); map.AddTBString(FrmImgAttr.GUID, null, "GUID", true, false, 0, 128, 20); //如果是 seal 就是角色集合。 map.AddTBString(FrmImgAttr.Tag0, null, "参数", true, false, 0, 500, 20); map.AddTBInt(FrmImgAttr.ImgSrcType, 0, "图片来源0=本地,1=URL", true, false); map.AddTBInt(FrmImgAttr.IsEdit, 0, "是否可以编辑", true, false); map.AddTBString(FrmImgAttr.Name, null, "中文名称", true, false, 0, 500, 20); map.AddTBString(FrmImgAttr.EnPK, null, "英文名称", true, false, 0, 500, 20); map.AddTBInt(MapAttrAttr.ColSpan, 0, "单元格数量", false, true); map.AddTBInt(MapAttrAttr.LabelColSpan, 1, "文本单元格数量", false, true); map.AddTBInt(MapAttrAttr.RowSpan, 1, "行数", false, true); //显示的分组. map.AddDDLSQL(MapAttrAttr.GroupID, 0, "显示的分组",MapAttrString.SQLOfGroupAttr, true); this._enMap = map; return this._enMap; } } #endregion protected override bool beforeInsert() { if(DataType.IsNullOrEmpty(this.KeyOfEn) == false) this.setMyPK(this.FrmID + "_" + this.KeyOfEn ); return base.beforeInsert(); } } /// /// 图片s /// public class FrmImgs : EntitiesMyPK { #region 构造 /// /// 图片s /// public FrmImgs() { } /// /// 图片s /// /// s public FrmImgs(string fk_mapdata) { this.Retrieve(MapAttrAttr.FK_MapData, fk_mapdata); } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new FrmImg(); } } #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((FrmImg)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }