Exemplo n.º 1
0
 public long UpdateCategory(Category category)
 {
     return (new CategoryDao(Connection, SchemaName)).Update(category);
 }
Exemplo n.º 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;
 }
Exemplo n.º 3
0
        private static Category GetProductCategory()
        {
            Category category = new Category();
            category.CategoryId = DbHelper.GetRandomRowId(
                TableName.CATEGORY.ToString(), 
                DbDefault.GetTableStructure(TableName.CATEGORY).PKColumns[0]);

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

            return category;
        }
Exemplo n.º 6
0
        private static Category CreateCategory()
        {
            Category category = new Category();
            category.CategoryId = GetNewCategoryId();

            return GetCategoryInfo(category);
        }
Exemplo n.º 7
0
 private String BuildQuery(String statement, Category category)
 {
     return String.Format(statement,
         GFXDDbi.Escape(category.Name),
         GFXDDbi.Escape(category.Description));
 }
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }