Beispiel #1
0
        public bool AddWordToWordBook(String wordbookid,String word)
        {
            WordUnit wordunit = new WordUnit(word);

            wordunit.WordBookId = wordbookid;

            if (!IsWordInWordBook(wordbookid, wordunit.HeadWord))
            {
                using (var statement = connection_.Prepare(SQL_INSERT))
                {
                    statement.Bind(1, wordunit.HeadWord);
                    statement.Bind(2, wordunit.WordBookId);
                    statement.Bind(3, wordunit.Phonetic);
                    statement.Bind(4, wordunit.Definition);
                    statement.Bind(5, wordunit.DeletedFlag ? 1 : 0);
                    statement.Bind(6, wordunit.Note);
                    statement.Step();
                }
                return true;
            }
            else
            {
                return false;
            }
        }
Beispiel #2
0
 public bool DeleteWord(WordUnit word)
 {
     bool result = true;
     //bool result = wordlistDB_.DeleteWordFromWordBook(WordBookName, word);
     if (result)
     {
         WordCount--;
     }
     return result;
 }
Beispiel #3
0
 public bool AddWord(WordUnit word)
 {
     bool result = true;
     //bool result = wordlistDB_.AddWordToWordBook(WordBookName, word);
     if(result)
     {
         WordCount++;
     }
     return result;
 }
Beispiel #4
0
 private bool IsWordInWordBook(String wordbookid,WordUnit word)
 {
     if(word==null)
     {
         return false;
      }
     return this.IsWordInWordBook(wordbookid, word.HeadWord);
 }
Beispiel #5
0
 //should modify
 public bool UpdateWordInWordBook(String wordbookid,WordUnit word)
 {
     if (!IsWordInWordBook(wordbookid, word))
     {
         using (var statement = connection_.Prepare(SQL_UPDAET_WORD_NOTE_IN_WORDBOOK))
         {
             statement.Bind(1, word.Note);
             statement.Bind(2, word.HeadWord);
             statement.Bind(3, wordbookid);
         }
         return true;
     }
     else
     {
         return false;
     }
 }
Beispiel #6
0
 public bool UpdateWordDefinitionInWordBook(String wordbookid, String word)
 {
     WordUnit wordunit = new WordUnit(word);
     wordunit.WordBookId = wordbookid;
     if (IsWordInWordBook(wordbookid, wordunit.HeadWord))
     {
         using (var statement = connection_.Prepare(SQL_UPDAET_WORD_DEFINITION_IN_WORDBOOK))
         {
             statement.Bind(1, wordunit.Definition);
             statement.Bind(2, wordunit.HeadWord);
             statement.Bind(3, wordunit.WordBookId);
             statement.Step();
         }
         return true;
     }
     else
     {
         return false;
     }
 }