Пример #1
0
 public long UpdateCategory(Category category)
 {
     return (new CategoryDao(Connection, SchemaName)).Update(category);
 }
Пример #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;
 }
Пример #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;
        }
Пример #4
0
 public long AddCategory(Category category)
 {
     return (new CategoryDao(Connection, SchemaName)).Insert(category);
 }
Пример #5
0
        private static Category GetCategoryInfo(Category category)
        {
            category.Name = GetCategoryName();
            category.Description = GetCategoryDescription();

            return category;
        }
Пример #6
0
        private static Category CreateCategory()
        {
            Category category = new Category();
            category.CategoryId = GetNewCategoryId();

            return GetCategoryInfo(category);
        }
Пример #7
0
 private String BuildQuery(String statement, Category category)
 {
     return String.Format(statement,
         GFXDDbi.Escape(category.Name),
         GFXDDbi.Escape(category.Description));
 }
Пример #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));
        }
Пример #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);
        }