public TnfConnectionPort GetByLinkSequence(string linkSequenceOid, int portNumber) { TnfConnectionPort tnfConnectionPort = null; using (var command = Db.Command) { command.CommandText = string.Format( "SELECT * FROM {0} WHERE link_sequence_oid = '{1}' and port_number = {2}", TnfConnectionPortTableName, linkSequenceOid, portNumber); using (var reader = command.ExecuteReader()) { while (reader.Read()) { if (tnfConnectionPort == null) { tnfConnectionPort = ReadObject(reader); } else { throw new OpenTnfException(string.Format("More than one port found for LinkSequence {0} and port number {1}.", linkSequenceOid, portNumber)); } } } } return(tnfConnectionPort); }
public int Delete(TnfConnectionPort tnfConnectionPort) { return(Delete(new object[] { tnfConnectionPort.LinkSequenceOid, tnfConnectionPort.PortNumber, tnfConnectionPort.NodeOid, tnfConnectionPort.NodePortNumber })); }
public int Update(TnfConnectionPort tnfConnectionPort) { return(Update(new object[] { tnfConnectionPort.LinkSequenceOid, tnfConnectionPort.PortNumber, tnfConnectionPort.Distance, tnfConnectionPort.NodeOid, tnfConnectionPort.NodePortNumber })); }
public void Add(TnfConnectionPort tnfConnectionPort) { Add(new object[] { tnfConnectionPort.LinkSequenceOid, tnfConnectionPort.PortNumber, tnfConnectionPort.Distance, tnfConnectionPort.NodeOid, tnfConnectionPort.NodePortNumber }); }
private static TnfConnectionPort ReadObject(IDataRecord reader) { var tnfConnectionPort = new TnfConnectionPort(); tnfConnectionPort.LinkSequenceOid = reader["link_sequence_oid"].FromDbString(); tnfConnectionPort.PortNumber = (int)reader["port_number"].ToInt32(); tnfConnectionPort.Distance = (double)reader["distance"].ToDouble(); tnfConnectionPort.NodeOid = reader["node_oid"].FromDbString(); tnfConnectionPort.NodePortNumber = (int)reader["node_port_number"].ToInt32(); return(tnfConnectionPort); }