Example #1
0
 public long UpdateCategory(Category category)
 {
     return (new CategoryDao(Connection, SchemaName)).Update(category);
 }
Example #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;
        }
Example #4
0
 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);
        }
Example #7
0
 private String BuildQuery(String statement, Category category)
 {
     return String.Format(statement,
         GFXDDbi.Escape(category.Name),
         GFXDDbi.Escape(category.Description));
 }
Example #8
0
        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));
        }
Example #9
0
        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);
        }