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); }
private TreeNode rawNodes(RawPIObject raw) { string rawName = string.Format("{0}: {1}", raw.Type.Value, raw.Name); TreeNode ret = new TreeNode(rawName); List <PIObject> l = raw.GetComponents(); foreach (PIObject p in l) { //TreeNode t = planetNodes((Planet)p); //ret.Nodes.Add(t); string planetName = string.Format("{0}: {1}", p.Type.Value, p.Name); TreeNode t = new TreeNode(planetName); ret.Nodes.Add(t); } return(ret); }
public List <RawPIObject> GetRawComponentsByP1ID(int id) { List <RawPIObject> ret = new List <RawPIObject>(); using (SQLiteCommand comm = connection.CreateCommand()) { comm.CommandText = DBConstants.P1_GET_RAW_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.RAW_PI_ID_FIELD); int idValue = (reader.IsDBNull(idColumn)) ? -1 : reader.GetInt32(idColumn); RawPIObject obj = GetRawPIByID(idValue); ret.Add(obj); } reader.Close(); reader = null; } return(ret); }
public List <RawPIObject> GetAllRawPIObjects() { List <RawPIObject> ret = new List <RawPIObject>(); using (SQLiteCommand comm = connection.CreateCommand()) { comm.CommandText = DBConstants.RAW_PI_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); RawPIObject obj = new RawPIObject(idValue, nameValue, PIObject.ObjectType.Raw); ret.Add(obj); } reader.Close(); reader = null; } return(ret); }
public RawPIObject GetRawPIByID(int id) { RawPIObject ret = null; using (SQLiteCommand comm = connection.CreateCommand()) { comm.CommandText = DBConstants.RAW_PI_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 RawPIObject(idValue, nameValue, PIObject.ObjectType.Raw); break; } reader.Close(); reader = null; } return(ret); }
private TreeNode rawNodes(RawPIObject raw) { string rawName = string.Format("{0}: {1}", raw.Type.Value, raw.Name); TreeNode ret = new TreeNode(rawName); List<PIObject> l = raw.GetComponents(); foreach (PIObject p in l) { //TreeNode t = planetNodes((Planet)p); //ret.Nodes.Add(t); string planetName = string.Format("{0}: {1}", p.Type.Value, p.Name); TreeNode t = new TreeNode(planetName); ret.Nodes.Add(t); } return (ret); }
public RawPIObject GetRawPIByName(string name) { RawPIObject ret = null; using (SQLiteCommand comm = connection.CreateCommand()) { comm.CommandText = DBConstants.RAW_PI_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 RawPIObject(idValue, nameValue, PIObject.ObjectType.Raw); break; } reader.Close(); reader = null; } return (ret); }
public List<RawPIObject> GetAllRawPIObjects() { List<RawPIObject> ret = new List<RawPIObject>(); using (SQLiteCommand comm = connection.CreateCommand()) { comm.CommandText = DBConstants.RAW_PI_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); RawPIObject obj = new RawPIObject(idValue, nameValue, PIObject.ObjectType.Raw); ret.Add(obj); } reader.Close(); reader = null; } return (ret); }