Ejemplo n.º 1
0
        private TreeNode p2Nodes(P2Object p2)
        {
            string p2Name = string.Format("{0}: {1}", p2.Type.Value, p2.Name);
            TreeNode ret = new TreeNode(p2Name);
            List<PIObject> l = p2.GetComponents();

            foreach (PIObject p in l)
            {
                P1Object pi = (P1Object)p;
                TreeNode t = p1Nodes(pi);
                ret.Nodes.Add(t);
            }

            return (ret);
        }
Ejemplo n.º 2
0
        private TreeNode p2Nodes(P2Object p2)
        {
            string          p2Name = string.Format("{0}: {1}", p2.Type.Value, p2.Name);
            TreeNode        ret    = new TreeNode(p2Name);
            List <PIObject> l      = p2.GetComponents();

            foreach (PIObject p in l)
            {
                P1Object pi = (P1Object)p;
                TreeNode t  = p1Nodes(pi);
                ret.Nodes.Add(t);
            }

            return(ret);
        }
Ejemplo n.º 3
0
 public List<P2Object> GetAllP2Objects()
 {
     List<P2Object> ret = new List<P2Object>();
     using (SQLiteCommand comm = connection.CreateCommand())
     {
         comm.CommandText = DBConstants.P2_GET_ALL_PREPARED_STATEMENT_STRING;
         SQLiteDataReader reader = comm.ExecuteReader();
         while (reader.Read())
         {
             int idColumn = reader.GetOrdinal(DBConstants.ID_FIELD);
             int nameColumn = reader.GetOrdinal(DBConstants.NAME_FIELD);
             int idValue = (reader.IsDBNull(idColumn)) ? -1 : reader.GetInt32(idColumn);
             string nameValue = (reader.IsDBNull(nameColumn)) ? string.Empty : reader.GetString(nameColumn);
             P2Object obj = new P2Object(idValue, nameValue, PIObject.ObjectType.P2);
             ret.Add(obj);
         }
         reader.Close();
         reader = null;
     }
     return (ret);
 }
Ejemplo n.º 4
0
        public List <P2Object> GetP2ComponentsByP3ID(int id)
        {
            List <P2Object> ret = new List <P2Object>();

            using (SQLiteCommand comm = connection.CreateCommand())
            {
                comm.CommandText = DBConstants.P3_GET_P2_COMPONENTS_BY_ID_PREPARED_STATEMENT_STRING;
                comm.Parameters.AddWithValue("@id", id);
                comm.Prepare();
                SQLiteDataReader reader = comm.ExecuteReader();
                while (reader.Read())
                {
                    int      idColumn = reader.GetOrdinal(DBConstants.P2_ID_FIELD);
                    int      idValue  = (reader.IsDBNull(idColumn)) ? -1 : reader.GetInt32(idColumn);
                    P2Object obj      = GetP2ByID(idValue);
                    ret.Add(obj);
                }
                reader.Close();
                reader = null;
            }
            return(ret);
        }
Ejemplo n.º 5
0
        public List <P2Object> GetAllP2Objects()
        {
            List <P2Object> ret = new List <P2Object>();

            using (SQLiteCommand comm = connection.CreateCommand())
            {
                comm.CommandText = DBConstants.P2_GET_ALL_PREPARED_STATEMENT_STRING;
                SQLiteDataReader reader = comm.ExecuteReader();
                while (reader.Read())
                {
                    int      idColumn   = reader.GetOrdinal(DBConstants.ID_FIELD);
                    int      nameColumn = reader.GetOrdinal(DBConstants.NAME_FIELD);
                    int      idValue    = (reader.IsDBNull(idColumn)) ? -1 : reader.GetInt32(idColumn);
                    string   nameValue  = (reader.IsDBNull(nameColumn)) ? string.Empty : reader.GetString(nameColumn);
                    P2Object obj        = new P2Object(idValue, nameValue, PIObject.ObjectType.P2);
                    ret.Add(obj);
                }
                reader.Close();
                reader = null;
            }
            return(ret);
        }
Ejemplo n.º 6
0
        public P2Object GetP2ByID(int id)
        {
            P2Object ret = null;

            using (SQLiteCommand comm = connection.CreateCommand())
            {
                comm.CommandText = DBConstants.P2_GET_BY_ID_PREPARED_STATEMENT_STRING;
                comm.Parameters.AddWithValue("@id", id);
                SQLiteDataReader reader = comm.ExecuteReader();
                while (reader.Read())
                {
                    int    idColumn   = reader.GetOrdinal(DBConstants.ID_FIELD);
                    int    nameColumn = reader.GetOrdinal(DBConstants.NAME_FIELD);
                    int    idValue    = (reader.IsDBNull(idColumn)) ? -1 : reader.GetInt32(idColumn);
                    string nameValue  = (reader.IsDBNull(nameColumn)) ? string.Empty : reader.GetString(nameColumn);
                    ret = new P2Object(idValue, nameValue, PIObject.ObjectType.P2);
                    break;
                }
                reader.Close();
                reader = null;
            }
            return(ret);
        }
Ejemplo n.º 7
0
 public P2Object GetP2ByName(string name)
 {
     P2Object ret = null;
     using (SQLiteCommand comm = connection.CreateCommand())
     {
         comm.CommandText = DBConstants.P2_GET_BY_NAME_PREPARED_STATEMENT_STRING;
         comm.Parameters.AddWithValue("@name", name);
         SQLiteDataReader reader = comm.ExecuteReader();
         while (reader.Read())
         {
             int idColumn = reader.GetOrdinal(DBConstants.ID_FIELD);
             int nameColumn = reader.GetOrdinal(DBConstants.NAME_FIELD);
             int idValue = (reader.IsDBNull(idColumn)) ? -1 : reader.GetInt32(idColumn);
             string nameValue = (reader.IsDBNull(nameColumn)) ? string.Empty : reader.GetString(nameColumn);
             ret = new P2Object(idValue, nameValue, PIObject.ObjectType.P2);
             break;
         }
         reader.Close();
         reader = null;
     }
     return (ret);
 }