public CableInfo(Database.DbElement aCable) { //if given cable is valid in db: if (aCable.IsValid) { //get name of given cable mCableName = aCable.GetAsString(Database.DbAttributeInstance.NAMN); //get cable component name if (aCable.IsAttributeValid(Database.DbAttributeInstance.SPRE)) { Database.DbElement _spref = aCable.GetElement(Database.DbAttributeInstance.SPRE); if (_spref.IsValid) { mComponentName = _spref.GetAsString(Database.DbAttributeInstance.NAMN); } } Database.DbElement _staref = aCable.GetElement(Database.DbAttributeInstance.STAREF); if (_staref.IsValid) { if (_staref.GetElementType() == Database.DbElementTypeInstance.SCELCONNECTION) { mStartElconn = MiscUtilities.GetElemPresName(_staref); mStartEqui = MiscUtilities.GetElemPresName(_staref.Owner); } else { mStartEqui = MiscUtilities.GetElemPresName(_staref); } } Database.DbElement _endref = aCable.GetElement(Database.DbAttributeInstance.ENDREF); if (_endref.IsValid) { if (_endref.GetElementType() == Database.DbElementTypeInstance.SCELCONNECTION) { mEndElconn = MiscUtilities.GetElemPresName(_endref); mEndEqui = MiscUtilities.GetElemPresName(_endref.Owner); } else { mEndEqui = MiscUtilities.GetElemPresName(_endref); } } Database.DbElement [] _cores = aCable.Members(Database.DbElementTypeInstance.SCCORE); //get informaton about cores foreach (Database.DbElement _core in _cores) { CoreInfo _coreInf = new CoreInfo(_core, this); mCores.Add(_coreInf); } } }
public CableInfo( Database.DbElement aCable ) { //if given cable is valid in db: if( aCable.IsValid ) { //get name of given cable mCableName = aCable.GetAsString( Database.DbAttributeInstance.NAMN ); //get cable component name if( aCable.IsAttributeValid( Database.DbAttributeInstance.SPRE ) ) { Database.DbElement _spref = aCable.GetElement( Database.DbAttributeInstance.SPRE ); if( _spref.IsValid ) mComponentName = _spref.GetAsString( Database.DbAttributeInstance.NAMN ); } Database.DbElement _staref = aCable.GetElement( Database.DbAttributeInstance.STAREF ); if( _staref.IsValid ) { if( _staref.GetElementType() == Database.DbElementTypeInstance.SCELCONNECTION ) { mStartElconn = MiscUtilities.GetElemPresName( _staref ); mStartEqui = MiscUtilities.GetElemPresName( _staref.Owner ); } else mStartEqui = MiscUtilities.GetElemPresName( _staref ); } Database.DbElement _endref = aCable.GetElement( Database.DbAttributeInstance.ENDREF ); if( _endref.IsValid ) { if( _endref.GetElementType() == Database.DbElementTypeInstance.SCELCONNECTION ) { mEndElconn = MiscUtilities.GetElemPresName( _endref ); mEndEqui = MiscUtilities.GetElemPresName( _endref.Owner ); } else mEndEqui = MiscUtilities.GetElemPresName( _endref ); } Database.DbElement [] _cores = aCable.Members( Database.DbElementTypeInstance.SCCORE ); //get informaton about cores foreach( Database.DbElement _core in _cores ) { CoreInfo _coreInf = new CoreInfo( _core, this ); mCores.Add( _coreInf ); } } }