public Category GetCategoryByName(string Name) { if (Name.Length == 0) { return null; } Category category = GetObjectByFieldsAndSearchQuery(new Field[] { NameField }, Name, true, 0).Cast<Category>().FirstOrDefault(); if (category == null) { category = new Category(0, Name); SaveCategory(category); } return category; }
public bool SaveCategory(Category category) { SettingsHandler.instance.CurrentSettings.CategoryLastUpdated = TimeConverter.GetDateTime(); SettingsHandler.instance.SaveSettings(); try { if (category.ID == 0) { AddObject(category); } else { UpdateObject(category); } return true; } catch (Exception e) { new WebsiteException(e, ErrorOrigin.Website, this.ToString()); return false; } }
public Word(int ID, string Name, Category category, WordPack wordPack) : this(ID, Name, category.ID, wordPack.ID) { }