public static List <UcmlBusiCompPropSet> PrepareBC(SqlConnection conn, int bpoid) { List <UcmlBusiCompPropSet> bcList = new List <UcmlBusiCompPropSet>(); //构造sql StringBuilder sql = new StringBuilder("select b.BCName,b.ChineseName,a.RootTable,b.DataMember,a.AllowModifyJION,a.LinkKeyName,a.PK_COLUMN_NAME,c.fCustomKey,a.BusinessTableOID"); sql.Append(",a.fIsActor,a.BusiCompLinkOID,a.ParentOID,a.LinkKeyType,a.ReadMaxCount"); sql.Append(" from BusiCompLinkDataSet as a,BusinessTableDataSet as b ,UCMLClassDataSet as c "); sql.Append("where a.BusinessTableOID=b.BusinessTableOID and b.DataMember=c.ClassName and a.UCMLClassOID=" + bpoid); SqlCommand cmd = new SqlCommand(sql.ToString(), conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { UcmlBusiCompPropSet bc = new UcmlBusiCompPropSet(); bc.Name = Util.GetPropString(reader, 0); bc.Caption = Util.GetPropString(reader, 1); bc.IsRootBC = Util.GetPropBool(reader, 2); bc.TableName = Util.GetPropString(reader, 3); bc.fIDENTITYKey = false;//没找到该键在数据库的定义 bc.AllowModifyJION = Util.GetPropBool(reader, 4); bc.LinkKeyName = Util.GetPropString(reader, 5); bc.PK_COLUMN_NAME = Util.GetPropString(reader, 6); bc.fHaveUCMLKey = !Util.GetPropBool(reader, 7); bc.OID = Util.GetProperInt(reader, 8); bc.IsActor = Util.GetPropBool(reader, 9); bc.LinkOID = Util.GetProperInt(reader, 10); bc.LinkPOID = Util.GetProperInt(reader, 11); bc.LinkKeyType = Util.GetProperInt(reader, 12); bc.PageCount = Util.GetProperInt(reader, 13); if (bc.fHaveUCMLKey) { bc.PrimaryKey = bc.TableName + "OID"; } bcList.Add(bc); } reader.Close(); foreach (UcmlBusiCompPropSet bc in bcList) { //获取列信息 bc.Columns = PrepareBcColumn(conn, bc.OID); //获取子BC foreach (UcmlBusiCompPropSet subBc in bcList) { if (subBc.LinkPOID == bc.LinkOID) { bc.ChildBC.Add(subBc); } } } return(bcList); }
public static List<UcmlBusiCompPropSet> PrepareBC(SqlConnection conn, int bpoid) { List<UcmlBusiCompPropSet> bcList = new List<UcmlBusiCompPropSet>(); //构造sql StringBuilder sql = new StringBuilder("select b.BCName,b.ChineseName,a.RootTable,b.DataMember,a.AllowModifyJION,a.LinkKeyName,a.PK_COLUMN_NAME,c.fCustomKey,a.BusinessTableOID"); sql.Append(",a.fIsActor,a.BusiCompLinkOID,a.ParentOID,a.LinkKeyType,a.ReadMaxCount"); sql.Append(" from BusiCompLinkDataSet as a,BusinessTableDataSet as b ,UCMLClassDataSet as c "); sql.Append("where a.BusinessTableOID=b.BusinessTableOID and b.DataMember=c.ClassName and a.UCMLClassOID=" + bpoid); SqlCommand cmd = new SqlCommand(sql.ToString(), conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { UcmlBusiCompPropSet bc = new UcmlBusiCompPropSet(); bc.Name = Util.GetPropString(reader, 0); bc.Caption = Util.GetPropString(reader, 1); bc.IsRootBC = Util.GetPropBool(reader, 2); bc.TableName = Util.GetPropString(reader, 3); bc.fIDENTITYKey = false;//没找到该键在数据库的定义 bc.AllowModifyJION = Util.GetPropBool(reader, 4); bc.LinkKeyName = Util.GetPropString(reader, 5); bc.PK_COLUMN_NAME = Util.GetPropString(reader, 6); bc.fHaveUCMLKey = !Util.GetPropBool(reader, 7); bc.OID = Util.GetProperInt(reader, 8); bc.IsActor = Util.GetPropBool(reader, 9); bc.LinkOID=Util.GetProperInt(reader,10); bc.LinkPOID=Util.GetProperInt(reader,11); bc.LinkKeyType = Util.GetProperInt(reader, 12); bc.PageCount = Util.GetProperInt(reader, 13); if (bc.fHaveUCMLKey) bc.PrimaryKey = bc.TableName+"OID"; bcList.Add(bc); } reader.Close(); foreach (UcmlBusiCompPropSet bc in bcList) { //获取列信息 bc.Columns = PrepareBcColumn(conn, bc.OID); //获取子BC foreach (UcmlBusiCompPropSet subBc in bcList) { if (subBc.LinkPOID == bc.LinkOID) bc.ChildBC.Add(subBc); } } return bcList; }
public static UcmlBusiCompPropSet GetBC(SqlConnection conn, string bcOid, bool flag) { UcmlBusiCompPropSet bc = new UcmlBusiCompPropSet(); bc.OID = bcOid; StringBuilder sql = new StringBuilder("select a.BCName,a.ChineseName,a.DataMember,b.fCustomKey,"); sql.Append("a.OnCalculateEx,a.OnRecordChangeEx,a.OnBeforeInsertEx,a.OnAfterInsertEx,"); sql.Append("a.JSCIPTInit,a.JSCIPTBeforeUpdate,a.JSCIPTAfterApplyScript,b.fAutoGenKey "); sql.Append("from BusinessTableDataSet as a ,UCMLClassDataSet as b "); sql.Append("where a.DataMember=b.ClassName and a.BusinessTableDataSetOID='" + bcOid + "'"); SqlCommand cmd = new SqlCommand(sql.ToString(), conn); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { bc.Name = Util.GetPropString(reader, 0); bc.Caption = Util.GetPropString(reader, 1); bc.TableName = Util.GetPropString(reader, 2); bc.fHaveUCMLKey = !Util.GetPropBool(reader, 3); bc.OnCalculateScript = Util.GetPropString(reader, 4); bc.OnRecordChangeScript = Util.GetPropString(reader, 5); bc.OnBeforeInsertScript = Util.GetPropString(reader, 6); bc.OnAfterInsertScript = Util.GetPropString(reader, 7); bc.InitScript = Util.GetPropString(reader, 8); bc.BeforeUpdateScript = Util.GetPropString(reader, 9); bc.AfterUpdateScript = Util.GetPropString(reader, 10); bc.fIDENTITYKey = Util.GetPropBool(reader, 11); if (bc.fHaveUCMLKey) { bc.PrimaryKey = bc.TableName + "OID"; } } reader.Close(); bc.Columns = GetBcColumn(conn, bc.OID); return(bc); }
public static UcmlBusiCompPropSet GetBC(SqlConnection conn, string bcOid, bool flag) { UcmlBusiCompPropSet bc = new UcmlBusiCompPropSet(); bc.OID = bcOid; StringBuilder sql = new StringBuilder("select a.BCName,a.ChineseName,a.DataMember,b.fCustomKey,"); sql.Append("a.OnCalculateEx,a.OnRecordChangeEx,a.OnBeforeInsertEx,a.OnAfterInsertEx,"); sql.Append("a.JSCIPTInit,a.JSCIPTBeforeUpdate,a.JSCIPTAfterApplyScript,b.fAutoGenKey "); sql.Append("from BusinessTableDataSet as a ,UCMLClassDataSet as b "); sql.Append("where a.DataMember=b.ClassName and a.BusinessTableDataSetOID='" + bcOid+"'"); SqlCommand cmd = new SqlCommand(sql.ToString(), conn); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { bc.Name = Util.GetPropString(reader, 0); bc.Caption = Util.GetPropString(reader, 1); bc.TableName = Util.GetPropString(reader, 2); bc.fHaveUCMLKey = !Util.GetPropBool(reader, 3); bc.OnCalculateScript = Util.GetPropString(reader, 4); bc.OnRecordChangeScript = Util.GetPropString(reader, 5); bc.OnBeforeInsertScript = Util.GetPropString(reader, 6); bc.OnAfterInsertScript = Util.GetPropString(reader, 7); bc.InitScript = Util.GetPropString(reader, 8); bc.BeforeUpdateScript = Util.GetPropString(reader, 9); bc.AfterUpdateScript = Util.GetPropString(reader, 10); bc.fIDENTITYKey = Util.GetPropBool(reader, 11); if (bc.fHaveUCMLKey) bc.PrimaryKey = bc.TableName + "OID"; } reader.Close(); bc.Columns = GetBcColumn(conn, bc.OID); return bc; }
public static List<UcmlBusiCompPropSet> GetBC(SqlConnection conn, string bpoid) { List<UcmlBusiCompPropSet> bcList = new List<UcmlBusiCompPropSet>(); //构造sql StringBuilder sql = new StringBuilder("select "); sql.Append("b.BCName,b.ChineseName,a.RootTable,b.DataMember,a.AllowModifyJION,a.LinkKeyName,a.PK_COLUMN_NAME,c.fCustomKey,a.BusinessTableOID,"); sql.Append("a.fIsActor,a.BusiCompLinkDataSetOID,a.ParentOID,a.LinkKeyType,a.ReadMaxCount,"); sql.Append("b.OnCalculateEx,b.OnRecordChangeEx,b.OnBeforeInsertEx,b.OnAfterInsertEx,"); sql.Append("b.JSCIPTInit,b.JSCIPTBeforeUpdate,b.JSCIPTAfterApplyScript"); sql.Append(" from BusiCompLinkDataSet as a,BusinessTableDataSet as b ,UCMLClassDataSet as c "); sql.Append("where a.BusinessTableOID=b.BusinessTableDataSetOID and b.DataMember=c.ClassName and a.UCMLClassOID='" + bpoid+"'"); SqlCommand cmd = new SqlCommand(sql.ToString(), conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { UcmlBusiCompPropSet bc = new UcmlBusiCompPropSet(); bc.Name = Util.GetPropString(reader, 0); bc.Caption = Util.GetPropString(reader, 1); bc.IsRootBC = Util.GetPropBool(reader, 2); bc.TableName = Util.GetPropString(reader, 3); bc.fIDENTITYKey = false;//没找到该键在数据库的定义 bc.AllowModifyJION = Util.GetPropBool(reader, 4); bc.LinkKeyName = Util.GetPropString(reader, 5); bc.PK_COLUMN_NAME = Util.GetPropString(reader, 6); bc.fHaveUCMLKey = !Util.GetPropBool(reader, 7); bc.OID = Util.GetProperGuid(reader, 8); bc.IsActor = Util.GetPropBool(reader, 9); bc.LinkOID = Util.GetProperGuid(reader, 10); bc.LinkPOID = Util.GetProperGuid(reader, 11); bc.LinkKeyType = Util.GetProperInt(reader, 12); bc.PageCount = Util.GetProperInt(reader, 13); bc.OnCalculateScript = Util.GetPropString(reader, 14); bc.OnRecordChangeScript = Util.GetPropString(reader, 15); bc.OnBeforeInsertScript = Util.GetPropString(reader, 16); bc.OnAfterInsertScript = Util.GetPropString(reader, 17); bc.InitScript = Util.GetPropString(reader, 18); bc.BeforeUpdateScript = Util.GetPropString(reader, 19); bc.AfterUpdateScript = Util.GetPropString(reader, 20); if (bc.fHaveUCMLKey) bc.PrimaryKey = bc.TableName + "OID"; bcList.Add(bc); } reader.Close(); foreach (UcmlBusiCompPropSet bc in bcList) { //获取列信息 bc.Columns = GetBcColumn(conn, bc.OID); //获取where条件列信息 bc.CondiColumns = GetCondiColumn(conn, bc.OID); //通过BC列信息设置CondiColumn中的FieldType,Pos属性 foreach (BCCondiColumn condi in bc.CondiColumns) { for (int i = 0; i < bc.Columns.Count;i++ ) { if (condi.FieldName == bc.Columns[i].FieldName) { condi.FieldType = bc.Columns[i].FieldType; condi.Pos = i; } } } //获取子BC foreach (UcmlBusiCompPropSet subBc in bcList) { if (subBc.LinkPOID == bc.LinkOID) bc.ChildBC.Add(subBc); } } return bcList; }
public static List <UcmlBusiCompPropSet> GetBC(SqlConnection conn, string bpoid) { List <UcmlBusiCompPropSet> bcList = new List <UcmlBusiCompPropSet>(); //构造sql StringBuilder sql = new StringBuilder("select "); sql.Append("b.BCName,b.ChineseName,a.RootTable,b.DataMember,a.AllowModifyJION,a.LinkKeyName,a.PK_COLUMN_NAME,c.fCustomKey,a.BusinessTableOID,"); sql.Append("a.fIsActor,a.BusiCompLinkDataSetOID,a.ParentOID,a.LinkKeyType,a.ReadMaxCount,"); sql.Append("b.OnCalculateEx,b.OnRecordChangeEx,b.OnBeforeInsertEx,b.OnAfterInsertEx,"); sql.Append("b.JSCIPTInit,b.JSCIPTBeforeUpdate,b.JSCIPTAfterApplyScript"); sql.Append(" from BusiCompLinkDataSet as a,BusinessTableDataSet as b ,UCMLClassDataSet as c "); sql.Append("where a.BusinessTableOID=b.BusinessTableDataSetOID and b.DataMember=c.ClassName and a.UCMLClassOID='" + bpoid + "'"); SqlCommand cmd = new SqlCommand(sql.ToString(), conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { UcmlBusiCompPropSet bc = new UcmlBusiCompPropSet(); bc.Name = Util.GetPropString(reader, 0); bc.Caption = Util.GetPropString(reader, 1); bc.IsRootBC = Util.GetPropBool(reader, 2); bc.TableName = Util.GetPropString(reader, 3); bc.fIDENTITYKey = false;//没找到该键在数据库的定义 bc.AllowModifyJION = Util.GetPropBool(reader, 4); bc.LinkKeyName = Util.GetPropString(reader, 5); bc.PK_COLUMN_NAME = Util.GetPropString(reader, 6); bc.fHaveUCMLKey = !Util.GetPropBool(reader, 7); bc.OID = Util.GetProperGuid(reader, 8); bc.IsActor = Util.GetPropBool(reader, 9); bc.LinkOID = Util.GetProperGuid(reader, 10); bc.LinkPOID = Util.GetProperGuid(reader, 11); bc.LinkKeyType = Util.GetProperInt(reader, 12); bc.PageCount = Util.GetProperInt(reader, 13); bc.OnCalculateScript = Util.GetPropString(reader, 14); bc.OnRecordChangeScript = Util.GetPropString(reader, 15); bc.OnBeforeInsertScript = Util.GetPropString(reader, 16); bc.OnAfterInsertScript = Util.GetPropString(reader, 17); bc.InitScript = Util.GetPropString(reader, 18); bc.BeforeUpdateScript = Util.GetPropString(reader, 19); bc.AfterUpdateScript = Util.GetPropString(reader, 20); if (bc.fHaveUCMLKey) { bc.PrimaryKey = bc.TableName + "OID"; } bcList.Add(bc); } reader.Close(); foreach (UcmlBusiCompPropSet bc in bcList) { //获取列信息 bc.Columns = GetBcColumn(conn, bc.OID); //获取where条件列信息 bc.CondiColumns = GetCondiColumn(conn, bc.OID); //通过BC列信息设置CondiColumn中的FieldType,Pos属性 foreach (BCCondiColumn condi in bc.CondiColumns) { for (int i = 0; i < bc.Columns.Count; i++) { if (condi.FieldName == bc.Columns[i].FieldName) { condi.FieldType = bc.Columns[i].FieldType; condi.Pos = i; } } } //获取子BC foreach (UcmlBusiCompPropSet subBc in bcList) { if (subBc.LinkPOID == bc.LinkOID) { bc.ChildBC.Add(subBc); } } } return(bcList); }