Esempio n. 1
0
        public dbSignal getSignal(string signalName, string nameSpace )
        {
            dbSignal signal = null;
            if (signalName != null)
            {
                String sql = "SELECT * FROM signal_master WHERE signal_name = ?";
                List<OleDbParameter> dbParams = new List<OleDbParameter>();
                dbParams.Add(CreateParameter("@signal_name", signalName));
                if (!string.IsNullOrEmpty(nameSpace))
                {
                    sql += " AND xmlns = ? ";
                    dbParams.Add(CreateParameter("@xmlns", nameSpace));
                }

                OleDbDataReader reader = ExecuteSqlQuery(sql, dbParams.ToArray());
                if (reader != null)
                {
                    if (reader.Read())
                    {
                        signal = new dbSignal();
                        signal.load(reader);
                        signal.ChildSignals = getChildSignals(signal.signalId);
                        signal.Attributes = getSignalAttributes(signal.signalId);
                        if (signal.parentSignalId != null)
                            signal.ParentSignal = getSignal(signal.parentSignalId);

                    }
                    reader.Close();
                    reader.Dispose();
                }
            }
            return signal;
        }
Esempio n. 2
0
 public dbSignal getSignal(int? signalId)
 {
     dbSignal signal = null;
     if (signalId != null)
     {
         String sql = "SELECT * FROM signal_master WHERE signal_id = ?";
         OleDbParameter[] dbParams = {CreateParameter("@signal_id", signalId)};
         OleDbDataReader reader = ExecuteSqlQuery(sql, dbParams);
         if (reader != null)
         {
             if (reader.Read())
             {
                 signal = new dbSignal();
                 signal.load(reader);
                 signal.ChildSignals = getChildSignals(signal.signalId);
                 signal.Attributes = getSignalAttributes(signal.signalId);
                 if (signal.parentSignalId != null)
                     signal.ParentSignal = getSignal( signal.parentSignalId );
             }
             reader.Close();
             reader.Dispose();
         }
     }
     return signal;
 }
Esempio n. 3
0
        public List<dbSignal> getRootSignals()
        {
            XmlDocument doc = new XmlDocument();
            List<dbSignal> signals = new List<dbSignal>();

            String sql = "SELECT * FROM signal_master WHERE parent_signal_id=? ORDER BY signal_name";
            OleDbParameter[] dbParams = { CreateParameter("@parent_signal_id", 1) };
            using (OleDbDataReader reader = ExecuteSqlQuery( sql, dbParams ))
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        dbSignal signal = new dbSignal();
                        signal.load( reader );
                        signal.ChildSignals = getChildSignals( signal.signalId );
                        signal.Attributes = getSignalAttributes( signal.signalId );
                        signals.Add( signal );
                    }
                    reader.Close();
                    reader.Dispose();
                }
            }
            return signals;
        }
Esempio n. 4
0
 public List<dbSignal> getChildSignals(int? parentSignalId)
 {
     List<dbSignal> signals = new List<dbSignal>();
     if (parentSignalId != null)
     {
         String sql = "SELECT * FROM signal_master WHERE parent_signal_id = ?";
         OleDbParameter[] dbParams = {CreateParameter("@parent_signal_id", parentSignalId)};
         OleDbDataReader reader = ExecuteSqlQuery(sql, dbParams);
         if (reader != null)
         {
             while (reader.Read())
             {
                 dbSignal signal = new dbSignal();
                 signal.load(reader);
                 signal.ChildSignals = getChildSignals(signal.signalId);
                 signal.Attributes = getSignalAttributes(signal.signalId);
                 signals.Add(signal);
             }
             reader.Close();
             reader.Dispose();
         }
     }
     return signals;
 }
Esempio n. 5
0
 public dbSignal GetBaseBSCSignal()
 {
     dbSignal signal = null;
     String sql = "SELECT * FROM signal_master WHERE parent_signal_id = 1 AND xmlns LIKE '%STDBSC'";
     List<OleDbParameter> dbParams = new List<OleDbParameter>();
     OleDbDataReader reader = ExecuteSqlQuery(sql, dbParams.ToArray());
     if (reader != null)
     {
         if (reader.Read())
         {
             signal = new dbSignal();
             signal.load(reader);
             signal.ChildSignals = getChildSignals(signal.signalId);
             signal.Attributes = getSignalAttributes(signal.signalId);
         }
         reader.Close();
         reader.Dispose();
     }
     return signal;
 }
Esempio n. 6
0
        public List<dbSignal> GetAllTsfSignals()
        {
            var doc = new XmlDocument();
            var signals = new List<dbSignal>();

            var sql = new StringBuilder();
            sql.Append("SELECT a.* FROM ")
                .Append(SignalMasterBean._TABLE_NAME)
                .Append(" a, ")
                .Append(TestSignalLibraryBean._TABLE_NAME)
                .Append(" b WHERE a.")
                .Append(SignalMasterBean._XMLNS)
                .Append(" = b.")
                .Append(TestSignalLibraryBean._TARGET_NAMESPACE)
                .Append(" ORDER BY ")
                .Append(SignalMasterBean._SIGNAL_NAME);
            OleDbParameter[] dbParams = { CreateParameter("@parent_signal_id", 1) };
            using (OleDbDataReader reader = ExecuteSqlQuery( sql.ToString(), dbParams ))
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        var signal = new dbSignal();
                        signal.load( reader );
                        signal.ChildSignals = getChildSignals( signal.signalId );
                        signal.Attributes = getSignalAttributes( signal.signalId );
                        signals.Add( signal );
                    }
                    reader.Close();
                    reader.Dispose();
                }
            }
            return signals;
        }