Пример #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);
        }
Пример #2
0
        private TreeNode p1Nodes(P1Object p1)
        {
            string          p1Name = string.Format("{0}: {1}", p1.Type.Value, p1.Name);
            TreeNode        ret    = new TreeNode(p1Name);
            List <PIObject> l      = p1.GetComponents();

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

            return(ret);
        }
Пример #3
0
        private TreeNode p1Nodes(P1Object p1)
        {
            string p1Name = string.Format("{0}: {1}", p1.Type.Value, p1.Name);
            TreeNode ret = new TreeNode(p1Name);
            List<PIObject> l = p1.GetComponents();

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

            return (ret);
        }
Пример #4
0
 public List<P1Object> GetAllP1Objects()
 {
     List<P1Object> ret = new List<P1Object>();
     using (SQLiteCommand comm = connection.CreateCommand())
     {
         comm.CommandText = DBConstants.P1_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);
             P1Object obj = new P1Object(idValue, nameValue, PIObject.ObjectType.P1);
             ret.Add(obj);
         }
         reader.Close();
         reader = null;
     }
     return (ret);
 }
Пример #5
0
        private List <P1Object> GetP1ComponentsByP4ID(int id)
        {
            List <P1Object> ret = new List <P1Object>();

            using (SQLiteCommand comm = connection.CreateCommand())
            {
                comm.CommandText = DBConstants.P4_GET_P1_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.P1_ID_FIELD);
                    int      idValue  = (reader.IsDBNull(idColumn)) ? -1 : reader.GetInt32(idColumn);
                    P1Object obj      = GetP1ByID(idValue);
                    ret.Add(obj);
                }
                reader.Close();
                reader = null;
            }
            return(ret);
        }
Пример #6
0
        public List <P1Object> GetAllP1Objects()
        {
            List <P1Object> ret = new List <P1Object>();

            using (SQLiteCommand comm = connection.CreateCommand())
            {
                comm.CommandText = DBConstants.P1_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);
                    P1Object obj        = new P1Object(idValue, nameValue, PIObject.ObjectType.P1);
                    ret.Add(obj);
                }
                reader.Close();
                reader = null;
            }
            return(ret);
        }
Пример #7
0
        private TreeNode p4Nodes(P4Object p4)
        {
            string          p4Name = string.Format("{0}: {1}", p4.Type.Value, p4.Name);
            TreeNode        ret    = new TreeNode(p4Name);
            List <PIObject> l      = p4.GetComponents();

            foreach (PIObject p in l)
            {
                if (p.Type.Value == PIObject.ObjectType.P3.Value)
                {
                    P3Object pi = (P3Object)p;
                    TreeNode t  = p3Nodes(pi);
                    ret.Nodes.Add(t);
                }
                if (p.Type.Value == PIObject.ObjectType.P1.Value)
                {
                    P1Object pi = (P1Object)p;
                    TreeNode t  = p1Nodes(pi);
                    ret.Nodes.Add(t);
                }
            }
            return(ret);
        }
Пример #8
0
        public P1Object GetP1ByID(int id)
        {
            P1Object ret = null;

            using (SQLiteCommand comm = connection.CreateCommand())
            {
                comm.CommandText = DBConstants.P1_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 P1Object(idValue, nameValue, PIObject.ObjectType.P1);
                    break;
                }
                reader.Close();
                reader = null;
            }
            return(ret);
        }
Пример #9
0
 public P1Object GetP1ByName(string name)
 {
     P1Object ret = null;
     using (SQLiteCommand comm = connection.CreateCommand())
     {
         comm.CommandText = DBConstants.P1_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 P1Object(idValue, nameValue, PIObject.ObjectType.P1);
             break;
         }
         reader.Close();
         reader = null;
     }
     return (ret);
 }