public string ActiveDDL_Init() { DataSet ds = new DataSet(); //加载外键字段. Paras ps = new Paras(); ps.SQL = "SELECT KeyOfEn AS No, Name FROM Sys_MapAttr WHERE UIContralType=1 AND FK_MapData=" + SystemConfig.AppCenterDBVarStr + "FK_MapData AND KeyOfEn!=" + SystemConfig.AppCenterDBVarStr + "KeyOfEn"; ps.Add("FK_MapData", this.FK_MapData); ps.Add("KeyOfEn", this.KeyOfEn); //var sql = "SELECT KeyOfEn AS No, Name FROM Sys_MapAttr WHERE UIContralType=1 AND FK_MapData='" + this.FK_MapData + "' AND KeyOfEn!='" + this.KeyOfEn + "'"; DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(ps); dt.TableName = "Sys_MapAttr"; dt.Columns[0].ColumnName = "No"; dt.Columns[1].ColumnName = "Name"; ds.Tables.Add(dt); if (dt.Rows.Count == 0) { return("err@表单中没有要级联的下拉框."); } //加载数据源. SFDBSrcs srcs = new SFDBSrcs(); srcs.RetrieveAll(); DataTable dtSrc = srcs.ToDataTableField(); dtSrc.TableName = "Sys_SFDBSrc"; ds.Tables.Add(dtSrc); // 加载mapext 数据. MapExt me = new MapExt(); int i = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.ActiveDDL, MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.AttrOfOper, this.KeyOfEn); if (i == 0) { me.FK_MapData = this.FK_MapData; me.AttrOfOper = this.KeyOfEn; me.FK_DBSrc = "local"; } if (me.FK_DBSrc == "") { me.FK_DBSrc = "local"; } //去掉 ' 号. me.SetValByKey("Doc", me.Doc); dt = me.ToDataTableField(); dt.TableName = "Sys_MapExt"; ds.Tables.Add(dt); return(BP.Tools.Json.ToJson(ds)); }
public string AutoFull_Init() { DataSet ds = new DataSet(); // 加载mapext 数据. MapExt me = new MapExt(); int i = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.AutoFull, MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.AttrOfOper, this.KeyOfEn); if (i == 0) { me.FK_MapData = this.FK_MapData; me.AttrOfOper = this.KeyOfEn; me.FK_DBSrc = "local"; } if (me.FK_DBSrc == "") { me.FK_DBSrc = "local"; } //去掉 ' 号. me.SetValByKey("Doc", me.Doc); DataTable dt = me.ToDataTableField(); dt.TableName = "Sys_MapExt"; ds.Tables.Add(dt); return(BP.Tools.Json.ToJson(ds)); }
public string AutoFullDtlField_Init() { DataSet ds = new DataSet(); // 加载mapext 数据. MapExt me = new MapExt(); int i = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.AutoFullDtlField, MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.AttrOfOper, this.KeyOfEn); if (i == 0) { me.FK_MapData = this.FK_MapData; me.AttrOfOper = this.KeyOfEn; me.FK_DBSrc = "local"; } if (me.FK_DBSrc == "") { me.FK_DBSrc = "local"; } //去掉 ' 号. me.SetValByKey("Doc", me.Doc); DataTable dt = me.ToDataTableField(); dt.TableName = "Sys_MapExt"; ds.Tables.Add(dt); //把从表放入里面. MapDtls dtls = new MapDtls(this.FK_MapData); ds.Tables.Add(dtls.ToDataTableField("Dtls")); //把从表的字段放入. foreach (MapDtl dtl in dtls) { string sql = "SELECT KeyOfEn as \"No\",Name as \"Name\" FROM Sys_MapAttr WHERE FK_MapData='" + dtl.No + "' AND (MyDataType=2 OR MyDataType=3 OR MyDataType=5 OR MyDataType=8) "; sql += " AND KeyOfEn !='OID' AND KeyOfEn!='FID' AND KeyOfEn!='RefPK' "; //把从表增加里面去. DataTable mydt = DBAccess.RunSQLReturnTable(sql); mydt.TableName = dtl.No; ds.Tables.Add(mydt); } //把主表的字段放入 string mainsql = "SELECT KeyOfEn as \"No\",Name as \"Name\" FROM Sys_MapAttr WHERE FK_MapData='" + this.FK_MapData + "' AND MyDataType=1 AND UIIsEnable = 0 "; mainsql += " AND KeyOfEn !='OID' AND KeyOfEn!='FID' AND KeyOfEn!='WorkID' AND KeyOfEn!='NodeID' AND KeyOfEn!='RefPK' AND KeyOfEn!='RDT' AND KeyOfEn!='Rec' "; //把从表增加里面去. DataTable maindt = DBAccess.RunSQLReturnTable(mainsql); maindt.TableName = "main_Attr"; ds.Tables.Add(maindt); return(BP.Tools.Json.ToJson(ds)); }
public string TBFullCtrl_Init() { DataSet ds = new DataSet(); //加载数据源. SFDBSrcs srcs = new SFDBSrcs(); srcs.RetrieveAll(); DataTable dtSrc = srcs.ToDataTableField(); dtSrc.TableName = "Sys_SFDBSrc"; ds.Tables.Add(dtSrc); // 加载 mapext 数据. MapExt me = new MapExt(); int i = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.TBFullCtrl, MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.AttrOfOper, this.KeyOfEn); if (i == 0) { me.FK_MapData = this.FK_MapData; me.AttrOfOper = this.KeyOfEn; me.FK_DBSrc = "local"; } //这个属性没有用. me.W = i; //用于标记该数据是否保存? 从而不现实填充从表,填充下拉框.按钮是否可以用. if (me.FK_DBSrc == "") { me.FK_DBSrc = "local"; } //去掉 ' 号. me.SetValByKey("Doc", me.Doc); DataTable dt = me.ToDataTableField(); dt.TableName = "Sys_MapExt"; ds.Tables.Add(dt); return(BP.Tools.Json.ToJson(ds)); }