예제 #1
0
        public List <P4Object> GetAllP4Objects()
        {
            List <P4Object> ret = new List <P4Object>();

            using (SQLiteCommand comm = connection.CreateCommand())
            {
                comm.CommandText = DBConstants.P4_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);
                    P4Object obj        = new P4Object(idValue, nameValue, PIObject.ObjectType.P4);
                    ret.Add(obj);
                }
                reader.Close();
                reader = null;
            }
            return(ret);
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
0
        public P4Object GetP4ByID(int id)
        {
            P4Object ret = null;

            using (SQLiteCommand comm = connection.CreateCommand())
            {
                comm.CommandText = DBConstants.P4_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 P4Object(idValue, nameValue, PIObject.ObjectType.P4);
                    break;
                }
                reader.Close();
                reader = null;
            }
            return(ret);
        }
예제 #5
0
 public P4Object GetP4ByName(string name)
 {
     P4Object ret = null;
     using (SQLiteCommand comm = connection.CreateCommand())
     {
         comm.CommandText = DBConstants.P4_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 P4Object(idValue, nameValue, PIObject.ObjectType.P4);
             break;
         }
         reader.Close();
         reader = null;
     }
     return (ret);
 }
예제 #6
0
 public List<P4Object> GetAllP4Objects()
 {
     List<P4Object> ret = new List<P4Object>();
     using (SQLiteCommand comm = connection.CreateCommand())
     {
         comm.CommandText = DBConstants.P4_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);
             P4Object obj = new P4Object(idValue, nameValue, PIObject.ObjectType.P4);
             ret.Add(obj);
         }
         reader.Close();
         reader = null;
     }
     return (ret);
 }