/// <summary> /// Create a new Word object. /// </summary> /// <param name="word_id">Initial value of the Word_id property.</param> /// <param name="word_name">Initial value of the Word_name property.</param> /// <param name="system_InsDT">Initial value of the System_InsDT property.</param> public static Word CreateWord(global::System.Int64 word_id, global::System.String word_name, global::System.DateTime system_InsDT) { Word word = new Word(); word.Word_id = word_id; word.Word_name = word_name; word.System_InsDT = system_InsDT; return word; }
/// <summary>Merge слова в таблицу /// </summary> private Int64 MergeWord(string stem) { if (!_db.Word.Any(w => w.Word_name == stem)) { var newWord = new Word { Word_name = stem, System_InsDT = DateTime.Now }; _db.Word.AddObject(newWord); _db.SaveChanges(); } return _db.Word.Single(w => w.Word_name == stem).Word_id; }
/// <summary> /// Deprecated Method for adding a new object to the Word EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToWord(Word word) { base.AddObject("Word", word); }
/// <summary> /// Получить статус слова в теме согластно базе /// </summary> public WordStatus GetWordStatus(string themeName, string stem) { var theme = _db.Theme.SingleOrDefault(t => t.Theme_name == themeName); var word = _db.Word.SingleOrDefault(w => w.Word_name == stem); if (theme == null) { theme = new Theme { Theme_name = themeName, Theme_caption = themeName, System_InsDT = DateTime.Now }; _db.Theme.AddObject(theme); _db.SaveChanges(); } if (word == null) { word = new Word { Word_name = stem, System_InsDT = DateTime.Now }; _db.Word.AddObject(word); _db.SaveChanges(); } theme = _db.Theme.Single(t => t.Theme_name == themeName); word = _db.Word.Single(w => w.Word_name == stem); if (_db.WordNotInTheme.Any(w => w.Word_id == word.Word_id && w.Theme_id == theme.Theme_id)) return WordStatus.WordNotInTheme; if (_db.WordCandidatesInTheme.Any(w => w.Word_id == word.Word_id && w.Theme_id == theme.Theme_id && w.WordCandidatesInTheme_Visible == false)) return WordStatus.WordAreIgnored; if (_db.WordInTheme.Any(w => w.Word_id == word.Word_id && w.Theme_id == theme.Theme_id && w.WordInTheme_isLexicalizedWord == true)) return WordStatus.WordInThemeLexicalized; if (_db.WordInTheme.Any(w => w.Word_id == word.Word_id && w.Theme_id == theme.Theme_id && w.WordInTheme_isLexicalizedWord == false)) return WordStatus.WordInTheme; return WordStatus.Other; }