Beispiel #1
0
        protected void Load(DataRowCollection dataRows)
        {
            Clear();
            LayerGenConnectionString connectString = new LayerGenConnectionString();

            connectString.ConnectionString = _connectionString;

            foreach (DataRow dr in dataRows)
            {
                Add(new Product(connectString, dr, _concurrency, _useStoredProcedures));
            }
        }
        public void GetByProductId(int fkId)
        {
            LayerGenConnectionString connectString = new LayerGenConnectionString();

            connectString.ConnectionString = _connectionString;
            DataTable dt = DataLayer.CustomerProduct.GetByProductId(connectString, fkId);

            if (dt != null)
            {
                Load(dt.Rows);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Retrieves rows from the Product table by executing the given stored procedure.
        /// </summary>
        /// <param name="procedureName">The name of the stored procedure to execute.</param>
        public void GetByStoredProcedure(string procedureName)
        {
            LayerGenConnectionString connectString = new LayerGenConnectionString();

            connectString.ConnectionString = _connectionString;

            DataTable dt = DataLayer.Product.GetByStoredProcedure(connectString, procedureName, null);

            if (dt != null)
            {
                Load(dt.Rows);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Retrieves rows from the Product table, based on the given SQL statement.
        /// </summary>
        /// <param name="sql">The SQL statement to execute.</param>
        /// <param name="sqlParams">Optional <see cref="System.String.Format"/> like parameters</param>
        public void GetBySqlStatement(string sql, params object[] sqlParams)
        {
            LayerGenConnectionString connectString = new LayerGenConnectionString();

            connectString.ConnectionString = _connectionString;

            DataTable dt = DataLayer.Product.GetBySqlStatement(connectString, sql, sqlParams);

            if (dt != null)
            {
                Load(dt.Rows);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Retrieves all the rows from the Product table.
        /// </summary>
        /// <param name="useStoredProcedures">If true, then all data access will be done using stored procedures. Otherwise, data access will be done using Sql text</param>
        private void GetAll(bool useStoredProcedures)
        {
            LayerGenConnectionString connectString = new LayerGenConnectionString();

            connectString.ConnectionString = _connectionString;

            DataTable dt = DataLayer.Product.GetAll(connectString, useStoredProcedures);

            if (dt != null)
            {
                Load(dt.Rows);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Retrieves rows from the Customer table by executing the given stored procedure.
        /// </summary>
        /// <param name="procedureName">The name of the stored procedure to execute.</param>
        /// <param name="procedureParams">A dictionary of parameter/value pairs. This can be null if there are no parameters.</param>
        public void GetByStoredProcedure(string procedureName, Dictionary <string, object> procedureParams)
        {
            LayerGenConnectionString connectString = new LayerGenConnectionString();

            connectString.ConnectionString = _connectionString;

            DataTable dt = DataLayer.Customer.GetByStoredProcedure(connectString, procedureName, procedureParams);

            if (dt != null)
            {
                Load(dt.Rows);
            }
        }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class, loading a
 /// row from the given DataRow and explicitly enabling or disabling the
 /// concurrency option.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="dr">The DataRow that contains the data to be loaded into the instance.</param>
 /// <param name="concurrency">A <see cref="BusinessLayer.Product.ConcurrencyOptions"/> value indicating the level of concurrency.</param>
 protected internal Product(LayerGenConnectionString connectionString, DataRow dr, ConcurrencyOptions concurrency) : base(connectionString, dr, concurrency)
 {
 }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class, loading a
 /// row from the database that matches the given primary key and loading
 /// only the fields specified and explicitly enabling or disabling the
 /// concurrency option. You can also specify if you want data access to be
 /// done with stored procedures or Sql text.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="id">The primary key of the row that gets loaded from the database.</param>
 /// <param name="fields">The list of <see cref="BusinessLayer.Product.Fields"/> to pull from the database.</param>
 /// <param name="concurrency">A <see cref="BusinessLayer.Product.ConcurrencyOptions"/> value indicating the level of concurrency.</param>
 /// <param name="useStoredProcedures">If true, then all data access will be done using stored procedures. Otherwise, data access will be done using Sql text.</param>
 public Product(LayerGenConnectionString connectionString, int id, List <Fields> fields, ConcurrencyOptions concurrency, bool useStoredProcedures) : base(connectionString, id, fields, concurrency, useStoredProcedures)
 {
 }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class, loading a
 /// row from the database that matches the given primary key and loading
 /// only the fields specified and explicitly enabling or disabling the
 /// concurrency option.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="id">The primary key of the row that gets loaded from the database.</param>
 /// <param name="fields">The list of <see cref="BusinessLayer.Product.Fields"/> to pull from the database.</param>
 /// <param name="concurrency">A <see cref="BusinessLayer.Product.ConcurrencyOptions"/> value indicating the level of concurrency.</param>
 public Product(LayerGenConnectionString connectionString, int id, List <Fields> fields, ConcurrencyOptions concurrency) : base(connectionString, id, fields, concurrency)
 {
 }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class, loading a
 /// row from the database that matches the given primary key and explicitly
 /// enabling or disabling the concurrency option.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="id">The primary key of the row that gets loaded from the database.</param>
 /// <param name="concurrency">A <see cref="BusinessLayer.Product.ConcurrencyOptions"/> value indicating the level of concurrency.</param>
 public Product(LayerGenConnectionString connectionString, int id, ConcurrencyOptions concurrency) : base(connectionString, id, concurrency)
 {
 }
Beispiel #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Customer"/> class, loading a
 /// row from the database that matches the given primary key and loading
 /// only the fields specified.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="id">The primary key of the row that gets loaded from the database.</param>
 /// <param name="fields">The list of <see cref="BusinessLayer.Customer.Fields"/> to pull from the database.</param>
 public Customer(LayerGenConnectionString connectionString, int id, List <Fields> fields) : base(connectionString, id, fields)
 {
 }
Beispiel #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Customer"/> class.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 public Customer(LayerGenConnectionString connectionString) : base(connectionString)
 {
 }
Beispiel #13
0
 public Products(LayerGenConnectionString connectionString, Product.ConcurrencyOptions concurrency)
 {
     _concurrency         = concurrency;
     _useStoredProcedures = false;
     _connectionString    = connectionString.ConnectionString;
 }
Beispiel #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class, loading a
 /// row from the database that matches the given primary key and loading
 /// only the fields specified.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="id">The primary key of the row that gets loaded from the database.</param>
 /// <param name="fields">The list of <see cref="BusinessLayer.Product.Fields"/> to pull from the database.</param>
 public Product(LayerGenConnectionString connectionString, int id, List <Fields> fields) : base(connectionString, id, fields)
 {
 }
Beispiel #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Customer"/> class, loading a
 /// row from the database that matches the given primary key.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="id">The primary key of the row that gets loaded from the database.</param>
 public Customer(LayerGenConnectionString connectionString, int id) : base(connectionString, id)
 {
 }
Beispiel #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Customer"/> class,
 /// optionally using stored procedures or Sql text.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="useStoredProcedures">If true, then all data access will be done using stored procedures. Otherwise, data access will be done using Sql text.</param>
 public Customer(LayerGenConnectionString connectionString, bool useStoredProcedures) : base(connectionString, useStoredProcedures)
 {
 }
Beispiel #17
0
 public Customers(LayerGenConnectionString connectionString, bool useStoredProcedures)
 {
     _concurrency         = Customer.ConcurrencyOptions.Ignore;
     _useStoredProcedures = useStoredProcedures;
     _connectionString    = connectionString.ConnectionString;
 }
Beispiel #18
0
 public Customers(LayerGenConnectionString connectionString, Customer.ConcurrencyOptions concurrency)
 {
     _concurrency         = concurrency;
     _useStoredProcedures = false;
     _connectionString    = connectionString.ConnectionString;
 }
Beispiel #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class, loading a
 /// row from the given DataRow and explicitly enabling or disabling the
 /// concurrency option. You can also specify if you want data access to be
 /// done with stored procedures or Sql text.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="dr">The DataRow that contains the data to be loaded into the instance.</param>
 /// <param name="concurrency">A <see cref="BusinessLayer.Product.ConcurrencyOptions"/> value indicating the level of concurrency.</param>
 /// <param name="useStoredProcedures">If true, then all data access will be done using stored procedures. Otherwise, data access will be done using Sql text.</param>
 protected internal Product(LayerGenConnectionString connectionString, DataRow dr, ConcurrencyOptions concurrency, bool useStoredProcedures) : base(connectionString, dr, concurrency, useStoredProcedures)
 {
 }
Beispiel #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Customer"/> class, loading a
 /// row from the database that matches the given primary key and loading
 /// only the fields specified. You can also specify if you want data access
 /// to be done with stored procedures or Sql text.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="id">The primary key of the row that gets loaded from the database.</param>
 /// <param name="fields">The list of <see cref="BusinessLayer.Customer.Fields"/> to pull from the database.</param>
 /// <param name="useStoredProcedures">If true, then all data access will be done using stored procedures. Otherwise, data access will be done using Sql text.</param>
 public Customer(LayerGenConnectionString connectionString, int id, List <Fields> fields, bool useStoredProcedures) : base(connectionString, id, fields, useStoredProcedures)
 {
 }
Beispiel #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 public Product(LayerGenConnectionString connectionString) : base(connectionString)
 {
 }
Beispiel #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Customer"/> class, loading a
 /// row from the database that matches the given primary key and explicitly
 /// enabling or disabling the concurrency option.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="id">The primary key of the row that gets loaded from the database.</param>
 /// <param name="concurrency">A <see cref="BusinessLayer.Customer.ConcurrencyOptions"/> value indicating the level of concurrency.</param>
 public Customer(LayerGenConnectionString connectionString, int id, ConcurrencyOptions concurrency) : base(connectionString, id, concurrency)
 {
 }
Beispiel #23
0
 public Products(LayerGenConnectionString connectionString, bool useStoredProcedures)
 {
     _concurrency         = Product.ConcurrencyOptions.Ignore;
     _useStoredProcedures = useStoredProcedures;
     _connectionString    = connectionString.ConnectionString;
 }
Beispiel #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Customer"/> class, loading a
 /// row from the database that matches the given primary key and explicitly
 /// enabling or disabling the concurrency option. You can also specify if you want data
 /// access to be done with stored procedures or Sql text.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="id">The primary key of the row that gets loaded from the database.</param>
 /// <param name="concurrency">A <see cref="BusinessLayer.Customer.ConcurrencyOptions"/> value indicating the level of concurrency.</param>
 /// <param name="useStoredProcedures">If true, then all data access will be done using stored procedures. Otherwise, data access will be done using Sql text.</param>
 public Customer(LayerGenConnectionString connectionString, int id, ConcurrencyOptions concurrency, bool useStoredProcedures) : base(connectionString, id, concurrency, useStoredProcedures)
 {
 }
Beispiel #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class, loading a
 /// row from the given DataRow.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="dr">The DataRow that contains the data to be loaded into the instance.</param>
 protected internal Product(LayerGenConnectionString connectionString, DataRow dr) : base(connectionString, dr)
 {
 }
Beispiel #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Customer"/> class, loading a
 /// row from the given DataRow.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="dr">The DataRow that contains the data to be loaded into the instance.</param>
 protected internal Customer(LayerGenConnectionString connectionString, DataRow dr) : base(connectionString, dr)
 {
 }
Beispiel #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class,
 /// optionally using stored procedures or Sql text.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="useStoredProcedures">If true, then all data access will be done using stored procedures. Otherwise, data access will be done using Sql text.</param>
 public Product(LayerGenConnectionString connectionString, bool useStoredProcedures) : base(connectionString, useStoredProcedures)
 {
 }
Beispiel #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class, loading a
 /// row from the given DataRow. You can also specify if you want data access
 /// to be done with stored procedures or Sql text.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="dr">The DataRow that contains the data to be loaded into the instance.</param>
 /// <param name="useStoredProcedures">If true, then all data access will be done using stored procedures. Otherwise, data access will be done using Sql text.</param>
 protected internal Product(LayerGenConnectionString connectionString, DataRow dr, bool useStoredProcedures) : base(connectionString, dr, useStoredProcedures)
 {
 }
Beispiel #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class, loading a
 /// row from the database that matches the given primary key.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="id">The primary key of the row that gets loaded from the database.</param>
 public Product(LayerGenConnectionString connectionString, int id) : base(connectionString, id)
 {
 }
Beispiel #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class, explicitly enabling
 /// or disabling the concurrency option. You can also specify if you want data access
 /// to be done with stored procedures or Sql text.
 /// </summary>
 /// <param name="connectionString">Sets the connection string to use to connect to the database.</param>
 /// <param name="concurrency">A <see cref="BusinessLayer.Product.ConcurrencyOptions"/> value indicating the level of concurrency.</param>
 /// <param name="useStoredProcedures">If true, then all data access will be done using stored procedures. Otherwise, data access will be done using Sql text.</param>
 public Product(LayerGenConnectionString connectionString, ConcurrencyOptions concurrency, bool useStoredProcedures) : base(connectionString, concurrency, useStoredProcedures)
 {
 }