public List <Position> getAllCharacteristics() { List <Position> positons = new List <Position> (); try { SqlConnection con = connector.getConnection(); String sqlSelect = "SELECT Id, Name FROM CharacteristicsNames"; SqlCommand command = new SqlCommand(sqlSelect, con); SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) // если есть данные { while (reader.Read()) // построчно считываем данные { Position positon = new Position(reader.GetInt32(0), reader.GetString(1)); // get all possible values positon.setPossibleValues(getAllPossibleValues(con, positon)); positons.Add(positon); } } } catch (SqlException ignored) { } return(positons); }
private void executeQueries(List <String> sqlQueries) { try { SqlConnection con = connector.getConnection(); foreach (String sqlQuery in sqlQueries) { SqlCommand command = new SqlCommand(sqlQuery, con); command.ExecuteNonQuery(); } } catch (SqlException ignored) { } }
public List <VocabularyWord> getAll() { List <VocabularyWord> vocabularyWords = new List <VocabularyWord>(); try { SqlConnection con = connector.getConnection(); String sqlSelect = "SELECT Id, Value FROM Vocabulary"; SqlCommand command = new SqlCommand(sqlSelect, con); SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { vocabularyWords.Add(new VocabularyWord(reader.GetInt32(0), reader.GetString(1))); } } } catch (SqlException ignored) { } return(vocabularyWords); }
public List <Verse> getAll() { List <Verse> verse = new List <Verse>(); try { SqlConnection con = connector.getConnection(); String sqlSelect = "SELECT Id, Text FROM ExpandableTexts"; SqlCommand command = new SqlCommand(sqlSelect, con); SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) // если есть данные { while (reader.Read()) // построчно считываем данные { verse.Add(new Verse(reader.GetString(1), getCharacteristicsValues(con, reader.GetInt32(1)))); } } } catch (SqlException ignored) { } return(verse); }