using System; using System.Collections; using BP.DA; using BP.En; using BP.Sys; namespace BP.Sys.FrmUI { /// /// 图片附件 /// public class FrmImgAth : EntityMyPK { #region 属性 /// /// 名称 /// public string Name { get { return this.GetValStringByKey(FrmImgAthAttr.Name); } set { this.SetValByKey(FrmImgAthAttr.Name, value); } } /// /// 控件ID /// public string CtrlID { get { return this.GetValStringByKey(FrmImgAthAttr.CtrlID); } set { this.SetValByKey(FrmImgAthAttr.CtrlID, value); } } /// /// H /// public float H { get { return this.GetValFloatByKey(FrmImgAthAttr.H); } set { this.SetValByKey(FrmImgAthAttr.H, value); } } /// /// W /// public float W { get { return this.GetValFloatByKey(FrmImgAthAttr.W); } set { this.SetValByKey(FrmImgAthAttr.W, value); } } /// /// FK_MapData /// public string FK_MapData { get { return this.GetValStrByKey(FrmImgAthAttr.FK_MapData); } set { this.SetValByKey(FrmImgAthAttr.FK_MapData, value); } } /// /// 是否可编辑 /// public bool IsEdit { get { return this.GetValBooleanByKey(FrmImgAthAttr.IsEdit); } set { this.SetValByKey(FrmImgAthAttr.IsEdit, value); } } /// /// 是否必填,2016-11-1 /// public bool IsRequired { get { return this.GetValBooleanByKey(FrmImgAthAttr.IsRequired); } set { this.SetValByKey(FrmImgAthAttr.IsRequired, value); } } /// /// 所在的分组 /// public int GroupID { get { string str = this.GetValStringByKey(FrmImgAthAttr.GroupID); if (str == "无" || str == "") return 1; return int.Parse(str); } set { this.SetValByKey(FrmImgAthAttr.GroupID, value); } } #endregion #region 构造方法 /// /// public override UAC HisUAC { get { UAC uac = new UAC(); uac.IsInsert = false; uac.IsUpdate = true; uac.IsDelete = true; return uac; } } /// /// 图片附件 /// public FrmImgAth() { } /// /// 图片附件 /// /// public FrmImgAth(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_FrmImgAth", "图片附件"); map.IndexField = MapAttrAttr.FK_MapData; map.AddMyPK(); map.AddTBString(FrmImgAthAttr.FK_MapData, null, "表单ID", true, true, 1, 100, 20); map.AddTBString(FrmImgAthAttr.CtrlID, null, "控件ID", true, true, 0, 200, 20); map.AddTBString(FrmImgAthAttr.Name, null, "中文名称", true, false, 0, 200, 20); map.AddTBFloat(FrmImgAthAttr.H, 200, "H", true, false); map.AddTBFloat(FrmImgAthAttr.W, 160, "W", false, false); map.AddBoolean(FrmImgAthAttr.IsEdit, true, "是否可编辑", true, true); //map.AddTBInt(FrmImgAthAttr.IsEdit, 1, "是否可编辑", true, true); map.AddBoolean(FrmImgAthAttr.IsRequired, false, "是否必填项", true, true); //显示的分组. map.AddDDLSQL(FrmImgAthAttr.GroupID, 0, "显示的分组", MapAttrString.SQLOfGroupAttr, true); map.AddTBInt(MapAttrAttr.ColSpan, 0, "单元格数量", false, true); //跨单元格 map.AddDDLSysEnum(MapAttrAttr.LabelColSpan, 1, "文本单元格数量", true, true, "ColSpanAttrString", "@1=跨1个单元格@2=跨2个单元格@3=跨3个单元格@4=跨4个单元格"); //跨行 map.AddDDLSysEnum(MapAttrAttr.RowSpan, 1, "行数", true, true, "RowSpanAttrString", "@1=跨1个行@2=跨2行@3=跨3行"); //map.AddTBInt(FrmImgAthAttr.IsRequired, 0, "是否必填项", true, true); //map.AddTBString(FrmBtnAttr.GUID, null, "GUID", true, true, 0, 128, 20); this._enMap = map; return this._enMap; } } #endregion protected override bool beforeUpdateInsertAction() { //this.setMyPK(this.FK_MapData + "_" + this.CtrlID; return base.beforeUpdateInsertAction(); } protected override void afterInsertUpdateAction() { //在属性实体集合插入前,clear父实体的缓存. BP.Sys.Base.Glo.ClearMapDataAutoNum(this.FK_MapData); BP.Sys.FrmImgAth imgAth = new BP.Sys.FrmImgAth(); imgAth.setMyPK(this.MyPK); imgAth.RetrieveFromDBSources(); imgAth.Update(); //调用frmEditAction, 完成其他的操作. BP.Sys.CCFormAPI.AfterFrmEditAction(this.FK_MapData); MapAttr attr = new MapAttr(); attr.setMyPK(this.FK_MapData + "_" + imgAth.CtrlID); if (attr.RetrieveFromDBSources() == 0) { attr.setFK_MapData(this.FK_MapData); attr.Name = this.Name; attr.setKeyOfEn(imgAth.CtrlID); attr.setMyDataType(DataType.AppString); attr.setUIContralType(UIContralType.FrmImgAth); attr.GroupID = this.GroupID; attr.IsEnableInAPP = true; attr.setUIVisible(true); attr.DirectInsert(); } else { attr.GroupID = this.GroupID; attr.DirectUpdate(); } base.afterInsertUpdateAction(); } /// /// 删除后清缓存 /// protected override void afterDelete() { //把相关的字段也要删除. MapAttrString attr = new MapAttrString(); attr.setMyPK(this.MyPK); attr.setFK_MapData(this.FK_MapData); attr.Delete(); //调用frmEditAction, 完成其他的操作. BP.Sys.CCFormAPI.AfterFrmEditAction(this.FK_MapData); base.afterDelete(); } } /// /// 图片附件s /// public class FrmImgAths : EntitiesMyPK { #region 构造 /// /// 图片附件s /// public FrmImgAths() { } /// /// 图片附件s /// /// s public FrmImgAths(string fk_mapdata) { if (BP.Difference.SystemConfig.IsDebug) this.Retrieve(MapAttrAttr.FK_MapData, fk_mapdata); else this.RetrieveFromCash(MapAttrAttr.FK_MapData, (object)fk_mapdata); } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new FrmImgAth(); } } #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((FrmImgAth)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }