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

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

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

            return c;
        }
Пример #4
0
 public Category Add(Category category)
 {
     return AddCategory().Add(category);
 }
Пример #5
0
 private Category add(Connection connection, Category category)
 {
     category.Id = connection.InsertCategory(category);
     return category;
 }
Пример #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;
        }
Пример #7
0
 public int InsertCategory(Category category)
 {
     string values = category.Id + @"', '" + category.Name + @"', '" + category.Description;
     return Insert("Category", "Id, Name, Description", values);
 }
Пример #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;
        }
Пример #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;
        }
Пример #10
0
 public Category Add(Category category)
 {
     return informationAdapter.Add(category);
 }