Пример #1
0
        public Word GetWordByNameCategoryAndWordPackID(string Name, int CategoryID, int WordPackID)
        {
            Filter[] Filters = new Filter[]
            {
                new Filter(FilterType.And, new Field[]
                    {
                        NameField, 
                        CategoryIDField,
                        WordPackIDField
                    },
                    new string[]
                    {
                        "Name",
                        "CategoryID",
                        "WordPackID"
                    },
                    new object[]
                    {
                        Name,
                        CategoryID,
                        WordPackID
                    })
            };

            var Words = GetObjectsByFilters(Filters);
            Word word = Words.Cast<Word>().ToList().FirstOrDefault();

            if (word == null)
            {
                word = new Word(0, Name, CategoryID, WordPackID);
            }

            return word;
        }
Пример #2
0
        public bool SaveWord(Word word)
        {
            SettingsHandler.instance.CurrentSettings.WordLastUpdated = TimeConverter.GetDateTime();
            SettingsHandler.instance.SaveSettings();

            try
            {
                if (word.ID == 0)
                {
                    AddObject(word);
                }
                else
                {
                    UpdateObject(word);
                }

                return true;
            }
            catch (Exception e)
            {
                new WebsiteException(e, ErrorOrigin.Website, this.ToString());
                return false;
            }
        }
Пример #3
0
 public void DeleteWord(Word word)
 {
     DeleteObject(word);
 }