public List <SinglePerfPhrase> get_all_phrases_()
        {
            List <SinglePerfPhrase> result = new List <SinglePerfPhrase>();
            string       sql     = "SELECT * FROM single_perf_phrase;";
            MySqlCommand command = new MySqlCommand(sql, connection);
            //connection.Open();
            // выполняем запрос и получаем ответ
            MySqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                string id_single_perf_phrase     = reader["idsingle_perf_phrase"].ToString();
                int    num_in_perf_              = (int)reader["num_in_perf"];
                string text_russian              = reader["text_russian"].ToString();
                string text_english              = reader["text_english"].ToString();
                int    performance_idperformance = (int)reader["performance_idperformance"];
                string actor_name            = reader["actor_name"].ToString();
                string animation_idanimation = reader["animation_idanimation"].ToString();

                int animation_idanimation_ = 0;
                try
                {
                    animation_idanimation_ = Int32.Parse(animation_idanimation);
                }
                catch
                {
                }

                SinglePerfPhrase single_perf_phrase = new SinglePerfPhrase(Int32.Parse(id_single_perf_phrase), num_in_perf_, text_russian, text_english, performance_idperformance, actor_name, animation_idanimation_);

                result.Add(single_perf_phrase);
            }

            reader.Close();
            //SinglePerfPhrase result_ = result[0];
            foreach (SinglePerfPhrase res in result)
            {
                string       sql1     = "SELECT CONVERT(text_russian USING utf8) FROM single_perf_phrase WHERE idsingle_perf_phrase = '" + res.id_single_perf_phrase.ToString() + "';";
                MySqlCommand command1 = new MySqlCommand(sql1, connection);
                res.text_russian = command1.ExecuteScalar().ToString();
            }

            return(result);
        }
Exemple #2
0
        private void get_current_phrase()
        {
            single_perf_phrase = native_connect.get_current_phrase(phrase_index, 1);
            //MessageBox.Show(single_perf_phrase.id_single_perf_phrase.ToString());

            richTextBox1.Text = single_perf_phrase.text_russian;
            textBox1.Text     = single_perf_phrase.actor_name;
            textBox3.Text     = anim_connect.get_animation_name(single_perf_phrase.animation_idanimation);

            max_id = Math.Max(single_perf_phrase.id_single_perf_phrase, max_id);

            single_perf_phrases = native_connect.get_all_phrases(max_id);
            listView1.Items.Clear();
            foreach (SinglePerfPhrase spf in single_perf_phrases)
            {
                ListViewItem newitem = new ListViewItem(spf.text_russian);
                newitem.SubItems.Add(anim_connect.get_animation_name(spf.animation_idanimation));
                listView1.Items.Add(newitem);
            }
        }