Example #1
0
 public Type( Category category, string name, string description)
 {
     this.Id = 1;
     this.Category = category;
     this.Name = name;
     this.Description = description;
 }
Example #2
0
 public Category Add(Category category)
 {
     if (!CategoryExists(category))
     {
         Category c = function_adapter.Add(category);
         return c;
     }
     return category;
 }
Example #3
0
        public Category Add(Category category)
        {
            Category c = null;

            c = Transaction<Category, Category>(add, category);

            if (c != null)
                allCategories.Add(c);

            return c;
        }
Example #4
0
 public Category Add(Category category)
 {
     return AddCategory().Add(category);
 }
Example #5
0
 private Category add(Connection connection, Category category)
 {
     category.Id = connection.InsertCategory(category);
     return category;
 }
Example #6
0
        public List<Category> SelectAllFromCategory()
        {
            List<Category> categories = new List<Category>();
            List<Dictionary<string, string>> list = null;

            list = SelectFrom("Category");

            foreach (var row in list)
            {
                Category category = new Category();
                category.Id = row["Id"].ToInt();
                category.Name = row["Name"];
                category.Description = row["Description"];

                categories.Add(category);
            }

            return categories;
        }
Example #7
0
 public int InsertCategory(Category category)
 {
     string values = category.Id + @"', '" + category.Name + @"', '" + category.Description;
     return Insert("Category", "Id, Name, Description", values);
 }
Example #8
0
        public Category SelectCategory(int Id)
        {
            Category category = null;
            List<Dictionary<string, string>> list = null;

            list = SelectFrom("Category", @"Id = '" + Id + @"'");

            foreach (var row in list)
            {
                category = new Category();
                category.Id = row["Id"].ToInt();
                category.Name = row["Name"];
                category.Description = row["Description"];

                break;
            }

            return category;
        }
Example #9
0
        public bool CategoryExists(Category category)
        {
            List<Category> categories = function_adapter.GetAllCategories();

            foreach (Category item in categories)
            {
                if (item.Name.Equals(category.Name))
                {
                    return true;
                }
            }
            return false;
        }
Example #10
0
 public Category Add(Category category)
 {
     return informationAdapter.Add(category);
 }