Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public Address Select(long addressId)
        {
            String statement = QualifyTableName(DbDefault.GetSelectStatement(
                                                    TableName.ADDRESS, new long[] { addressId }));

            DataRow row = null;

            if (Connection != null)
            {
                row = (DataRow)GFXDDbi.Select(Connection, statement, QueryTypes.DATAROW);
            }
            else
            {
                row = (DataRow)GFXDDbi.Select(statement, QueryTypes.DATAROW);
            }

            if (row == null)
            {
                return(null);
            }

            return(new Address(row));
        }
Beispiel #4
0
        public OrderDetail Select(long orderId, long productId)
        {
            String statement = QualifyTableName(DbDefault.GetSelectStatement(
                                                    TableName.ORDERDETAIL, new long[] { orderId, productId }));

            DataRow row = null;

            if (Connection != null)
            {
                row = (DataRow)GFXDDbi.Select(Connection, statement, QueryTypes.DATAROW);
            }
            else
            {
                row = (DataRow)GFXDDbi.Select(statement, QueryTypes.DATAROW);
            }

            if (row == null)
            {
                return(null);
            }

            return(new OrderDetail(row));
        }
Beispiel #5
0
        public IList <Supplier> Select()
        {
            String    statement = QualifyTableName(DbDefault.GetSelectStatement(TableName.SUPPLIER));
            DataTable table     = null;

            if (Connection != null)
            {
                table = (DataTable)GFXDDbi.Select(Connection, statement, QueryTypes.DATATABLE);
            }
            else
            {
                table = (DataTable)GFXDDbi.Select(statement, QueryTypes.DATATABLE);
            }

            IList <Supplier> suppliers = new List <Supplier>();

            foreach (DataRow row in table.Rows)
            {
                suppliers.Add(new Supplier(row));
            }

            return(suppliers);
        }
Beispiel #6
0
        public Supplier Select(long supplierId)
        {
            String statement = QualifyTableName(DbDefault.GetSelectStatement(
                                                    TableName.SUPPLIER, new long[] { supplierId }));

            DataRow row = null;

            if (Connection != null)
            {
                row = (DataRow)GFXDDbi.Select(Connection, statement, QueryTypes.DATAROW);
            }
            else
            {
                row = (DataRow)GFXDDbi.Select(statement, QueryTypes.DATAROW);
            }

            if (row == null)
            {
                return(null);
            }

            return(new Supplier(row));
        }
        public IList <Product> Select()
        {
            String    statement = QualifyTableName(DbDefault.GetSelectStatement(TableName.PRODUCT));
            DataTable table     = null;

            if (Connection != null)
            {
                table = (DataTable)GFXDDbi.Select(Connection, statement, QueryTypes.DATATABLE);
            }
            else
            {
                table = (DataTable)GFXDDbi.Select(statement, QueryTypes.DATATABLE);
            }

            IList <Product> products = new List <Product>();

            foreach (DataRow row in table.Rows)
            {
                products.Add(new Product(row));
            }

            return(products);
        }
        public Product Select(long productId)
        {
            String statement = QualifyTableName(DbDefault.GetSelectStatement(
                                                    TableName.PRODUCT, new long[] { productId }));

            DataRow row = null;

            if (Connection != null)
            {
                row = (DataRow)GFXDDbi.Select(Connection, statement, QueryTypes.DATAROW);
            }
            else
            {
                row = (DataRow)GFXDDbi.Select(statement, QueryTypes.DATAROW);
            }

            if (row == null)
            {
                return(null);
            }

            return(new Product(row));
        }
Beispiel #9
0
        public IList <Category> Select()
        {
            String    statement = QualifyTableName(DbDefault.GetSelectStatement(TableName.CATEGORY));
            DataTable table     = null;

            if (Connection != null)
            {
                table = (DataTable)GFXDDbi.Select(Connection, statement, QueryTypes.DATATABLE);
            }
            else
            {
                table = (DataTable)GFXDDbi.Select(statement, QueryTypes.DATATABLE);
            }

            IList <Category> categories = new List <Category>();

            foreach (DataRow row in table.Rows)
            {
                categories.Add(new Category(row));
            }

            return(categories);
        }
Beispiel #10
0
        public Category Select(long categoryId)
        {
            String statement = QualifyTableName(DbDefault.GetSelectStatement(
                                                    TableName.CATEGORY, new long[] { categoryId }));

            DataRow row = null;

            if (Connection != null)
            {
                row = (DataRow)GFXDDbi.Select(Connection, statement, QueryTypes.DATAROW);
            }
            else
            {
                row = (DataRow)GFXDDbi.Select(statement, QueryTypes.DATAROW);
            }

            if (row == null)
            {
                return(null);
            }

            return(new Category(row));
        }
Beispiel #11
0
        public IList <Address> Select()
        {
            String statement = QualifyTableName(DbDefault.GetSelectStatement(TableName.ADDRESS));

            DataTable table = null;

            if (Connection != null)
            {
                table = (DataTable)GFXDDbi.Select(Connection, statement, QueryTypes.DATATABLE);
            }
            else
            {
                table = (DataTable)GFXDDbi.Select(statement, QueryTypes.DATATABLE);
            }

            IList <Address> addresses = new List <Address>();

            foreach (DataRow row in table.Rows)
            {
                addresses.Add(new Address(row));
            }

            return(addresses);
        }