示例#1
0
    private void FinishLearning()
    {
        LearnedWord learned = new LearnedWord(progressedWord.WordIng, progressedWord.WordTr, progressedWord.WordType, progressedWord.Sentence, DateTime.Now);

        Db_Learning.DeleteWord(progressedWord);
        Db_Learned.SetWord(learned);
    }
 private void SetLabel(LearnedWord w)
 {
     wordTr.text   = w.WordTr;
     wordType.text = w.WordType;
     wordDate.text = w.LearnedDate.ToString("dd/MM/yyyy");
     sentence.text = w.Sentence;
 }
示例#3
0
    public static void SetWord(LearnedWord word)
    {
        connection.Open();

        string        cmd     = "insert into LearnedWords(WordIng,WordTr,Type,Sentence,LearnedDate) Values(@ing,@tr,@type,@sen,@date)";
        SqliteCommand command = new SqliteCommand(cmd, connection);

        command.Parameters.AddWithValue("@ing", word.WordIng);
        command.Parameters.AddWithValue("@tr", word.WordTr);
        command.Parameters.AddWithValue("@type", word.WordType);
        command.Parameters.AddWithValue("@sen", word.Sentence);
        command.Parameters.AddWithValue("@date", DateTime.Now);

        command.ExecuteNonQuery();

        connection.Close();
    }
示例#4
0
    public static List <LearnedWord> GetAllWords()
    {
        List <LearnedWord> wordList = new List <LearnedWord>();

        connection.Open();

        string           cmd     = "select * from LearnedWords";
        SqliteCommand    command = new SqliteCommand(cmd, connection);
        SqliteDataReader dr      = command.ExecuteReader();

        while (dr.Read())
        {
            LearnedWord word = new LearnedWord(dr[1].ToString(), dr[2].ToString(), dr[3].ToString(), dr[4].ToString(), (DateTime)dr[5]);
            wordList.Add(word);
        }

        connection.Close();

        return(wordList);
    }