예제 #1
0
        public static WordsStorageModel GetWordModelFromAiCiBa(AiCiBaE2C_Model _aimodel)
        {
            WordsStorageModel result = new WordsStorageModel();

            result.Word       = _aimodel.word_name;
            result.word_pl    = ListHelper.GetListFromArray(_aimodel.exchange.word_pl);
            result.word_past  = ListHelper.GetListFromArray(_aimodel.exchange.word_past);
            result.word_done  = ListHelper.GetListFromArray(_aimodel.exchange.word_done);
            result.word_ing   = ListHelper.GetListFromArray(_aimodel.exchange.word_ing);
            result.word_third = ListHelper.GetListFromArray(_aimodel.exchange.word_third);
            result.word_er    = ListHelper.GetListFromArray(_aimodel.exchange.word_er);
            result.word_est   = ListHelper.GetListFromArray(_aimodel.exchange.word_est);
            result.ph_en      = _aimodel.symbols[0].ph_en;
            result.ph_am      = _aimodel.symbols[0].ph_am;
            result.ph_other   = _aimodel.symbols[0].ph_other;
            result.ph_en_mp3  = _aimodel.symbols[0].ph_en_mp3;
            result.ph_am_mp3  = _aimodel.symbols[0].ph_am_mp3;
            result.ph_tts_mp3 = _aimodel.symbols[0].ph_tts_mp3;
            foreach (var definition in _aimodel.symbols[0].parts.ToList())
            {
                result.Definitions.Add(new DefinitionStroage()
                {
                    part  = definition.part,
                    means = definition.means.ToList()
                });
            }
            return(result);
        }
예제 #2
0
        public static WordsStorageModel QueryEntry(string _word, int _dictionarysource_id)
        {
            WordsStorageModel result = SQLManager.QueryEntry(_word, _dictionarysource_id);

            result.Definitions = SQLManager.QueryDefinitions(result.ID);
            return(result);
        }
예제 #3
0
        public static WordsStorageModel QueryWord(string _word, int _dictionarysource_id)
        {
            WordsStorageModel result = QueryEntry(_word, _dictionarysource_id);

            foreach (var _partofspeech in SQLManager.QueryPartOfSpeech(result.ID))
            {
                switch (_partofspeech.Part)
                {
                case "word_pl":
                    result.word_pl.Add(_partofspeech.Word);
                    break;

                case "word_past":
                    result.word_past.Add(_partofspeech.Word);
                    break;

                case "word_done":
                    result.word_done.Add(_partofspeech.Word);
                    break;

                case "word_ing":
                    result.word_ing.Add(_partofspeech.Word);
                    break;

                case "word_third":
                    result.word_third.Add(_partofspeech.Word);
                    break;

                case "word_er":
                    result.word_er.Add(_partofspeech.Word);
                    break;

                case "word_est":
                    result.word_est.Add(_partofspeech.Word);
                    break;
                }
            }
            result.Definitions = SQLManager.QueryDefinitions(result.ID);
            foreach (var _definition in result.Definitions)
            {
                _definition.Means = SQLManager.QueryMeans(_definition.ID);
                foreach (var _mean in _definition.Means)
                {
                    _definition.means.Add(_mean.Meaning);
                }
            }

            return(result);
        }
예제 #4
0
 public static WordsStorageModel Add(WordsStorageModel _entry)
 {
     if (!SQLManager.IfWordExist(_entry.Word))
     {
         Word _word = new Word()
         {
             Spelling = _entry.Word
         };
         SQLManager.Add(_word);
     }
     if (!SQLManager.IfEntryExist(_entry.Word, _entry.DictionarySource_ID))
     {
         SQLManager.Add(_entry);
         int _entry_id = SQLManager.FindEntryID(_entry.Word, _entry.DictionarySource_ID);
         foreach (var item in _entry.word_pl)
         {
             PartOfSpeechStorage partofspeech = new PartOfSpeechStorage()
             {
                 Entry_ID = _entry_id,
                 Part     = "word_pl",
                 Word     = item
             };
             SQLManager.Add(partofspeech);
         }
         foreach (var item in _entry.word_past)
         {
             PartOfSpeechStorage partofspeech = new PartOfSpeechStorage()
             {
                 Entry_ID = _entry_id,
                 Part     = "word_past",
                 Word     = item
             };
             SQLManager.Add(partofspeech);
         }
         foreach (var item in _entry.word_done)
         {
             PartOfSpeechStorage partofspeech = new PartOfSpeechStorage()
             {
                 Entry_ID = _entry_id,
                 Part     = "word_done",
                 Word     = item
             };
             SQLManager.Add(partofspeech);
         }
         foreach (var item in _entry.word_ing)
         {
             PartOfSpeechStorage partofspeech = new PartOfSpeechStorage()
             {
                 Entry_ID = _entry_id,
                 Part     = "word_ing",
                 Word     = item
             };
             SQLManager.Add(partofspeech);
         }
         foreach (var item in _entry.word_third)
         {
             PartOfSpeechStorage partofspeech = new PartOfSpeechStorage()
             {
                 Entry_ID = _entry_id,
                 Part     = "word_third",
                 Word     = item
             };
             SQLManager.Add(partofspeech);
         }
         foreach (var item in _entry.word_er)
         {
             PartOfSpeechStorage partofspeech = new PartOfSpeechStorage()
             {
                 Entry_ID = _entry_id,
                 Part     = "word_er",
                 Word     = item
             };
             SQLManager.Add(partofspeech);
         }
         foreach (var item in _entry.word_est)
         {
             PartOfSpeechStorage partofspeech = new PartOfSpeechStorage()
             {
                 Entry_ID = _entry_id,
                 Part     = "word_est",
                 Word     = item
             };
             SQLManager.Add(partofspeech);
         }
         foreach (var _definition in _entry.Definitions)
         {
             _definition.ID       = Guid.NewGuid();
             _definition.Entry_ID = _entry_id;
             SQLManager.Add(_definition);
             foreach (var _mean in _definition.means)
             {
                 var newMean = new MeanStorage()
                 {
                     Definition_ID = _definition.ID,
                     Meaning       = _mean
                 };
                 _definition.Means.Add(newMean);
                 SQLManager.Add(newMean);
             }
         }
     }
     return(_entry);
 }