#region "Using directives"
using System;
using System.Data;
using System.Data.SqlClient;
//using Microsoft.ApplicationBlocks.Data;
using System.Collections;
using System.Diagnostics;
using SmartInstitute;
#endregion
namespace SmartInstitute.DataAccessLayer.SqlClient
{
/// <summary>
/// This class is the base repository for the CRUD operations on the CourseTakenByStudent objects.
/// </summary>
public class CourseTakenByStudentRepositoryBase : ICourseTakenByStudentRepository
{
#region "Declarations"
/// <summary>
/// Connection String.
/// </summary>
protected string connectionString = string.Empty;
/// <summary>
/// <see cref="TransactionManager"/> object.
/// </summary>
protected TransactionManager transactionManager;
private static volatile CourseTakenByStudentRepositoryBase current;
private static object syncRoot = new Object();
#endregion "Declarations"
#region "Constructors"
/// <summary>
/// Creates a new <see cref="CourseTakenByStudentRepositoryBase"/> instance.
/// Uses connection string to connect to datasource.
/// </summary>
/// <param name="connectionString">Connection string.</param>
protected CourseTakenByStudentRepositoryBase(string connectionString)
{
this.connectionString = connectionString;
}
/// <summary>
/// Creates a new <see cref="CourseTakenByStudentRepositoryBase"/> instance.
/// Uses connection string to connect to datasource.
/// If a transaction is open, it will use the transaction, otherwise it will use the connection string from the transaction manager object.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object.</param>
protected CourseTakenByStudentRepositoryBase(TransactionManager transactionManager)
{
this.transactionManager = transactionManager;
this.connectionString = this.transactionManager.ConnectionString;
}
#endregion "Constructors"
#region Public properties
///<summary>
/// The current CourseTakenByStudentRepositoryBase instance.
///</summary>
///<value></value>
public static CourseTakenByStudentRepositoryBase Current
{
get
{
if (current == null)
{
lock (syncRoot)
{
if (current == null)
{
current = new CourseTakenByStudentRepositoryBase(string.Empty);
}
}
}
return current;
}
}
///<summary>
/// Gets or sets the connectionstring to the database.
///</summary>
///<value></value>
public string ConnectionString
{
get {return this.connectionString;}
set {this.connectionString = value;}
}
///<summary>
/// Gets or sets the TransactionManager instance.
///</summary>
///<value></value>
public TransactionManager TransactionManager
{
get {return this.transactionManager;}
set {this.transactionManager = value;}
}
#endregion
#region "Get from Many To Many Relationship Functions"
#endregion
#region "Delete Functions"
/// <summary>
/// Deletes a row from the DataSource.
/// </summary>
/// <param name="ID">. Primary Key.</param>
/// <param name="ChangeStamp">Concurrency Parameter. </param>
/// <returns>Returns true if operation suceeded.</returns>
public bool Delete(System.Int32 ID, DateTime ChangeStamp)
{
if(UseTransaction())
{
return Delete(this.transactionManager, ID, ChangeStamp);
}
else
{
return Delete(this.connectionString, ID, ChangeStamp);
}
}//end Delete
/// <summary>
/// Deletes a row from the DataSource.
/// </summary>
/// <param name="entity">CourseTakenByStudent object containing data.</param>
/// <remarks>Deletes based on primary key(s).</remarks>
/// <returns>Returns true if operation suceeded.</returns>
public bool Delete(CourseTakenByStudent entity)
{
if(UseTransaction())
{
return Delete(this.transactionManager, entity.ID, entity.ChangeStamp);
}
else
{
return Delete(this.connectionString, entity.ID, entity.ChangeStamp);
}
}//end Delete
/// <summary>
/// Deletes rows from the DataSource.
/// </summary>
/// <param name="entityCollection">CourseTakenByStudentCollection containing data.</param>
/// <remarks>Deletes CourseTakenByStudents only when IsDeleted equals true.</remarks>
/// <returns>Returns the number of successful delete.</returns>
public int Delete(CourseTakenByStudentCollection entityCollection)
{
if(UseTransaction())
return Delete(this.transactionManager, entityCollection);
else
return Delete(this.connectionString, entityCollection);
}
/// <summary>
/// Deletes a rows from the DataSource.
/// </summary>
/// <param name="entityCollection">CourseTakenByStudentCollection containing data.</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks>Deletes CourseTakenByStudents only when IsDeleted equals true.</remarks>
/// <returns>Returns the number of successful delete.</returns>
public int Delete(string connectionString, CourseTakenByStudentCollection entityCollection)
{
int number = 0;
foreach (CourseTakenByStudent entity in entityCollection)
{
if ( Delete(connectionString, entity) )
{
number++;
}
}
return number;
}
/// <summary>
/// Deletes a rows from the DataSource.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entityCollection">CourseTakenByStudentCollection containing data.</param>
/// <remarks>Deletes CourseTakenByStudents only when IsDeleted equals true.</remarks>
/// <returns>Returns the number of successful delete.</returns>
public int Delete(TransactionManager transactionManager, CourseTakenByStudentCollection entityCollection)
{
int number = 0;
foreach (CourseTakenByStudent entity in entityCollection)
{
if ( Delete(transactionManager, entity) )
{
number++;
}
}
return number;
}
/// <summary>
/// Deletes a row from the DataSource.
/// </summary>
/// <param name="entity">CourseTakenByStudent object containing data.</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks>Deletes based on primary key(s).</remarks>
/// <returns>Returns true if operation suceeded.</returns>
public bool Delete(string connectionString, CourseTakenByStudent entity)
{
return Delete(null, connectionString,entity.ID, entity.ChangeStamp);
}
/// <summary>
/// Deletes a row from the DataSource.
/// </summary>
/// <param name="ID">. Primary Key.</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <param name="ChangeStamp">Concurrency Parameter. </param>
/// <remarks>Deletes based on primary key(s).</remarks>
/// <returns>Returns true if operation suceeded.</returns>
public bool Delete(string connectionString, System.Int32 ID, DateTime ChangeStamp)
{
return Delete(null, connectionString,ID, ChangeStamp);
}
/// <summary>
/// Deletes a row from the DataSource.
/// </summary>
/// <param name="entity">CourseTakenByStudent object containing data.</param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks>Deletes based on primary key(s).</remarks>
/// <returns>Returns true if operation suceeded.</returns>
public bool Delete(TransactionManager transactionManager, CourseTakenByStudent entity)
{
if (transactionManager.IsOpen)
return Delete(transactionManager, null, entity.ID, entity.ChangeStamp);
else
return Delete(null, transactionManager.ConnectionString, entity.ID, entity.ChangeStamp);
}
/// <summary>
/// Deletes a row from the DataSource.
/// </summary>
/// <param name="ID">. Primary Key.</param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="ChangeStamp">Concurrency Parameter. </param>
/// <remarks>Deletes based on primary key(s).</remarks>
/// <returns>Returns true if operation suceeded.</returns>
public bool Delete(TransactionManager transactionManager, System.Int32 ID, DateTime ChangeStamp)
{
if (transactionManager.IsOpen)
return Delete(transactionManager, null, ID, ChangeStamp);
else
return Delete(null, transactionManager.ConnectionString, ID, ChangeStamp);
}
/// <summary>
/// Deletes a row from the DataSource.
/// </summary>
/// <param name="ID">. Primary Key.</param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks>Deletes based on primary key(s).</remarks>
/// <returns>Returns true if operation suceeded.</returns>
protected bool Delete(TransactionManager transactionManager, string connectionString, System.Int32 ID, DateTime ChangeStamp)
{
int result = 0;
if (transactionManager != null)
result = SqlHelper.ExecuteNonQuery(transactionManager.TransactionObject, "prc_CourseTakenByStudent_Delete", ID, ChangeStamp);
else
result = SqlHelper.ExecuteNonQuery(connectionString, "prc_CourseTakenByStudent_Delete", ID, ChangeStamp);
Debug.WriteLine("CourseTakenByStudentRepository.Delete Affected " + result + " records.");
if (result == 0) {
ThrowDeleteConcurrencyException( ID, ChangeStamp);
}
return Convert.ToBoolean(result);
}//end Delete
/// <summary>
/// Throws the delete concurrency exception.
/// </summary>
/// <param name="ID">. Primary Key.</param>
protected void ThrowDeleteConcurrencyException(System.Int32 ID, DateTime ChangeStamp)
{
DBConcurrencyException conflict = new DBConcurrencyException("Concurrency exception: Cannot delete entity as it does not exist.");
//conflict.ModifiedRecord = entity;
throw conflict;
}
#endregion
#region "GetList Functions"
/// <summary>
/// Gets All rows from the DataSource.
/// </summary>
/// <remarks>Uses connection string object was created with.</remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetAll()
{
if(UseTransaction())
{
return GetAll(this.transactionManager);
}
else
{
return GetAll(this.connectionString);
}
}
/// <summary>
/// Gets All rows from the DataSource.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <remarks>Uses connection string object was created with.</remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetAll(int start, int pagelen)
{
if(UseTransaction())
{
return GetAll(this.transactionManager, start, pagelen);
}
else
{
return GetAll(this.connectionString, start, pagelen);
}
}
/// <summary>
/// Gets All rows from the DataSource.
/// </summary>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetAll(string connectionString)
{
return GetAll(null, connectionString,0,int.MaxValue);
}
/// <summary>
/// Gets All rows from the DataSource.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetAll(string connectionString, int start, int pagelen)
{
return GetAll(null, connectionString, start, pagelen);
}//end getall
/// <summary>
/// Gets All rows from the DataSource.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetAll(TransactionManager transactionManager)
{
if (transactionManager.IsOpen)
return GetAll(transactionManager, null, 0,int.MaxValue);
else
return GetAll(null, transactionManager.ConnectionString, 0,int.MaxValue);
}
/// <summary>
/// Gets All rows from the DataSource.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetAll(TransactionManager transactionManager, int start, int pagelen)
{
if (transactionManager.IsOpen)
return GetAll(transactionManager, null, start, pagelen);
else
return GetAll(null, transactionManager.ConnectionString, start, pagelen);
}//end getall
/// <summary>
/// Gets All rows from the DataSource.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
protected CourseTakenByStudentCollection GetAll(TransactionManager transactionManager, string connectionString, int start, int pagelen)
{
//Declare Varibles
SqlDataReader reader;
if (transactionManager != null)
reader = SqlHelper.ExecuteReader(transactionManager.TransactionObject, "prc_CourseTakenByStudent_Get_List");
else
reader = SqlHelper.ExecuteReader(connectionString, "prc_CourseTakenByStudent_Get_List");
//Create Collection
CourseTakenByStudentCollection rows = new CourseTakenByStudentCollection();
Fill(reader, rows, start, pagelen);
reader.Close();
return rows;
}//end getall
#endregion
#region Paged Recordset
/// <summary>
/// Gets a page of rows from the DataSource.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="count">Number of rows in the DataSource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetPaged(int start, int pagelen, out int count)
{
if(UseTransaction())
{
return GetPaged(this.transactionManager, start, pagelen, out count);
}
else
{
return GetPaged(this.connectionString, start, pagelen, out count);
}
}
/// <summary>
/// Gets a page of rows from the DataSource.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="count">Number of rows in the DataSource.</param>
/// <param name="whereClause">Specifies the condition for the rows returned by a query (Name='John Doe', Name='John Doe' AND Id='1', Name='John Doe' OR Id='1').</param>
/// <param name="orderBy">Specifies the sort criteria for the rows in the DataSource (Name ASC; BirthDay DESC, Name ASC);</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetPaged(string whereClause, string orderBy, int start, int pagelen, out int count)
{
if(UseTransaction())
{
return GetPaged(this.transactionManager, whereClause, orderBy, start, pagelen, out count);
}
else
{
return GetPaged(this.connectionString, whereClause, orderBy, start, pagelen, out count);
}
}
/// <summary>
/// Gets a page of rows from the DataSource.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="count">Number of rows in the DataSource.</param>
/// <param name="connectionString">The connection string to the datasource</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetPaged(string connectionString, int start, int pagelen, out int count)
{
return GetPaged(null, connectionString, null, null, start, pagelen, out count);
}
/// <summary>
/// Gets a page of rows from the DataSource.
/// </summary>
/// <param name="whereClause">Specifies the condition for the rows returned by a query (Name='John Doe', Name='John Doe' AND Id='1', Name='John Doe' OR Id='1').</param>
/// <param name="orderBy">Specifies the sort criteria for the rows in the DataSource (Name ASC; BirthDay DESC, Name ASC);</param>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="count">Number of rows in the DataSource.</param>
/// <param name="connectionString">The connection string to the datasource</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetPaged(string connectionString, string whereClause, string orderBy, int start, int pagelen, out int count)
{
return GetPaged(null, connectionString, whereClause, orderBy, start, pagelen, out count);
}
/// <summary>
/// Gets a page of rows from the DataSource.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="count">Number of rows in the DataSource.</param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetPaged(TransactionManager transactionManager, int start, int pagelen, out int count)
{
if (transactionManager.IsOpen)
return GetPaged(transactionManager, null, null, null, start, pagelen, out count);
else
return GetPaged(null, transactionManager.ConnectionString, null, null, start, pagelen, out count);
}
/// <summary>
/// Gets a page of rows from the DataSource.
/// </summary>
/// <param name="whereClause">Specifies the condition for the rows returned by a query (Name='John Doe', Name='John Doe' AND Id='1', Name='John Doe' OR Id='1').</param>
/// <param name="orderBy">Specifies the sort criteria for the rows in the DataSource (Name ASC; BirthDay DESC, Name ASC);</param>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="count">Number of rows in the DataSource.</param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetPaged(TransactionManager transactionManager, string whereClause, string orderBy, int start, int pagelen, out int count)
{
if (transactionManager.IsOpen)
return GetPaged(transactionManager, null, whereClause, orderBy, start, pagelen, out count);
else
return GetPaged(null, transactionManager.ConnectionString, whereClause, orderBy, start, pagelen, out count);
}
/// <summary>
/// Gets a page of rows from the DataSource.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="count">Number of rows in the DataSource.</param>
/// <param name="whereClause">Specifies the condition for the rows returned by a query (Name='John Doe', Name='John Doe' AND Id='1', Name='John Doe' OR Id='1').</param>
/// <param name="orderBy">Specifies the sort criteria for the rows in the DataSource (Name ASC; BirthDay DESC, Name ASC);</param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
protected CourseTakenByStudentCollection GetPaged(TransactionManager transactionManager, string connectionString, string whereClause, string orderBy, int start, int pagelen, out int count)
{
//Declare Varibles
SqlDataReader reader;
if (transactionManager != null)
reader = SqlHelper.ExecuteReader(transactionManager.TransactionObject, "prc_CourseTakenByStudent_GetPaged", whereClause, orderBy, start, pagelen);
else
reader = SqlHelper.ExecuteReader(connectionString, "prc_CourseTakenByStudent_GetPaged", whereClause, orderBy, start, pagelen);
reader.Read();
count = reader.GetInt32(0);
reader.NextResult();
//Create Collection
CourseTakenByStudentCollection rows = new CourseTakenByStudentCollection();
Fill(reader, rows, 0, int.MaxValue);
reader.Close();
return rows;
}
#endregion
#region "Get By Foreign Key Functions"
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Course key.
/// FK_CourseTakenByStudent_Course Description:
/// </summary>
/// <param name="CourseID"></param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByCourseID(System.Int32 CourseID)
{
if(UseTransaction())
{
return GetByCourseID(this.transactionManager, CourseID, 0, int.MaxValue);;
}
else
{
return GetByCourseID(this.connectionString, CourseID, 0, int.MaxValue);
}
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Course key.
/// FK_CourseTakenByStudent_Course Description:
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="CourseID"></param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByCourseID(System.Int32 CourseID, int start, int pagelen)
{
if(UseTransaction())
{
return GetByCourseID(this.transactionManager, CourseID, start, pagelen);
}
else
{
return GetByCourseID(this.connectionString, CourseID, start, pagelen);
}
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Course key.
/// FK_CourseTakenByStudent_Course Description:
/// </summary>
/// <param name="CourseID"></param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByCourseID(string connectionString, System.Int32 CourseID)
{
return GetByCourseID(null, connectionString, CourseID, 0,int.MaxValue);
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Course key.
/// FK_CourseTakenByStudent_Course Description:
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="CourseID"></param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByCourseID(string connectionString, System.Int32 CourseID, int start, int pagelen)
{
return GetByCourseID(null, connectionString, CourseID, start, pagelen);
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Course key.
/// FK_CourseTakenByStudent_Course Description:
/// </summary>
/// <param name="CourseID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByCourseID(TransactionManager transactionManager, System.Int32 CourseID)
{
if (transactionManager.IsOpen)
return GetByCourseID(transactionManager, null, CourseID, 0,int.MaxValue);
else
return GetByCourseID(null, transactionManager.ConnectionString, CourseID, 0,int.MaxValue);
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Course key.
/// FK_CourseTakenByStudent_Course Description:
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="CourseID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByCourseID(TransactionManager transactionManager, System.Int32 CourseID, int start, int pagelen)
{
if (transactionManager.IsOpen)
return GetByCourseID(transactionManager, null, CourseID, start, pagelen);
else
return GetByCourseID(null, transactionManager.ConnectionString, CourseID, start, pagelen);
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Course key.
/// FK_CourseTakenByStudent_Course Description:
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="CourseID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
protected CourseTakenByStudentCollection GetByCourseID(TransactionManager transactionManager, string connectionString, System.Int32 CourseID, int start, int pagelen)
{
//Declare varibles
SqlDataReader reader;
if (transactionManager != null)
reader = SqlHelper.ExecuteReader(transactionManager.TransactionObject, "prc_CourseTakenByStudent_GetByCourseID", CourseID);
else
reader = SqlHelper.ExecuteReader(connectionString, "prc_CourseTakenByStudent_GetByCourseID", CourseID);
//Create Collection
CourseTakenByStudentCollection rows = new CourseTakenByStudentCollection();
Fill(reader, rows, start, pagelen);
reader.Close();
return rows;
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Section key.
/// FK_CourseTakenByStudent_Section Description:
/// </summary>
/// <param name="SectionID"></param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetBySectionID(System.Int32 SectionID)
{
if(UseTransaction())
{
return GetBySectionID(this.transactionManager, SectionID, 0, int.MaxValue);;
}
else
{
return GetBySectionID(this.connectionString, SectionID, 0, int.MaxValue);
}
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Section key.
/// FK_CourseTakenByStudent_Section Description:
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="SectionID"></param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetBySectionID(System.Int32 SectionID, int start, int pagelen)
{
if(UseTransaction())
{
return GetBySectionID(this.transactionManager, SectionID, start, pagelen);
}
else
{
return GetBySectionID(this.connectionString, SectionID, start, pagelen);
}
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Section key.
/// FK_CourseTakenByStudent_Section Description:
/// </summary>
/// <param name="SectionID"></param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetBySectionID(string connectionString, System.Int32 SectionID)
{
return GetBySectionID(null, connectionString, SectionID, 0,int.MaxValue);
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Section key.
/// FK_CourseTakenByStudent_Section Description:
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="SectionID"></param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetBySectionID(string connectionString, System.Int32 SectionID, int start, int pagelen)
{
return GetBySectionID(null, connectionString, SectionID, start, pagelen);
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Section key.
/// FK_CourseTakenByStudent_Section Description:
/// </summary>
/// <param name="SectionID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetBySectionID(TransactionManager transactionManager, System.Int32 SectionID)
{
if (transactionManager.IsOpen)
return GetBySectionID(transactionManager, null, SectionID, 0,int.MaxValue);
else
return GetBySectionID(null, transactionManager.ConnectionString, SectionID, 0,int.MaxValue);
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Section key.
/// FK_CourseTakenByStudent_Section Description:
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="SectionID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetBySectionID(TransactionManager transactionManager, System.Int32 SectionID, int start, int pagelen)
{
if (transactionManager.IsOpen)
return GetBySectionID(transactionManager, null, SectionID, start, pagelen);
else
return GetBySectionID(null, transactionManager.ConnectionString, SectionID, start, pagelen);
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Section key.
/// FK_CourseTakenByStudent_Section Description:
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="SectionID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
protected CourseTakenByStudentCollection GetBySectionID(TransactionManager transactionManager, string connectionString, System.Int32 SectionID, int start, int pagelen)
{
//Declare varibles
SqlDataReader reader;
if (transactionManager != null)
reader = SqlHelper.ExecuteReader(transactionManager.TransactionObject, "prc_CourseTakenByStudent_GetBySectionID", SectionID);
else
reader = SqlHelper.ExecuteReader(connectionString, "prc_CourseTakenByStudent_GetBySectionID", SectionID);
//Create Collection
CourseTakenByStudentCollection rows = new CourseTakenByStudentCollection();
Fill(reader, rows, start, pagelen);
reader.Close();
return rows;
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Student key.
/// FK_CourseTakenByStudent_Student Description:
/// </summary>
/// <param name="StudentID"></param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByStudentID(System.Int32 StudentID)
{
if(UseTransaction())
{
return GetByStudentID(this.transactionManager, StudentID, 0, int.MaxValue);;
}
else
{
return GetByStudentID(this.connectionString, StudentID, 0, int.MaxValue);
}
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Student key.
/// FK_CourseTakenByStudent_Student Description:
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="StudentID"></param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByStudentID(System.Int32 StudentID, int start, int pagelen)
{
if(UseTransaction())
{
return GetByStudentID(this.transactionManager, StudentID, start, pagelen);
}
else
{
return GetByStudentID(this.connectionString, StudentID, start, pagelen);
}
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Student key.
/// FK_CourseTakenByStudent_Student Description:
/// </summary>
/// <param name="StudentID"></param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByStudentID(string connectionString, System.Int32 StudentID)
{
return GetByStudentID(null, connectionString, StudentID, 0,int.MaxValue);
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Student key.
/// FK_CourseTakenByStudent_Student Description:
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="StudentID"></param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByStudentID(string connectionString, System.Int32 StudentID, int start, int pagelen)
{
return GetByStudentID(null, connectionString, StudentID, start, pagelen);
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Student key.
/// FK_CourseTakenByStudent_Student Description:
/// </summary>
/// <param name="StudentID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByStudentID(TransactionManager transactionManager, System.Int32 StudentID)
{
if (transactionManager.IsOpen)
return GetByStudentID(transactionManager, null, StudentID, 0,int.MaxValue);
else
return GetByStudentID(null, transactionManager.ConnectionString, StudentID, 0,int.MaxValue);
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Student key.
/// FK_CourseTakenByStudent_Student Description:
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="StudentID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByStudentID(TransactionManager transactionManager, System.Int32 StudentID, int start, int pagelen)
{
if (transactionManager.IsOpen)
return GetByStudentID(transactionManager, null, StudentID, start, pagelen);
else
return GetByStudentID(null, transactionManager.ConnectionString, StudentID, start, pagelen);
}
/// <summary>
/// Gets rows from the datasource based on the FK_CourseTakenByStudent_Student key.
/// FK_CourseTakenByStudent_Student Description:
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="StudentID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
protected CourseTakenByStudentCollection GetByStudentID(TransactionManager transactionManager, string connectionString, System.Int32 StudentID, int start, int pagelen)
{
//Declare varibles
SqlDataReader reader;
if (transactionManager != null)
reader = SqlHelper.ExecuteReader(transactionManager.TransactionObject, "prc_CourseTakenByStudent_GetByStudentID", StudentID);
else
reader = SqlHelper.ExecuteReader(connectionString, "prc_CourseTakenByStudent_GetByStudentID", StudentID);
//Create Collection
CourseTakenByStudentCollection rows = new CourseTakenByStudentCollection();
Fill(reader, rows, start, pagelen);
reader.Close();
return rows;
}
#endregion
#region "Get By Index Functions"
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_2 index.
/// </summary>
/// <param name="SectionID"></param>
/// <param name="StudentID"></param>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetBySectionIDStudentID(System.Int32 SectionID, System.Int32 StudentID)
{
if(UseTransaction())
{
return GetBySectionIDStudentID(this.transactionManager, SectionID, StudentID, 0, int.MaxValue);
}
else
{
return GetBySectionIDStudentID(this.connectionString, SectionID, StudentID, 0, int.MaxValue);
}
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_2 index.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="SectionID"></param>
/// <param name="StudentID"></param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetBySectionIDStudentID(System.Int32 SectionID, System.Int32 StudentID, int start, int pagelen)
{
if(UseTransaction())
{
return GetBySectionIDStudentID(this.transactionManager, SectionID, StudentID, start, pagelen);
}
else
{
return GetBySectionIDStudentID(this.connectionString, SectionID, StudentID, start, pagelen);
}
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_2 index.
/// </summary>
/// <param name="SectionID"></param>
/// <param name="StudentID"></param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetBySectionIDStudentID(string connectionString, System.Int32 SectionID, System.Int32 StudentID)
{
return GetBySectionIDStudentID(null, connectionString, SectionID, StudentID, 0, int.MaxValue);
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_2 index.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="SectionID"></param>
/// <param name="StudentID"></param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetBySectionIDStudentID(string connectionString, System.Int32 SectionID, System.Int32 StudentID, int start, int pagelen)
{
return GetBySectionIDStudentID(null, connectionString, SectionID, StudentID, start, pagelen);
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_2 index.
/// </summary>
/// <param name="SectionID"></param>
/// <param name="StudentID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetBySectionIDStudentID(TransactionManager transactionManager, System.Int32 SectionID, System.Int32 StudentID)
{
if (transactionManager.IsOpen)
return GetBySectionIDStudentID(transactionManager, null, SectionID, StudentID, 0, int.MaxValue);
else
return GetBySectionIDStudentID(null, transactionManager.ConnectionString, SectionID, StudentID, 0, int.MaxValue);
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_2 index.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="SectionID"></param>
/// <param name="StudentID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetBySectionIDStudentID(TransactionManager transactionManager, System.Int32 SectionID, System.Int32 StudentID, int start, int pagelen)
{
if (transactionManager.IsOpen)
return GetBySectionIDStudentID(transactionManager, null, SectionID, StudentID, start, pagelen);
else
return GetBySectionIDStudentID(null, transactionManager.ConnectionString, SectionID, StudentID, start, pagelen);
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_2 index.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="SectionID"></param>
/// <param name="StudentID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
protected CourseTakenByStudentCollection GetBySectionIDStudentID(TransactionManager transactionManager, string connectionString, System.Int32 SectionID, System.Int32 StudentID, int start, int pagelen)
{
//Declare Varibles
SqlDataReader reader;
if (transactionManager != null)
reader = SqlHelper.ExecuteReader(transactionManager.TransactionObject, "prc_CourseTakenByStudent_GetBySectionIDStudentID", SectionID, StudentID);
else
reader = SqlHelper.ExecuteReader(connectionString, "prc_CourseTakenByStudent_GetBySectionIDStudentID", SectionID, StudentID);
//Create collection and fill
CourseTakenByStudentCollection rows = new CourseTakenByStudentCollection();
Fill(reader, rows, start, pagelen);
reader.Close();
return rows;
}
/// <summary>
/// Gets rows from the datasource based on the PK_CourseTakenByStudent index.
/// </summary>
/// <param name="ID"></param>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByID(System.Int32 ID)
{
if(UseTransaction())
{
return GetByID(this.transactionManager, ID, 0, int.MaxValue);
}
else
{
return GetByID(this.connectionString, ID, 0, int.MaxValue);
}
}
/// <summary>
/// Gets rows from the datasource based on the PK_CourseTakenByStudent index.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="ID"></param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByID(System.Int32 ID, int start, int pagelen)
{
if(UseTransaction())
{
return GetByID(this.transactionManager, ID, start, pagelen);
}
else
{
return GetByID(this.connectionString, ID, start, pagelen);
}
}
/// <summary>
/// Gets rows from the datasource based on the PK_CourseTakenByStudent index.
/// </summary>
/// <param name="ID"></param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByID(string connectionString, System.Int32 ID)
{
return GetByID(null, connectionString, ID, 0, int.MaxValue);
}
/// <summary>
/// Gets rows from the datasource based on the PK_CourseTakenByStudent index.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="ID"></param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByID(string connectionString, System.Int32 ID, int start, int pagelen)
{
return GetByID(null, connectionString, ID, start, pagelen);
}
/// <summary>
/// Gets rows from the datasource based on the PK_CourseTakenByStudent index.
/// </summary>
/// <param name="ID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByID(TransactionManager transactionManager, System.Int32 ID)
{
if (transactionManager.IsOpen)
return GetByID(transactionManager, null, ID, 0, int.MaxValue);
else
return GetByID(null, transactionManager.ConnectionString, ID, 0, int.MaxValue);
}
/// <summary>
/// Gets rows from the datasource based on the PK_CourseTakenByStudent index.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="ID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByID(TransactionManager transactionManager, System.Int32 ID, int start, int pagelen)
{
if (transactionManager.IsOpen)
return GetByID(transactionManager, null, ID, start, pagelen);
else
return GetByID(null, transactionManager.ConnectionString, ID, start, pagelen);
}
/// <summary>
/// Gets rows from the datasource based on the PK_CourseTakenByStudent index.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="ID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
protected CourseTakenByStudentCollection GetByID(TransactionManager transactionManager, string connectionString, System.Int32 ID, int start, int pagelen)
{
//Declare Varibles
SqlDataReader reader;
if (transactionManager != null)
reader = SqlHelper.ExecuteReader(transactionManager.TransactionObject, "prc_CourseTakenByStudent_GetByID", ID);
else
reader = SqlHelper.ExecuteReader(connectionString, "prc_CourseTakenByStudent_GetByID", ID);
//Create collection and fill
CourseTakenByStudentCollection rows = new CourseTakenByStudentCollection();
Fill(reader, rows, start, pagelen);
reader.Close();
return rows;
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_1 index.
/// </summary>
/// <param name="StudentID"></param>
/// <param name="CourseID"></param>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByStudentIDCourseID(System.Int32 StudentID, System.Int32 CourseID)
{
if(UseTransaction())
{
return GetByStudentIDCourseID(this.transactionManager, StudentID, CourseID, 0, int.MaxValue);
}
else
{
return GetByStudentIDCourseID(this.connectionString, StudentID, CourseID, 0, int.MaxValue);
}
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_1 index.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="StudentID"></param>
/// <param name="CourseID"></param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByStudentIDCourseID(System.Int32 StudentID, System.Int32 CourseID, int start, int pagelen)
{
if(UseTransaction())
{
return GetByStudentIDCourseID(this.transactionManager, StudentID, CourseID, start, pagelen);
}
else
{
return GetByStudentIDCourseID(this.connectionString, StudentID, CourseID, start, pagelen);
}
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_1 index.
/// </summary>
/// <param name="StudentID"></param>
/// <param name="CourseID"></param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByStudentIDCourseID(string connectionString, System.Int32 StudentID, System.Int32 CourseID)
{
return GetByStudentIDCourseID(null, connectionString, StudentID, CourseID, 0, int.MaxValue);
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_1 index.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="StudentID"></param>
/// <param name="CourseID"></param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByStudentIDCourseID(string connectionString, System.Int32 StudentID, System.Int32 CourseID, int start, int pagelen)
{
return GetByStudentIDCourseID(null, connectionString, StudentID, CourseID, start, pagelen);
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_1 index.
/// </summary>
/// <param name="StudentID"></param>
/// <param name="CourseID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByStudentIDCourseID(TransactionManager transactionManager, System.Int32 StudentID, System.Int32 CourseID)
{
if (transactionManager.IsOpen)
return GetByStudentIDCourseID(transactionManager, null, StudentID, CourseID, 0, int.MaxValue);
else
return GetByStudentIDCourseID(null, transactionManager.ConnectionString, StudentID, CourseID, 0, int.MaxValue);
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_1 index.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="StudentID"></param>
/// <param name="CourseID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
public CourseTakenByStudentCollection GetByStudentIDCourseID(TransactionManager transactionManager, System.Int32 StudentID, System.Int32 CourseID, int start, int pagelen)
{
if (transactionManager.IsOpen)
return GetByStudentIDCourseID(transactionManager, null, StudentID, CourseID, start, pagelen);
else
return GetByStudentIDCourseID(null, transactionManager.ConnectionString, StudentID, CourseID, start, pagelen);
}
/// <summary>
/// Gets rows from the datasource based on the IX_CourseTakenByStudent_1 index.
/// </summary>
/// <param name="start">Row number at which to start reading.</param>
/// <param name="pagelen">Number of rows to return.</param>
/// <param name="StudentID"></param>
/// <param name="CourseID"></param>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <remarks></remarks>
/// <returns>Returns a typed collection of CourseTakenByStudent objects.</returns>
protected CourseTakenByStudentCollection GetByStudentIDCourseID(TransactionManager transactionManager, string connectionString, System.Int32 StudentID, System.Int32 CourseID, int start, int pagelen)
{
//Declare Varibles
SqlDataReader reader;
if (transactionManager != null)
reader = SqlHelper.ExecuteReader(transactionManager.TransactionObject, "prc_CourseTakenByStudent_GetByStudentIDCourseID", StudentID, CourseID);
else
reader = SqlHelper.ExecuteReader(connectionString, "prc_CourseTakenByStudent_GetByStudentIDCourseID", StudentID, CourseID);
//Create collection and fill
CourseTakenByStudentCollection rows = new CourseTakenByStudentCollection();
Fill(reader, rows, start, pagelen);
reader.Close();
return rows;
}
#endregion "Get By Index Functions"
#region "Insert Functions"
/// <summary>
/// Inserts a CourseTakenByStudent object into the datasource.
/// </summary>
/// <param name="entity">CourseTakenByStudent object to insert.</param>
/// <remarks>After inserting into the datasource, the CourseTakenByStudent object will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
public bool Insert(CourseTakenByStudent entity)
{
if(UseTransaction())
{
return Insert(this.transactionManager, entity);
}
else
{
return Insert(this.connectionString, entity);
}
}
/// <summary>
/// Insert rows in the datasource.
/// </summary>
/// <param name="entityCollection"><c>CourseTakenByStudent</c> objects in a <c>CourseTakenByStudentCollection</c> object to insert.</param>
/// <remarks>
/// This function will only insert entity objects marked as dirty
/// and have an identity field equal to zero.
/// Upon inserting the objects, each dirty object will have the public
/// method <c>Object.AcceptChanges()</c> called to make it clean.
/// After inserting into the datasource, the <c>CourseTakenByStudent</c> objects will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns the number of successful insert.</returns>
public int Insert(CourseTakenByStudentCollection entityCollection)
{
if(UseTransaction())
{
return Insert(this.transactionManager, entityCollection);
}
else
{
return Insert(this.connectionString, entityCollection);
}
}
/// <summary>
/// Insert rows in the datasource.
/// </summary>
/// <param name="connectionString">Connection string to datasource.</param>
/// <param name="entityCollection"><c>CourseTakenByStudent</c> objects in a <c>CourseTakenByStudentCollection</c> object to insert.</param>
/// <remarks>
/// This function will only insert entity objects marked as dirty
/// and have an identity field equal to zero.
/// Upon inserting the objects, each dirty object will have the public
/// method <c>Object.AcceptChanges()</c> called to make it clean.
/// After inserting into the datasource, the <c>CourseTakenByStudent</c> objects will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns the number of successful insert.</returns>
public int Insert(string connectionString, CourseTakenByStudentCollection entityCollection)
{
int number = 0;
foreach (CourseTakenByStudent entity in entityCollection)
{
if (entity.IsNew)
{
if (Insert(connectionString, entity) )
{
number++;
}
}
}
return number;
}
/// <summary>
/// Insert rows in the datasource.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entityCollection"><c>CourseTakenByStudent</c> objects in a <c>CourseTakenByStudentCollection</c> object to insert.</param>
/// <remarks>
/// This function will only insert entity objects marked as dirty
/// and have an identity field equal to zero.
/// Upon inserting the objects, each dirty object will have the public
/// method <c>Object.AcceptChanges()</c> called to make it clean.
/// After inserting into the datasource, the <c>CourseTakenByStudent</c> objects will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns the number of successful insert.</returns>
public int Insert(TransactionManager transactionManager, CourseTakenByStudentCollection entityCollection)
{
int number = 0;
foreach (CourseTakenByStudent entity in entityCollection)
{
if (entity.IsNew)
{
if (Insert(transactionManager, entity) )
{
number++;
}
}
}
return number;
}
/// <summary>
/// Inserts a CourseTakenByStudent object into the datasource.
/// </summary>
/// <param name="connectionString">Connection string to datasource.</param>
/// <param name="entity">CourseTakenByStudent object to insert.</param>
/// <remarks>After inserting into the datasource, the CourseTakenByStudent object will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
public bool Insert(string connectionString, CourseTakenByStudent entity)
{
return Insert(null, connectionString, entity);
}
/// <summary>
/// Inserts a CourseTakenByStudent object into the datasource using a transaction.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entity">CourseTakenByStudent object to insert.</param>
/// <remarks>After inserting into the datasource, the CourseTakenByStudent object will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
public bool Insert(TransactionManager transactionManager, CourseTakenByStudent entity)
{
if (transactionManager.IsOpen)
return Insert(transactionManager, null, entity);
else
return Insert(null, transactionManager.ConnectionString, entity);
}
/// <summary>
/// Inserts a CourseTakenByStudent object into the datasource using a transaction.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <param name="entity">CourseTakenByStudent object to insert.</param>
/// <remarks>After inserting into the datasource, the CourseTakenByStudent object will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
protected bool Insert(TransactionManager transactionManager, string connectionString, CourseTakenByStudent entity)
{
//Declare variables
//IDataParameterCollection parameters;
SqlDataReader reader;
int result = 0;
//Get Parameters
//if (transactionManager != null)
// parameters = SqlHelperParameterCache.GetSpParameterSet(transactionManager.ConnectionString, "prc_CourseTakenByStudent_Insert");
//else
// parameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, "prc_CourseTakenByStudent_Insert");
//Assign values to parameters
//AssignInsertParameters(parameters, entity);
if (transactionManager != null)
reader = SqlHelper.ExecuteReader(transactionManager.TransactionObject, "prc_CourseTakenByStudent_Insert",
entity.ChangeStamp,entity.CourseID,entity.NonCredit,entity.SectionID,entity.Status,entity.StudentID);
else
reader = SqlHelper.ExecuteReader(connectionString, "prc_CourseTakenByStudent_Insert",
entity.ChangeStamp,entity.CourseID,entity.NonCredit,entity.SectionID,entity.Status,entity.StudentID );
Debug.WriteLine("CourseTakenByStudentRepository-Insert Affected " + reader.RecordsAffected + " records.");
if (reader.RecordsAffected > 0)
{
//RefreshEntity closes the connection
RefreshEntity(reader, entity);
result = 1;
}
else
{
//must always close the connection
reader.Close();
}
return Convert.ToBoolean(result);
}
/// <summary>
/// Assigns the insert parameters from the CourseTakenByStudent instance to the SqlParameter array.
/// </summary>
/// <param name="parameters">The <see cref="SqlParameter"/> array to fill.</param>
/// <param name="entity">The <see cref="CourseTakenByStudent"/> instance to read from.</param>
/* protected void AssignInsertParameters(IDataParameterCollection paramCollection, CourseTakenByStudent entity)
{
SqlParameter[] parameters = new SqlParameter[ paramCollection.Count ];
paramCollection.CopyTo( parameters, 0 );
parameters[0].Value = entity.ChangeStamp;
parameters[1].Value = entity.CourseID;
parameters[2].Value = entity.NonCredit;
parameters[3].Value = entity.SectionID;
parameters[4].Value = entity.Status;
parameters[5].Value = entity.StudentID;
} */
#endregion
#region "Update Functions"
/// <summary>
/// Update an existing row in the datasource.
/// </summary>
/// <param name="entity">The <see cref="CourseTakenByStudent"/> instance to update.</param>
/// <remarks>After updating the datasource, the CourseTakenByStudent object will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
public bool Update(CourseTakenByStudent entity)
{
if(UseTransaction())
{
return Update(this.transactionManager, entity);
}
else
{
return Update(this.connectionString, entity);
}
}
/// <summary>
/// Update existing rows in the datasource.
/// </summary>
/// <param name="entityCollection"><c>CourseTakenByStudent</c> objects in a <c>CourseTakenByStudentCollection</c> object to update.</param>
/// <remarks>
/// This function will only update entity objects marked as dirty
/// and do not have an primary key value of 0.
/// Upon updating the objects, each dirty object will have the public
/// method <c>Object.AcceptChanges()</c> called to make it clean.
/// After updating the datasource, the <c>CourseTakenByStudent</c> objects will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns the number of successful update .</returns>
public int Update(CourseTakenByStudentCollection entityCollection)
{
if(UseTransaction())
{
return Update(this.transactionManager, entityCollection);
}
else
{
return Update(this.connectionString, entityCollection);
}
}
/// <summary>
/// Update existing rows in the datasource.
/// </summary>
/// <param name="connectionString">Connection string to datasource.</param>
/// <param name="entityCollection"><c>CourseTakenByStudent</c> objects in a <c>CourseTakenByStudentCollection</c> object to update.</param>
/// <remarks>
/// This function will only update entity objects marked as dirty
/// and do not have an primary key value of 0.
/// Upon updating the objects, each dirty object will have the public
/// method <c>Object.AcceptChanges()</c> called to make it clean.
/// After updating the datasource, the <c>CourseTakenByStudent</c> objects will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns the number of successful update .</returns>
public int Update(string connectionString, CourseTakenByStudentCollection entityCollection)
{
int number = 0;
foreach (CourseTakenByStudent entity in entityCollection)
{
if ((entity.IsDirty) && !(entity.IsNew))
{
if ( Update(connectionString, entity) )
{
number++;
}
}
}
return number;
}
/// <summary>
/// Update existing rows in the datasource.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entityCollection"><c>CourseTakenByStudent</c> objects in a <c>CourseTakenByStudentCollection</c> object to update.</param>
/// <remarks>
/// This function will only update entity objects marked as dirty
/// and do not have an primary key value of 0.
/// Upon updating the objects, each dirty object will have the public
/// method <c>Object.AcceptChanges()</c> called to make it clean.
/// After updating the datasource, the <c>CourseTakenByStudent</c> objects will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns the number of successful update .</returns>
public int Update(TransactionManager transactionManager, CourseTakenByStudentCollection entityCollection)
{
int number = 0;
foreach (CourseTakenByStudent entity in entityCollection)
{
if ((entity.IsDirty) && !(entity.IsNew))
{
if ( Update(transactionManager, entity) )
{
number++;
}
}
}
return number;
}
/// <summary>
/// Update an existing row in the datasource.
/// </summary>
/// <param name="connectionString">Connection string to datasource.</param>
/// <param name="entity">CourseTakenByStudent object to update.</param>
/// <remarks>After updating the datasource, the CourseTakenByStudent object will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
public bool Update(string connectionString, CourseTakenByStudent entity)
{
return Update(null, connectionString, entity);
}
/// <summary>
/// Update an existing row in the datasource.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entity">CourseTakenByStudent object to update.</param>
/// <remarks>After updating the datasource, the CourseTakenByStudent object will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
public bool Update(TransactionManager transactionManager, CourseTakenByStudent entity)
{
if (transactionManager.IsOpen)
return Update(transactionManager, null, entity);
else
return Update(null, transactionManager.ConnectionString, entity);
}
/// <summary>
/// Update an existing row in the datasource.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="connectionString">Connection string to datasource.</param>
/// <param name="entity">CourseTakenByStudent object to update.</param>
/// <remarks>After updating the datasource, the CourseTakenByStudent object will be updated
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
protected bool Update(TransactionManager transactionManager, string connectionString, CourseTakenByStudent entity)
{
//Declare variables
//IDataParameterCollection parameters;
SqlDataReader reader;
int result = 0;
//Get Parameters
//if (transactionManager != null)
// parameters = SqlHelperParameterCache.GetSpParameterSet(transactionManager.ConnectionString, "prc_CourseTakenByStudent_Update");
//else
// parameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, "prc_CourseTakenByStudent_Update");
//Assign parameters values to corresponding entity values
//AssignUpdateParameters(parameters, entity);
//Get Reader
if (transactionManager != null)
reader = SqlHelper.ExecuteReader(transactionManager.TransactionObject, "prc_CourseTakenByStudent_Update",
entity.ID,entity.ChangeStamp,entity.CourseID,entity.NonCredit,entity.SectionID,entity.Status,entity.StudentID);
else
reader = SqlHelper.ExecuteReader(connectionString, "prc_CourseTakenByStudent_Update",
entity.ID,entity.ChangeStamp,entity.CourseID,entity.NonCredit,entity.SectionID,entity.Status,entity.StudentID);
Debug.WriteLine("CourseTakenByStudentRepository-Update Affected " + reader.RecordsAffected + " records.");
if (reader.RecordsAffected > 0)
{
RefreshEntity(reader, entity);
result = reader.RecordsAffected;
}
else
{
//must always close the connection
reader.Close();
DBConcurrencyException conflict = new DBConcurrencyException("Concurrency exception");
conflict.ModifiedRecord = entity;
CourseTakenByStudentCollection dsrecord;
//Get record from Datasource
if (transactionManager != null)
dsrecord = CourseTakenByStudentRepository.Current.GetByID(this.transactionManager, entity.ID);
else
dsrecord = CourseTakenByStudentRepository.Current.GetByID(connectionString, entity.ID);
if(dsrecord.Count > 0)
conflict.DatasourceRecord = dsrecord[0];
throw conflict;
}
return Convert.ToBoolean(result);
}
/// <summary>
/// Assigns the update parameters from an to a <see cref="CourseTakenByStudent"/> instance to an <see cref="SqlParameter"/> array.
/// </summary>
/// <param name="parameters">The <see cref="SqlParameter"/> array.</param>
/// <param name="entity">The <see cref="CourseTakenByStudent"/> instance.</param>
//protected void AssignUpdateParameters(IDataParameterCollection paramCollection, CourseTakenByStudent entity)
//{
//}
#endregion
#region "Save Functions"
/// <summary>
/// Updates, Inserts rows in the datasource.
/// </summary>
/// <param name="entityCollection"><c>CourseTakenByStudent</c> objects in a <c>CourseTakenByStudentCollection</c> object to update.</param>
/// <remarks>
/// After updating the datasource, the <c>CourseTakenByStudent</c> objects will be updated or inserted
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
public void Save(CourseTakenByStudentCollection entityCollection)
{
if(UseTransaction())
{
Save(this.transactionManager, entityCollection);
}
else
{
Save(this.connectionString, entityCollection);
}
}
/// <summary>
/// Updates, Inserts rows in the datasource.
/// </summary>
/// <param name="connectionString">Connection String to Datasource.</param>
/// <param name="entity">CourseTakenByStudent object to update.</param>
/// <remarks>
/// After updating the datasource, the <c>CourseTakenByStudent</c> objects will be updated or inserted
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
public void Save(string connectionString, CourseTakenByStudent entity)
{
if (entity.IsDeleted)
Delete(connectionString, entity);
else if ((entity.IsDirty) && !(entity.IsNew))
Update(connectionString, entity);
else if (entity.IsNew)
Insert(connectionString, entity);
}
/// <summary>
/// Updates, Inserts rows in the datasource.
/// </summary>
/// <param name="connectionString">Connection String to Datasource.</param>
/// <param name="entityCollection"><c>CourseTakenByStudent</c> objects in a <c>CourseTakenByStudentCollection</c> object to update.</param>
/// <remarks>
/// After updating the datasource, the <c>CourseTakenByStudent</c> objects will be updated or inserted
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
public void Save(string connectionString, CourseTakenByStudentCollection entityCollection)
{
foreach (CourseTakenByStudent entity in entityCollection)
{
Save(connectionString, entity);
}
}
/// <summary>
/// Updates, Inserts rows in the datasource.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entity"><c>CourseTakenByStudent</c> objects in a <c>CourseTakenByStudentCollection</c> object to update.</param>
/// <remarks>
/// After updating the datasource, the <c>CourseTakenByStudent</c> objects will be updated or inserted
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
public void Save(TransactionManager transactionManager, CourseTakenByStudent entity)
{
if (entity.IsDeleted)
{
Delete(transactionManager, entity);
}
if ((entity.IsDirty) && !(entity.IsNew))
{
Update(transactionManager, entity);
}
else if (entity.IsNew)
{
Insert(transactionManager, entity);
}
}
/// <summary>
/// Updates, Inserts rows in the datasource.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entityCollection"><c>CourseTakenByStudent</c> objects in a <c>CourseTakenByStudentCollection</c> object to update.</param>
/// <remarks>
/// After updating the datasource, the <c>CourseTakenByStudent</c> objects will be updated or inserted
/// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
/// <returns>Returns true if operation is successful.</returns>
public void Save(TransactionManager transactionManager, CourseTakenByStudentCollection entityCollection)
{
foreach (CourseTakenByStudent entity in entityCollection)
{
Save(transactionManager, entity);
}
}
#endregion
#region "Helper Functions"
///<summary>
/// Fill an CourseTakenByStudentCollection From a DataSet
///</summary>
/// <param name="dataSet">the DataSet</param>
/// <param name="rows">The collection to fill</param>
/// <param name="start">Start row</param>
/// <param name="pagelen">number of row.</param>
///<returns>A <see chref="CourseTakenByStudentCollection"/> object.</returns>
protected CourseTakenByStudentCollection Fill(DataSet dataSet, CourseTakenByStudentCollection rows, int start, int pagelen)
{
int recordnum = 0;
System.Collections.IEnumerator dataRows = dataSet.Tables[0].Rows.GetEnumerator();
while (dataRows.MoveNext() && (pagelen != 0))
{
if(recordnum >= start)
{
DataRow row = (DataRow)dataRows.Current;
CourseTakenByStudent c = new CourseTakenByStudent();
c.ID = (Convert.IsDBNull(row["ID"]))?(int)0:(System.Int32)row["ID"];
c.StudentID = (Convert.IsDBNull(row["StudentID"]))?(int)0:(System.Int32)row["StudentID"];
c.CourseID = (Convert.IsDBNull(row["CourseID"]))?(int)0:(System.Int32)row["CourseID"];
c.SectionID = (Convert.IsDBNull(row["SectionID"]))?(int)0:(System.Int32)row["SectionID"];
c.Status = (Convert.IsDBNull(row["Status"]))?(int)0:(System.Int32)row["Status"];
c.NonCredit = (Convert.IsDBNull(row["NonCredit"]))?false:(System.Boolean)row["NonCredit"];
c.ChangeStamp = (Convert.IsDBNull(row["ChangeStamp"]))?DateTime.MinValue:(System.DateTime)row["ChangeStamp"];
rows.Add(c);
pagelen -= 1;
}
recordnum += 1;
}
return rows;
}
///<summary>
/// Fill an CourseTakenByStudentCollection From a DataReader.
///</summary>
/// <param name="reader">Datareader</param>
/// <param name="rows">The collection to fill</param>
/// <param name="start">Start row</param>
/// <param name="pagelen">number of row.</param>
///<returns>a <see cref="CourseTakenByStudentCollection"/></returns>
protected CourseTakenByStudentCollection Fill(SqlDataReader reader, CourseTakenByStudentCollection rows, int start, int pagelen)
{
int recordnum = 0;
while (reader.Read() && (pagelen != 0))
{
if(recordnum >= start)
{
CourseTakenByStudent c = new CourseTakenByStudent();
c.ID = (Convert.IsDBNull(reader["ID"]))?(int)0:(System.Int32)reader["ID"];
c.StudentID = (Convert.IsDBNull(reader["StudentID"]))?(int)0:(System.Int32)reader["StudentID"];
c.CourseID = (Convert.IsDBNull(reader["CourseID"]))?(int)0:(System.Int32)reader["CourseID"];
c.SectionID = (Convert.IsDBNull(reader["SectionID"]))?(int)0:(System.Int32)reader["SectionID"];
c.Status = (Convert.IsDBNull(reader["Status"]))?(int)0:(System.Int32)reader["Status"];
c.NonCredit = (Convert.IsDBNull(reader["NonCredit"]))?false:(System.Boolean)reader["NonCredit"];
c.ChangeStamp = (Convert.IsDBNull(reader["ChangeStamp"]))?DateTime.MinValue:(System.DateTime)reader["ChangeStamp"];
c.AcceptChanges();
rows.Add(c);
pagelen -= 1;
}
recordnum += 1;
}
return rows;
}
/// <summary>
/// Refreshes the <see cref="CourseTakenByStudent"/> object from the <see cref="SqlDataReader"/>.
/// </summary>
/// <param name="reader">The <see cref="SqlDataReader"/> to read from.</param>
/// <param name="entity">The <see cref="CourseTakenByStudent"/> object.</param>
protected void RefreshEntity(SqlDataReader reader, CourseTakenByStudent entity)
{
reader.Read();
entity.ID = (Convert.IsDBNull(reader["ID"]))?(int)0:(System.Int32)reader["ID"];
entity.StudentID = (Convert.IsDBNull(reader["StudentID"]))?(int)0:(System.Int32)reader["StudentID"];
entity.CourseID = (Convert.IsDBNull(reader["CourseID"]))?(int)0:(System.Int32)reader["CourseID"];
entity.SectionID = (Convert.IsDBNull(reader["SectionID"]))?(int)0:(System.Int32)reader["SectionID"];
entity.Status = (Convert.IsDBNull(reader["Status"]))?(int)0:(System.Int32)reader["Status"];
entity.NonCredit = (Convert.IsDBNull(reader["NonCredit"]))?false:(System.Boolean)reader["NonCredit"];
entity.ChangeStamp = (Convert.IsDBNull(reader["ChangeStamp"]))?DateTime.MinValue:(System.DateTime)reader["ChangeStamp"];
reader.Close();
entity.AcceptChanges();
}
/// <summary>
/// Indicates if a transaction is currently used.
/// </summary>
/// <returns></returns>
protected bool UseTransaction()
{
return UseTransaction(this.transactionManager);
}
/// <summary>
/// Indicates if a transaction is currently used.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object.</param>
/// <returns></returns>
protected bool UseTransaction(TransactionManager transactionManager)
{
if (transactionManager != null)
{
if (transactionManager.IsOpen)
return true;
}
return false;
}
#endregion "Helper Functions"
}//end class
} // end namespace