Exemplo n.º 1
0
        public int Update(Supplier supplier)
        {
            String statement = QualifyTableName(DbDefault.GetUpdateStatement(
                TableName.SUPPLIER, new long[] { supplier.SupplierId }));

            if(Connection != null)
                return GFXDDbi.Update(Connection, BuildQuery(statement, supplier));
            else
                return GFXDDbi.Update(BuildQuery(statement, supplier));
        }
Exemplo n.º 2
0
 private String BuildQuery(String statement, Supplier supplier)
 {
     return String.Format(statement,
         GFXDDbi.Escape(supplier.Name),
         supplier.Address.AddressId,
         GFXDDbi.Escape(supplier.Phone),
         GFXDDbi.Escape(supplier.Email));
 }
Exemplo n.º 3
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.º 4
0
        public long Insert(Supplier supplier)
        {
            String statement = QualifyTableName(DbDefault.GetInsertStatement(
                TableName.SUPPLIER, new long[] { supplier.SupplierId }));

            statement = BuildQuery(statement, supplier);

            if(Connection != null)
                return GFXDDbi.Insert(Connection, statement);
            else
                return GFXDDbi.Insert(statement);
        }
Exemplo n.º 5
0
 public long UpdateSupplier(Supplier supplier)
 {
     return (new SupplierDao(Connection, SchemaName)).Update(supplier);
 }
Exemplo n.º 6
0
 public long AddSupplier(Supplier supplier)
 {
     return (new SupplierDao(Connection, SchemaName)).Insert(supplier);
 }
Exemplo n.º 7
0
        private static Supplier GetProductSupplier()
        {
            Supplier supplier = new Supplier();
            supplier.SupplierId = DbHelper.GetRandomRowId(
                TableName.SUPPLIER.ToString(), 
                DbDefault.GetTableStructure(TableName.SUPPLIER).PKColumns[0]);

            return supplier;
        }
Exemplo n.º 8
0
        private static Supplier GetSupplierInfo(Supplier supplier)
        {
            supplier.Name = GetSupplierName();
            supplier.Address = GetSupplierAddress();
            supplier.Phone = GetSupplierPhone();
            supplier.Email = GetSupplierEmail();

            return supplier;
        }
Exemplo n.º 9
0
        private static Supplier CreateSupplier()
        {
            Supplier supplier = new Supplier();
            supplier.SupplierId = GetNewSupplierId();

            return GetSupplierInfo(supplier);
        }