示例#1
0
 public bool save(Word word, Language language, bool async = false)
 {
     if (async)
     {
         using (var localDao = new WordDAO())
         {
             return(localDao.save(word, language.ToString()));
         }
     }
     else
     {
         return(staticDao.save(word, language.ToString()));
     }
 }
示例#2
0
 public List <Word> getAll(Language language, int maxLength, bool async = false)
 {
     if (async)
     {
         using (var localDao = new WordDAO())
         {
             return(localDao.findAll(language.ToString(), maxLength));
         }
     }
     else
     {
         return(staticDao.findAll(language.ToString(), maxLength));
     }
 }
示例#3
0
 public List <Word> getByFirstCharacterAndLength(Language language, char character, int length, bool async = false)
 {
     if (async)
     {
         using (var localDao = new WordDAO())
         {
             return(localDao.findyByFirstCharacterAndFixedLength(language.ToString(), character, length));
         }
     }
     else
     {
         return(staticDao.findyByFirstCharacterAndFixedLength(language.ToString(), character, length));
     }
 }
示例#4
0
        public bool saveList(List <Word> words, Language language, bool async = false)
        {
            DatabaseController.getInstance().addTable(language.ToString());
            DataTable wordTable = toDataTable(words);

            if (async)
            {
                using (var localDao = new WordDAO())
                {
                    localDao.saveBulk(wordTable, language.ToString());
                }
            }
            else
            {
                staticDao.saveBulk(wordTable, language.ToString());
            }
            return(true);
        }
示例#5
0
 private WordService()
 {
     staticDao = new WordDAO();
 }