示例#1
0
        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);
        }
示例#2
0
 public int Delete(TnfConnectionPort tnfConnectionPort)
 {
     return(Delete(new object[]
     {
         tnfConnectionPort.LinkSequenceOid,
         tnfConnectionPort.PortNumber,
         tnfConnectionPort.NodeOid,
         tnfConnectionPort.NodePortNumber
     }));
 }
示例#3
0
 public int Update(TnfConnectionPort tnfConnectionPort)
 {
     return(Update(new object[]
     {
         tnfConnectionPort.LinkSequenceOid,
         tnfConnectionPort.PortNumber,
         tnfConnectionPort.Distance,
         tnfConnectionPort.NodeOid,
         tnfConnectionPort.NodePortNumber
     }));
 }
示例#4
0
 public void Add(TnfConnectionPort tnfConnectionPort)
 {
     Add(new object[]
     {
         tnfConnectionPort.LinkSequenceOid,
         tnfConnectionPort.PortNumber,
         tnfConnectionPort.Distance,
         tnfConnectionPort.NodeOid,
         tnfConnectionPort.NodePortNumber
     });
 }
示例#5
0
        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);
        }