public OrderDetail SelectRandom() { DataRow row = (DataRow)GFXDDbi.Select(QualifyTableName( DbDefault.GetSelectRandomStatement(TableName.ORDERDETAIL, 1)), QueryTypes.DATAROW); return(new OrderDetail(row)); }
public Product SelectRandom() { DataRow row = (DataRow)GFXDDbi.Select(QualifyTableName( DbDefault.GetSelectRandomStatement(TableName.PRODUCT, 1)), QueryTypes.DATAROW); return(new Product(row)); }
public IList <Order> SelectByCustomer(long customerId) { String statement = QualifyTableName(DbDefault.GetSelectStatement( TableName.ORDERS, String.Format("customer_id = {0}", customerId))); DataTable table = null; if (Connection != null) { table = (DataTable)GFXDDbi.Select(Connection, statement, QueryTypes.DATATABLE); } else { table = (DataTable)GFXDDbi.Select(statement, QueryTypes.DATATABLE); } IList <Order> orders = new List <Order>(); foreach (DataRow row in table.Rows) { orders.Add(new Order(row)); } return(orders); }
public Customer SelectRandom() { DataRow row = (DataRow)GFXDDbi.Select(QualifyTableName( DbDefault.GetSelectRandomStatement(TableName.CUSTOMER, 1)), QueryTypes.DATAROW); return(new Customer(row)); }
public IList <OrderDetail> Select(long orderId) { String statement = QualifyTableName(DbDefault.GetSelectStatement( TableName.ORDERDETAIL, new long[] { orderId })); DataTable table = null; if (Connection != null) { table = (DataTable)GFXDDbi.Select(Connection, statement, QueryTypes.DATATABLE); } else { table = (DataTable)GFXDDbi.Select(statement, QueryTypes.DATATABLE); } IList <OrderDetail> orderdetails = new List <OrderDetail>(); foreach (DataRow row in table.Rows) { orderdetails.Add(new OrderDetail(row)); } return(orderdetails); }
public Address SelectRandom() { DataRow row = (DataRow)GFXDDbi.Select(QualifyTableName( DbDefault.GetSelectRandomStatement(TableName.ADDRESS, 1)), QueryTypes.DATAROW); return(new Address(row)); }
public Supplier SelectRandom() { DataRow row = (DataRow)GFXDDbi.Select(QualifyTableName( DbDefault.GetSelectRandomStatement(TableName.SUPPLIER, 1)), QueryTypes.DATAROW); return(new Supplier(row)); }
public Category SelectRandom() { DataRow row = (DataRow)GFXDDbi.Select(QualifyTableName( DbDefault.GetSelectRandomStatement(TableName.CATEGORY, 1)), QueryTypes.DATAROW); return(new Category(row)); }
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))); }
private String BuildQuery(String statement, Order order) { return(String.Format(statement, GFXDDbi.Escape(order.OrderDate.ToShortDateString()), GFXDDbi.Escape(order.ShipDate.ToShortDateString()), order.Customer.CustomerId, order.SubTotal)); }
private String BuildQuery(String statement, Customer customer) { return(String.Format(statement, GFXDDbi.Escape(customer.FirstName), GFXDDbi.Escape(customer.LastName), customer.Address.AddressId, GFXDDbi.Escape(customer.Phone), GFXDDbi.Escape(customer.Email), GFXDDbi.Escape(customer.LastOrderDate.ToShortDateString()))); }
private String BuildQuery(String statement, Address address) { return(String.Format(statement, GFXDDbi.Escape(address.Address1), GFXDDbi.Escape(address.Address2), GFXDDbi.Escape(address.Address3), GFXDDbi.Escape(address.City), GFXDDbi.Escape(address.State.ToString()), GFXDDbi.Escape(address.ZipCode.ToString()), GFXDDbi.Escape(address.Province.ToString()), (int)address.CountryCode)); }
public int Delete(long categoryId) { String statement = QualifyTableName(DbDefault.GetDeleteStatement( TableName.CATEGORY, new long[] { categoryId })); if (Connection != null) { return(GFXDDbi.Delete(Connection, statement)); } else { return(GFXDDbi.Delete(statement)); } }
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 IList <Supplier> SelectRandom(int numRecords) { DataTable table = (DataTable)GFXDDbi.Select(QualifyTableName( DbDefault.GetSelectRandomStatement(TableName.SUPPLIER, numRecords)), QueryTypes.DATATABLE); IList <Supplier> suppliers = new List <Supplier>(); foreach (DataRow row in table.Rows) { suppliers.Add(new Supplier(row)); } return(suppliers); }
public int Delete(long orderId, long productId) { String statement = QualifyTableName(DbDefault.GetDeleteStatement( TableName.ORDERDETAIL, new long[] { orderId, productId })); if (Connection != null) { return(GFXDDbi.Delete(Connection, statement)); } else { return(GFXDDbi.Delete(statement)); } }
public IList <Customer> SelectRandom(int numRecords) { DataTable table = (DataTable)GFXDDbi.Select(QualifyTableName( DbDefault.GetSelectRandomStatement(TableName.CUSTOMER, numRecords)), QueryTypes.DATATABLE); IList <Customer> customers = new List <Customer>(); foreach (DataRow row in table.Rows) { customers.Add(new Customer(row)); } return(customers); }
public IList <OrderDetail> SelectRandom(int numRecords) { DataTable table = (DataTable)GFXDDbi.Select(QualifyTableName( DbDefault.GetSelectRandomStatement(TableName.ORDERDETAIL, numRecords)), QueryTypes.DATATABLE); IList <OrderDetail> orderdetails = new List <OrderDetail>(); foreach (DataRow row in table.Rows) { orderdetails.Add(new OrderDetail(row)); } return(orderdetails); }
public IList <Product> SelectRandom(int numRecords) { DataTable table = (DataTable)GFXDDbi.Select(QualifyTableName( DbDefault.GetSelectRandomStatement(TableName.PRODUCT, numRecords)), QueryTypes.DATATABLE); IList <Product> products = new List <Product>(); foreach (DataRow row in table.Rows) { products.Add(new Product(row)); } return(products); }
public int Update(Customer customer) { String statement = QualifyTableName(DbDefault.GetUpdateStatement( TableName.CUSTOMER, new long[] { customer.CustomerId })); if (Connection != null) { return(GFXDDbi.Update(Connection, BuildQuery(statement, customer))); } else { return(GFXDDbi.Update(BuildQuery(statement, customer))); } }
public int Update(Product product) { String statement = QualifyTableName(DbDefault.GetUpdateStatement( TableName.PRODUCT, new long[] { product.ProductId })); if (Connection != null) { return(GFXDDbi.Update(Connection, BuildQuery(statement, product))); } else { return(GFXDDbi.Update(BuildQuery(statement, product))); } }
public IList <Category> SelectRandom(int numRecords) { DataTable table = (DataTable)GFXDDbi.Select(QualifyTableName( DbDefault.GetSelectRandomStatement(TableName.CATEGORY, numRecords)), QueryTypes.DATATABLE); IList <Category> categories = new List <Category>(); foreach (DataRow row in table.Rows) { categories.Add(new Category(row)); } return(categories); }
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))); } }
public IList <Address> SelectRandom(int numRecords) { DataTable table = (DataTable)GFXDDbi.Select(QualifyTableName( DbDefault.GetSelectRandomStatement(TableName.ADDRESS, numRecords)), QueryTypes.DATATABLE); IList <Address> addresses = new List <Address>(); foreach (DataRow row in table.Rows) { addresses.Add(new Address(row)); } return(addresses); }
public int Update(OrderDetail ordDetail) { String statement = QualifyTableName(DbDefault.GetUpdateStatement( TableName.ORDERDETAIL, new long[] { ordDetail.OrderId, ordDetail.ProductId })); if (Connection != null) { return(GFXDDbi.Update(Connection, BuildQuery(statement, ordDetail))); } else { return(GFXDDbi.Update(BuildQuery(statement, ordDetail))); } }
public int Delete(long supplierId) { String statement = QualifyTableName(DbDefault.GetDeleteStatement( TableName.SUPPLIER, new long[] { supplierId })); if (Connection != null) { return(GFXDDbi.Delete(Connection, statement)); } else { return(GFXDDbi.Delete(statement)); } }
private String BuildQuery(String statement, Product product) { return(String.Format(statement, GFXDDbi.Escape(product.Name), GFXDDbi.Escape(product.Description), product.Category.CategoryId, product.Supplier.SupplierId, product.UnitCost, product.RetailPrice, product.UnitsInStock, product.ReorderQuantity, GFXDDbi.Escape(product.LastOrderDate.ToShortDateString()), GFXDDbi.Escape(product.NextOrderDate.ToShortDateString()))); }
public int Update(Address address) { String statement = QualifyTableName(DbDefault.GetUpdateStatement( TableName.ADDRESS, new long[] { address.AddressId })); if (Connection != null) { return(GFXDDbi.Update(Connection, BuildQuery(statement, address))); } else { return(GFXDDbi.Update(BuildQuery(statement, address))); } }
public int Delete(long addressId) { String statement = DbDefault.GetDeleteStatement( TableName.ADDRESS, new long[] { addressId }); if (Connection != null) { return(GFXDDbi.Delete(Connection, statement)); } else { return(GFXDDbi.Delete(statement)); } }
public long Insert(Address address) { String statement = QualifyTableName(DbDefault.GetInsertStatement( TableName.ADDRESS, new long[] { address.AddressId })); statement = BuildQuery(statement, address); if (Connection != null) { return(GFXDDbi.Insert(Connection, statement)); } else { return(GFXDDbi.Insert(statement)); } }