Пример #1
0
        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);
        }
Пример #2
0
        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)
            {
            }
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }