using BP.DA; using BP.En; using BP.Sys; namespace BP.WF.Template.Frm { /// /// 表单属性 /// public class MapDataExt : EntityNoName { #region 权限控制. public override UAC HisUAC { get { UAC uac = new UAC(); if (BP.Web.WebUser.No.Equals("admin")==true) { uac.IsDelete = false; uac.IsUpdate = true; return uac; } uac.Readonly(); return uac; } } #endregion 权限控制. #region 自动计算属性. /// /// 左边界. /// public float MaxLeft { get { return this.GetParaFloat(MapDataAttr.MaxLeft); } set { this.SetPara(MapDataAttr.MaxLeft, value); } } /// /// 右边界 /// public float MaxRight { get { return this.GetParaFloat(MapDataAttr.MaxRight); } set { this.SetPara(MapDataAttr.MaxRight, value); } } /// /// 最高top /// public float MaxTop { get { return this.GetParaFloat(MapDataAttr.MaxTop); } set { this.SetPara(MapDataAttr.MaxTop, value); } } /// /// 最低 /// public float MaxEnd { get { return this.GetParaFloat(MapDataAttr.MaxEnd); } set { this.SetPara(MapDataAttr.MaxEnd, value); } } #endregion 自动计算属性. #region 报表属性(参数方式存储). /// /// 是否关键字查询 /// public bool ItIsSearchKey { get { return this.GetParaBoolen(MapDataAttr.IsSearchKey, true); } set { this.SetPara(MapDataAttr.IsSearchKey, value); } } /// /// 时间段查询方式 /// public DTSearchWay DTSearchWay { get { return (DTSearchWay)this.GetParaInt(MapDataAttr.DTSearchWay); } set { this.SetPara(MapDataAttr.DTSearchWay, (int)value); } } /// /// 时间字段 /// public string DTSearchKey { get { return this.GetParaString(MapDataAttr.DTSearchKey); } set { this.SetPara(MapDataAttr.DTSearchKey, value); } } /// /// 查询外键枚举字段 /// public string RptSearchKeys { get { return this.GetParaString(MapDataAttr.RptSearchKeys,"*"); } set { this.SetPara(MapDataAttr.RptSearchKeys, value); } } #endregion 报表属性(参数方式存储). #region 外键属性 public string Ver { get { return this.GetValStringByKey(MapDataAttr.Ver); } set { this.SetValByKey(MapDataAttr.Ver, value); } } /// /// 顺序号 /// public int Idx { get { return this.GetValIntByKey(MapDataAttr.Idx); } set { this.SetValByKey(MapDataAttr.Idx, value); } } #endregion #region 属性 /// /// 物理表 /// public string PTable { get { string s = this.GetValStrByKey(MapDataAttr.PTable); if (DataType.IsNullOrEmpty(s)== true) return this.No; return s; } set { this.SetValByKey(MapDataAttr.PTable, value); } } /// /// URL /// public string UrlExt { get { return this.GetValStrByKey(MapDataAttr.UrlExt); } set { this.SetValByKey(MapDataAttr.UrlExt, value); } } public DBUrlType HisDBUrl { get { return DBUrlType.AppCenterDSN; } } public AppType HisAppType { get { return (AppType)this.GetValIntByKey(MapDataAttr.AppType); } set { this.SetValByKey(MapDataAttr.AppType, (int)value); } } /// /// 备注 /// public string Note { get { return this.GetValStrByKey(MapDataAttr.Note); } set { this.SetValByKey(MapDataAttr.Note, value); } } /// /// 是否有CA. /// public bool ItIsHaveCA { get { return this.GetParaBoolen("IsHaveCA", false); } set { this.SetPara("IsHaveCA", value); } } /// /// 类别,可以为空. /// public string FK_FormTree { get { return this.GetValStrByKey(MapDataAttr.FK_FormTree); } set { this.SetValByKey(MapDataAttr.FK_FormTree, value); } } /// /// 从表集合. /// public string Dtls { get { return this.GetValStrByKey(MapDataAttr.Dtls); } set { this.SetValByKey(MapDataAttr.Dtls, value); } } /// /// 主键 /// public string EnPK { get { string s = this.GetValStrByKey(MapDataAttr.EnPK); if (DataType.IsNullOrEmpty(s)) return "OID"; return s; } set { this.SetValByKey(MapDataAttr.EnPK, value); } } private Entities _HisEns = null; public new Entities HisEns { get { if (_HisEns == null) { _HisEns = BP.En.ClassFactory.GetEns(this.No); } return _HisEns; } } public Entity HisEn { get { return this.HisEns.GetNewEntity; } } public float FrmW { get { return this.GetValFloatByKey(MapDataAttr.FrmW); } set { this.SetValByKey(MapDataAttr.FrmW, value); } } ///// ///// 表单控制方案 ///// //public string Slns //{ // get // { // return this.GetValStringByKey(MapDataAttr.Slns); // } // set // { // this.SetValByKey(MapDataAttr.Slns, value); // } //} /// /// 表格显示的列 /// public int TableCol { get { int i = this.GetValIntByKey(MapDataAttr.TableCol); if (i == 0 || i == 1) return 4; return i; } set { this.SetValByKey(MapDataAttr.TableCol, value); } } #endregion #region 构造方法 /// /// 表单属性 /// public MapDataExt() { } /// /// 表单属性 /// /// 映射编号 public MapDataExt(string no) : base(no) { } /// /// EnMap /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("Sys_MapData", "表单属性"); map.CodeStruct = "4"; #region 基本属性. map.AddGroupAttr("基本属性"); map.AddTBStringPK(MapDataAttr.No, null, "表单编号", true, false, 1, 190, 20); map.AddTBString(MapDataAttr.Name, null, "表单名称", true, false, 0, 500, 20); map.AddTBString(MapDataAttr.PTable, null, "存储表", true, false, 0, 500, 20); //表单的运行类型. map.AddDDLSysEnum(MapDataAttr.FrmType, (int)BP.Sys.FrmType.FoolForm, "表单类型",true, true, MapDataAttr.FrmType); map.AddTBString(MapDataAttr.UrlExt, null, "URL连接(对嵌入式表单有效)", true, false, 0, 500, 20, true); //数据源. map.AddDDLEntities(MapDataAttr.DBSrc, "local", "数据源", new BP.Sys.SFDBSrcs(), true); map.AddDDLEntities(MapDataAttr.FK_FormTree, "01", "表单类别", new SysFormTrees(), true); #endregion 基本属性. #region 设计者信息. map.AddGroupAttr("设计者信息"); map.AddTBString(MapDataAttr.Designer, null, "设计者", true, false, 0, 500, 20); map.AddTBString(MapDataAttr.DesignerContact, null, "联系方式", true, false, 0, 500, 20); map.AddTBString(MapDataAttr.DesignerUnit, null, "单位", true, false, 0, 500, 20,true); map.AddTBString(MapDataAttr.GUID, null, "GUID", true, true, 0, 128, 20,false); map.AddTBString(MapDataAttr.Ver, null, "版本号", true, true, 0, 30, 20); map.AddTBStringDoc(MapDataAttr.Note, null, "备注", true, false,true); //增加参数字段. map.AddTBAtParas(4000); map.AddTBInt(MapDataAttr.Idx, 100, "顺序号", false, false); #endregion 设计者信息. //查询条件. map.AddSearchAttr(MapDataAttr.DBSrc); //RefMethod rm = new RefMethod(); //rm.Title = "设计自由表单"; // "设计表单"; //rm.ClassMethodName = this.ToString() + ".DoDFrom"; //rm.Icon = ../../Img/Form.png"; //rm.Visable = true; //rm.Target = "_blank"; //map.AddRefMethod(rm); //rm = new RefMethod(); //rm.Title = "设计傻瓜表单"; // "设计表单"; //rm.ClassMethodName = this.ToString() + ".DoDFromCol4"; //rm.Icon = ../../Img/Form.png"; //rm.Visable = true; //rm.Target = "_blank"; //map.AddRefMethod(rm); #region 方法 - 基本功能. map.AddGroupMethod("基本功能"); RefMethod rm = new RefMethod(); rm.Title = "装载填充"; // "设计表单"; rm.ClassMethodName = this.ToString() + ".DoPageLoadFull"; rm.Icon = "../../WF/Img/FullData.png"; rm.Visable = true; rm.RefMethodType = RefMethodType.RightFrameOpen; rm.Target = "_blank"; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "表单事件"; // "设计表单"; rm.ClassMethodName = this.ToString() + ".DoEvent"; rm.Icon = "../../WF/Img/Event.png"; rm.Visable = true; rm.RefMethodType = RefMethodType.RightFrameOpen; rm.Target = "_blank"; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "批量设置验证规则"; rm.Icon = "../../WF/Img/Btn/DTS.gif"; rm.ClassMethodName = this.ToString() + ".DoRegularExpressionBatch"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "批量修改字段"; // "设计表单"; rm.ClassMethodName = this.ToString() + ".DoBatchEditAttr"; rm.Icon = "../../WF/Admin/CCBPMDesigner/Img/field.png"; rm.Visable = true; rm.RefMethodType = RefMethodType.RightFrameOpen; rm.Target = "_blank"; // map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "傻瓜表单设计器"; rm.ClassMethodName = this.ToString() + ".DoDesignerFool"; rm.Icon = "../../WF/Img/FileType/xlsx.gif"; rm.Visable = true; rm.Target = "_blank"; rm.RefMethodType = RefMethodType.LinkeWinOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "手机端表单"; rm.Icon = "../../WF/Img/Btn/DTS.gif"; rm.ClassMethodName = this.ToString() + ".MobileFrmDesigner"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "JS编程"; // "设计表单"; rm.ClassMethodName = this.ToString() + ".DoInitScript"; rm.Icon = "../../WF/Img/Script.png"; rm.Visable = true; rm.RefMethodType = RefMethodType.RightFrameOpen; rm.Target = "_blank"; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "表单body属性"; // "设计表单"; rm.ClassMethodName = this.ToString() + ".DoBodyAttr"; rm.Icon = "../../WF/Img/Script.png"; rm.Visable = true; rm.RefMethodType = RefMethodType.RightFrameOpen; rm.Target = "_blank"; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "导出XML表单模版"; // "设计表单"; rm.ClassMethodName = this.ToString() + ".DoExp"; rm.Icon = "../../WF/Img/Export.png"; rm.Visable = true; rm.RefAttrLinkLabel = "导出到xml"; rm.RefMethodType = RefMethodType.RightFrameOpen; rm.Target = "_blank"; map.AddRefMethod(rm); //带有参数的方法. rm = new RefMethod(); rm.Title = "重命名字段"; // rm.Warning = "您确定要处理吗?"; rm.HisAttrs.AddTBString("FieldOld", null, "旧字段英文名", true, false, 0, 100, 100); rm.HisAttrs.AddTBString("FieldNew", null, "新字段英文名", true, false, 0, 100, 100); rm.HisAttrs.AddTBString("FieldNewName", null, "新字段中文名", true, false, 0, 100, 100); rm.ClassMethodName = this.ToString() + ".DoChangeFieldName"; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "重命表单ID"; // rm.GroupName = "高级设置"; rm.HisAttrs.AddTBString("NewFrmID1", null, "新表单ID名称", true, false, 0, 100, 100); rm.HisAttrs.AddTBString("NewFrmID2", null, "确认表单ID名称", true, false, 0, 100, 100); rm.ClassMethodName = this.ToString() + ".DoChangeFrmID"; rm.Icon = "../../WF/Img/ReName.png"; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "检查表单"; rm.ClassMethodName = this.ToString() + ".DoCheckFrm"; rm.Icon = "../../WF/Img/check.png"; rm.Visable = true; rm.RefMethodType = RefMethodType.RightFrameOpen; rm.Target = "_blank"; map.AddRefMethod(rm); #endregion 方法 - 基本功能. #region 方法 - 开发接口. map.AddGroupMethod("开发接口"); rm = new RefMethod(); rm.Title = "调用查询API"; // "设计表单"; rm.ClassMethodName = this.ToString() + ".DoSearch"; rm.Icon = "../../WF/Img/Table.gif"; rm.Visable = true; rm.RefMethodType = RefMethodType.LinkeWinOpen; rm.Target = "_blank"; // rm.GroupName = "开发接口"; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "调用分析API"; // "设计表单"; rm.ClassMethodName = this.ToString() + ".DoGroup"; rm.Icon = "../../WF/Img/Table.gif"; rm.Visable = true; rm.RefMethodType = RefMethodType.LinkeWinOpen; rm.Target = "_blank"; // rm.GroupName = "开发接口"; map.AddRefMethod(rm); #endregion 方法 - 开发接口. //rm = new RefMethod(); //rm.Title = "Word表单属性"; // "设计表单"; //rm.ClassMethodName = this.ToString() + ".DoWordFrm"; //rm.Icon = ../../Img/Btn/Word.gif"; //rm.Visable = true; //rm.RefMethodType = RefMethodType.RightFrameOpen; //rm.Target = "_blank"; //rm.GroupName = "开发接口"; //map.AddRefMethod(rm); //rm = new RefMethod(); //rm.Title = "Excel表单属性"; // "设计表单"; //rm.ClassMethodName = this.ToString() + ".DoExcelFrm"; //rm.Icon = ../../Img/Btn/Excel.gif"; //rm.Visable = true; //rm.RefMethodType = RefMethodType.RightFrameOpen; //rm.Target = "_blank"; //rm.GroupName = "开发接口"; //map.AddRefMethod(rm); //rm = new RefMethod(); //rm.Title = "数据源管理"; // "设计表单"; //rm.ClassMethodName = this.ToString() + ".DoDBSrc"; //rm.Icon = "/WF/Img/DB.png"; //rm.RefMethodType = RefMethodType.RightFrameOpen; //rm.Visable = true; //rm.RefAttrLinkLabel = "数据源管理"; //rm.Target = "_blank"; //map.AddRefMethod(rm); this._enMap = map; return this._enMap; } } #endregion #region 基本方法. /// /// 傻瓜表单设计器 /// /// public string DoDesignerFool() { return "../../Admin/FoolFormDesigner/Designer.htm?FK_MapData=" + this.No + "&IsFirst=1&MyPK=" + this.No + "&IsEditMapData=True"; } #endregion #region 方法. /// /// 重命名 /// /// /// /// public string DoChangeFrmID(string frmID1, string frmID2) { MapData md = new MapData(); md.No = frmID1; if (md.IsExits == true) return "表单ID【" + frmID1 + "】已经存在"; if (frmID1 != frmID2) return "两次输入的ID不一致."; string frmIDOld = this.No; string sqls = ""; sqls += "@UPDATE Sys_MapData SET No='" + frmID1 + "' WHERE No='" + frmIDOld + "'"; // sqls += "UPDATE Sys_FrmLine SET FK_MapData='" + frmID1 + "' WHERE FK_MapData='" + frmIDOld + "'"; // sqls += "UPDATE Sys_FrmLab SET FK_MapData='" + frmID1 + "' WHERE FK_MapData='" + frmIDOld + "'"; sqls += "UPDATE Sys_FrmBtn SET FK_MapData='" + frmID1 + "' WHERE FK_MapData='" + frmIDOld + "'"; sqls += "UPDATE Sys_MapAttr SET FK_MapData='" + frmID1 + "' WHERE FK_MapData='" + frmIDOld + "'"; sqls += "UPDATE Sys_MapExt SET FK_MapData='" + frmID1 + "' WHERE FK_MapData='" + frmIDOld + "'"; sqls += "UPDATE Sys_FrmImg SET FK_MapData='" + frmID1 + "' WHERE FK_MapData='" + frmIDOld + "'"; sqls += "UPDATE Sys_FrmImgAth SET FK_MapData='" + frmID1 + "' WHERE FK_MapData='" + frmIDOld + "'"; sqls += "UPDATE Sys_FrmRB SET FK_MapData='" + frmID1 + "' WHERE FK_MapData='" + frmIDOld + "'"; sqls += "UPDATE Sys_MapDtl SET FK_MapData='" + frmID1 + "' WHERE FK_MapData='" + frmIDOld + "'"; sqls += "UPDATE Sys_MapFrame SET FK_MapData='" + frmID1 + "' WHERE FK_MapData='" + frmIDOld + "'"; sqls += "UPDATE Sys_FrmEle SET FK_MapData='" + frmID1 + "' WHERE FK_MapData='" + frmIDOld + "'"; sqls += "UPDATE Sys_FrmEvent SET FK_MapData='" + frmID1 + "' WHERE FK_MapData='" + frmIDOld + "'"; DBAccess.RunSQLs(sqls); return "重命名成功,你需要关闭窗口重新刷新。"; } /// /// 替换名称 /// /// 旧名称 /// 新字段 /// 新字段名称(可以为空) /// public string DoChangeFieldName(string fieldOld, string newField, string newFieldName) { MapAttr attrOld = new MapAttr(); attrOld.setKeyOfEn(fieldOld); attrOld.FrmID =this.No; attrOld.setMyPK(attrOld.FrmID + "_" + attrOld.KeyOfEn); if (attrOld.RetrieveFromDBSources() == 0) return "@旧字段输入错误[" + attrOld.KeyOfEn + "]."; //检查是否存在该字段? MapAttr attrNew = new MapAttr(); attrNew.setKeyOfEn(newField); attrNew.FrmID =this.No; attrNew.setMyPK(attrNew.FrmID + "_" + attrNew.KeyOfEn); if (attrNew.RetrieveFromDBSources() == 1) return "@该字段[" + attrNew.KeyOfEn + "]已经存在."; //删除旧数据. attrOld.Delete(); //copy这个数据,增加上它. attrNew.Copy(attrOld); attrNew.setKeyOfEn(newField); attrNew.FrmID =this.No; if (newFieldName != "") attrNew.Name = newFieldName; attrNew.Insert(); //更新处理他的相关业务逻辑. MapExts exts = new MapExts(this.No); foreach (MapExt item in exts) { item.setMyPK(item.MyPK.Replace("_" + fieldOld, "_" + newField)); if (item.AttrOfOper == fieldOld) item.AttrOfOper = newField; if (item.AttrsOfActive == fieldOld) item.AttrsOfActive = newField; item.Tag = item.Tag.Replace(fieldOld, newField); item.Tag1 = item.Tag1.Replace(fieldOld, newField); item.Tag2 = item.Tag2.Replace(fieldOld, newField); item.Tag3 = item.Tag3.Replace(fieldOld, newField); item.AtPara = item.AtPara.Replace(fieldOld, newField); item.Doc = item.Doc.Replace(fieldOld, newField); item.Save(); } return "执行成功"; } /// /// 检查表单 /// /// public string DoCheckFrm() { return "../../Admin/AttrNode/CheckFrm.htm?FK_MapData=" + this.No + "&t=" + BP.DA.DataType.CurrentDateTime; } /// /// 批量设置正则表达式规则. /// /// public string DoRegularExpressionBatch() { return "../../Admin/FoolFormDesigner/MapExt/RegularExpressionBatch.htm?FK_Flow=&FK_MapData=" + this.No + "&t=" + DataType.CurrentDateTime; } /// /// 排序字段顺序 /// /// public string MobileFrmDesigner() { return "../../Admin/MobileFrmDesigner/Default.htm?FK_Flow=&FK_MapData=" + this.No + "&t=" + DataType.CurrentDateTime; } /// /// 设计表单 /// /// public string DoDFrom() { return "../../Admin/FoolFormDesigner/CCForm/Frm.htm?FK_MapData=" + this.No + "&UserNo=" + BP.Web.WebUser.No + "&Token=" + Web.WebUser.Token + "&AppCenterDBType=" + DBAccess.AppCenterDBType + "&CustomerNo=" + BP.Difference.SystemConfig.CustomerNo; } /// /// 设计傻瓜表单 /// /// public string DoDFromCol4() { return "../../Admin/FoolFormDesigner/Designer.htm?FK_MapData=" + this.No + "&IsFirst=1&UserNo=" + BP.Web.WebUser.No + "&Token=" + Web.WebUser.Token + "&AppCenterDBType=" + DBAccess.AppCenterDBType + "&CustomerNo=" + BP.Difference.SystemConfig.CustomerNo; } /// /// 查询 /// /// public string DoSearch() { return "../../Comm/Search.htm?s=34&FK_MapData=" + this.No + "&EnsName=" + this.No; } /// /// 调用分析API /// /// public string DoGroup() { return "../../Comm/Group.htm?s=34&FK_MapData=" + this.No + "&EnsName=" + this.No; } /// /// 数据源管理 /// /// public string DoDBSrc() { return "../../Comm/Search.htm?s=34&FK_MapData=" + this.No + "&EnsName=BP.Sys.SFDBSrcs"; } public string DoPageLoadFull() { return "../../Admin/FoolFormDesigner/MapExt/PageLoadFull.htm?s=34&FK_MapData=" + this.No + "&ExtType=PageLoadFull&RefNo="; } public string DoInitScript() { return "../../Admin/FoolFormDesigner/MapExt/InitScript.htm?s=34&FK_MapData=" + this.No + "&ExtType=PageLoadFull&RefNo="; } /// /// 表单属性. /// /// public string DoBodyAttr() { return "../../Admin/FoolFormDesigner/MapExt/BodyAttr.htm?s=34&FK_MapData=" + this.No + "&ExtType=BodyAttr&RefNo="; } /// /// 表单事件 /// /// public string DoEvent() { return "../../Admin/CCFormDesigner/Action.htm?FK_MapData=" + this.No + "&T=sd&FK_Node=0"; } /// /// 导出表单 /// /// public string DoExp() { return "../../Admin/FoolFormDesigner/ImpExp/Exp.htm?FK_MapData=" + this.No; } #endregion 方法. } /// /// 表单属性s /// public class MapDataExts : EntitiesNoName { #region 构造 /// /// 表单属性s /// public MapDataExts() { } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new MapDataExt(); } } #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((MapDataExt)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }