Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 13
0
 public Products(LayerGenConnectionString connectionString, Product.ConcurrencyOptions concurrency)
 {
     _concurrency         = concurrency;
     _useStoredProcedures = false;
     _connectionString    = connectionString.ConnectionString;
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 17
0
 public Customers(LayerGenConnectionString connectionString, bool useStoredProcedures)
 {
     _concurrency         = Customer.ConcurrencyOptions.Ignore;
     _useStoredProcedures = useStoredProcedures;
     _connectionString    = connectionString.ConnectionString;
 }
Exemplo n.º 18
0
 public Customers(LayerGenConnectionString connectionString, Customer.ConcurrencyOptions concurrency)
 {
     _concurrency         = concurrency;
     _useStoredProcedures = false;
     _connectionString    = connectionString.ConnectionString;
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 23
0
 public Products(LayerGenConnectionString connectionString, bool useStoredProcedures)
 {
     _concurrency         = Product.ConcurrencyOptions.Ignore;
     _useStoredProcedures = useStoredProcedures;
     _connectionString    = connectionString.ConnectionString;
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }