Exemplo n.º 1
0
 private CategoryViewModel(Category category)
 {
     m_underlyingData = category;
     Name = m_underlyingData.name;
     Type = m_underlyingData.type;
     SeqNo = m_underlyingData.seqNo;
 }
Exemplo n.º 2
0
        public CategoryViewModel(ICategoriesManager categoriesManager, Category category)
            : this(category)
        {
            m_categoriesManager = categoriesManager;

            WatchChildren();
        }
Exemplo n.º 3
0
 public void Update(Category cat)
 {
     string query = QueryBuilder.Update("categories", "categoryId", cat.categoryId.ToString(),
                                                           GetNameColumnPair(cat.name),
                                                           GetParentIdColumnPair(cat.parentId),
                                                           GetTypeColumnPair(cat.type));
     using (SQLiteCommand update = new SQLiteCommand(query, m_conn))
         update.ExecuteNonQuery();
 }
Exemplo n.º 4
0
 public void Delete(Category cat)
 {
     string query = QueryBuilder.Delete("categories", "categoryId", cat.categoryId.ToString());
     using (SQLiteCommand delete = new SQLiteCommand(query, m_conn))
         delete.ExecuteNonQuery();
 }
Exemplo n.º 5
0
 public void Update(Category cat)
 {
     m_categories[cat.categoryId] = cat;
 }
Exemplo n.º 6
0
 public void Delete(Category cat)
 {
     m_categories.Remove(cat.categoryId);
 }
Exemplo n.º 7
0
 public long Add(string name, long parentId, CategoryType type)
 {
     Category category = new Category(name, GetNewId(), parentId, type, double.NaN);
     m_categories.Add(category.categoryId, category);
     return category.categoryId;
 }
Exemplo n.º 8
0
 public CategoryViewModel AddChildCategory(CategoryViewModel category, string name, CategoryType type)
 {
     long catId = m_database.Add(name, category.CategoryId, type);
     Category c = new Category(name, catId, category.CategoryId, type, double.NaN);
     CategoryViewModel newCategory = new CategoryViewModel(m_database, category, c);
     category.Children.Add(newCategory);
     Categories.Add(newCategory);
     return newCategory;
 }
Exemplo n.º 9
0
 public void Delete(Category cat)
 {
     m_categoriesManager.Delete(cat);
 }
Exemplo n.º 10
0
 public void Update(Category cat)
 {
     m_categoriesManager.Update(cat);
 }