public long UpdateCategory(Category category)
 {
     return (new CategoryDao(Connection, SchemaName)).Update(category);
 }
Exemple #2
0
 public Product()
 {
     ProductId = 0;
     Name = String.Empty;
     Description = String.Empty;
     Category = new Category();
     Supplier = new Supplier();
     UnitCost = 0;
     RetailPrice = 0;
     UnitsInStock = 0;
     ReorderQuantity = 0;
     LastOrderDate = DateTime.Today;
     NextOrderDate = DateTime.Today;
 }
        private static Category GetProductCategory()
        {
            Category category = new Category();
            category.CategoryId = DbHelper.GetRandomRowId(
                TableName.CATEGORY.ToString(), 
                DbDefault.GetTableStructure(TableName.CATEGORY).PKColumns[0]);

            return category;
        }
 public long AddCategory(Category category)
 {
     return (new CategoryDao(Connection, SchemaName)).Insert(category);
 }
        private static Category GetCategoryInfo(Category category)
        {
            category.Name = GetCategoryName();
            category.Description = GetCategoryDescription();

            return category;
        }
        private static Category CreateCategory()
        {
            Category category = new Category();
            category.CategoryId = GetNewCategoryId();

            return GetCategoryInfo(category);
        }
 private String BuildQuery(String statement, Category category)
 {
     return String.Format(statement,
         GFXDDbi.Escape(category.Name),
         GFXDDbi.Escape(category.Description));
 }
        public int Update(Category category)
        {
            String statement = QualifyTableName(DbDefault.GetUpdateStatement(
                TableName.CATEGORY, new long[] { category.CategoryId }));

            if (Connection != null)
                return GFXDDbi.Update(Connection, BuildQuery(statement, category));
            else
                return GFXDDbi.Update(BuildQuery(statement, category));
        }
        public long Insert(Category category)
        {
            String statement = QualifyTableName(DbDefault.GetInsertStatement(
                TableName.CATEGORY, new long[] { category.CategoryId }));

            statement = BuildQuery(statement, category);

            if (Connection != null)
                return GFXDDbi.Insert(Connection, statement);
            else
                return GFXDDbi.Insert(statement);
        }