using System;
using System.Data;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using
Microsoft.ApplicationBlocks.Data;
using System.Xml;
namespace
YellowbridgeSoftwareInc.PersistBase
{
/// <summary>
///
Purpose: Data Access class for the table 'Categories'.
/// </summary>
public abstract class Categories
{
public Categories( )
{
}
#region Select One Methods
public static DataTable SelectOne_DataTable( string ConnectionString, SqlInt32 CategoryID )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@CategoryID", SqlDbType.Int , 4
,ParameterDirection.Input, false,10 ,0 ,
"", DataRowVersion.Proposed, CategoryID )
};
ds = SqlHelper.ExecuteDataset(
ConnectionString ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectByID]", param
);
return
ds.Tables[0];
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new Exception("Categories::SelectOne_DataTable::Error
occured.", ex);
}
}
public static DataTable SelectOne_DataTable( SqlConnection
Connection, SqlInt32 CategoryID )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@CategoryID", SqlDbType.Int , 4
,ParameterDirection.Input, false,10 ,0 ,
"", DataRowVersion.Proposed, CategoryID )
};
ds = SqlHelper.ExecuteDataset(
Connection ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectByID]", param
);
return ds.Tables[0];
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::SelectOne_DataTable::Error occured.", ex);
}
}
public static DataTable SelectOne_DataTable( SqlTransaction
Transaction, SqlInt32 CategoryID )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@CategoryID", SqlDbType.Int , 4
,ParameterDirection.Input, false,10 ,0 ,
"", DataRowVersion.Proposed, CategoryID )
};
ds = SqlHelper.ExecuteDataset(
Transaction ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectByID]", param
);
return
ds.Tables[0];
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::SelectOne_DataTable::Error occured.", ex);
}
}
public static DataSet SelectOne_DataSet( string ConnectionString, SqlInt32 CategoryID )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@CategoryID", SqlDbType.Int , 4
,ParameterDirection.Input, false,10 ,0 ,
"", DataRowVersion.Proposed, CategoryID )
};
ds = SqlHelper.ExecuteDataset(
ConnectionString , CommandType.StoredProcedure,"dbo.[yb_Categories_SelectByID]",
param );
return ds;
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::SelectOne_DataSet::Error occured.", ex);
}
}
public static DataSet SelectOne_DataSet( SqlConnection
Connection, SqlInt32 CategoryID )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@CategoryID", SqlDbType.Int , 4
,ParameterDirection.Input, false,10 ,0 , "",
DataRowVersion.Proposed, CategoryID )
};
ds = SqlHelper.ExecuteDataset(
Connection ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectByID]", param
);
return ds;
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::SelectOne_DataSet::Error occured.", ex);
}
}
public static DataSet SelectOne_DataSet( SqlTransaction
Transaction, SqlInt32 CategoryID )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@CategoryID", SqlDbType.Int , 4
,ParameterDirection.Input, false,10 ,0 ,
"", DataRowVersion.Proposed, CategoryID )
};
ds = SqlHelper.ExecuteDataset(
Transaction , CommandType.StoredProcedure,"dbo.[yb_Categories_SelectByID]",
param );
return ds;
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::SelectOne_DataSet::Error occured.", ex);
}
}
public static SqlDataReader SelectOne_DataReader( string ConnectionString, SqlInt32 CategoryID )
{
try
{
SqlDataReader dr;
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@CategoryID", SqlDbType.Int , 4
,ParameterDirection.Input, false,10 ,0 ,
"", DataRowVersion.Proposed, CategoryID )
};
dr = SqlHelper.ExecuteReader(
ConnectionString ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectByID]", param
);
return dr;
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new Exception("Categories::SelectOne_DataReader::Error
occured.", ex);
}
}
public static SqlDataReader SelectOne_DataReader(
SqlConnection Connection, SqlInt32 CategoryID
)
{
try
{
SqlDataReader dr;
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@CategoryID", SqlDbType.Int , 4
,ParameterDirection.Input, false,10 ,0 ,
"", DataRowVersion.Proposed, CategoryID )
};
dr = SqlHelper.ExecuteReader( Connection ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectByID]", param
);
return dr;
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::SelectOne_DataReader::Error occured.", ex);
}
}
public static SqlDataReader SelectOne_DataReader(
SqlTransaction Transaction, SqlInt32 CategoryID
)
{
try
{
SqlDataReader dr;
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@CategoryID", SqlDbType.Int , 4
,ParameterDirection.Input, false,10 ,0 ,
"", DataRowVersion.Proposed, CategoryID )
};
dr = SqlHelper.ExecuteReader( Transaction ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectByID]", param
);
return dr;
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::SelectOne_DataReader::Error occured.", ex);
}
}
#endregion
#region Fill DataSet With All
Methods
public static void
FillDataSetWithAll( string ConnectionString,
DataSet StronglyTypedDataSet )
{
try
{
SqlParameter[] param = new SqlParameter[]{};
SqlHelper.FillDataset( ConnectionString ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectAll]",
StronglyTypedDataSet, new string[1] {"Categories"}, param );
}
catch ( Exception
ex )
{
// Rethrow the error
throw new
Exception("Categories::FillDataSetWithAll::Error occured.", ex);
}
}
public static void
FillDataSetWithAll( SqlTransaction Transaction, DataSet StronglyTypedDataSet )
{
try
{
SqlParameter[] param = new SqlParameter[]{};
SqlHelper.FillDataset( Transaction ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectAll]",
StronglyTypedDataSet, new string[1] {"Categories"}, param );
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::FillDataSetWithAll::Error occured.", ex);
}
}
#endregion
#region Fill DataSet With
WhereClause Methods
public static void
FillDataSetWithWhereClause( string
ConnectionString, DataSet StronglyTypedDataSet, string
WhereClause )
{
try
{
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@WhereClause", SqlDbType.VarChar , 500
,ParameterDirection.Input, false ,0 ,0 ,
"", DataRowVersion.Proposed, WhereClause.ToString() )
};
SqlHelper.FillDataset(
ConnectionString ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectWhere]",
StronglyTypedDataSet, new string[1] {"Categories"}, param );
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::FillDataSetWithAll::Error occured.", ex);
}
}
public static void
FillDataSetWithWhereClause( SqlTransaction Transaction, DataSet
StronglyTypedDataSet, string WhereClause )
{
try
{
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@WhereClause", SqlDbType.VarChar , 500
,ParameterDirection.Input, false ,0 ,0 ,
"", DataRowVersion.Proposed, WhereClause.ToString() )
};
SqlHelper.FillDataset( Transaction ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectWhere]",
StronglyTypedDataSet, new string[1] {"Categories"}, param );
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::FillDataSetWithAll::Error occured.", ex);
}
}
#endregion
#region Fill DataSet With Single
Methods
public static void
FillDataSetWithSingle( string ConnectionString,
DataSet StronglyTypedDataSet, SqlInt32 CategoryID )
{
try
{
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@CategoryID", SqlDbType.Int , 4
,ParameterDirection.Input, false,10 ,0 ,
"", DataRowVersion.Proposed, CategoryID )
};
SqlHelper.FillDataset( ConnectionString ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectByID]",
StronglyTypedDataSet, new string[1] {"Categories"}, param );
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::FillDataSetWithSingle::Error occured.", ex);
}
}
public static void
FillDataSetWithSingle( SqlConnection Connection, DataSet StronglyTypedDataSet,
SqlInt32 CategoryID )
{
try
{
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@CategoryID", SqlDbType.Int , 4
,ParameterDirection.Input, false,10 ,0 ,
"", DataRowVersion.Proposed, CategoryID )
};
SqlHelper.FillDataset( Connection,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectByID]",
StronglyTypedDataSet, new string[1] {"Categories"}, param );
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::FillDataSetWithSingle::Error occured.", ex);
}
}
public static void
FillDataSetWithSingle( SqlTransaction Transaction, DataSet
StronglyTypedDataSet, SqlInt32 CategoryID
)
{
try
{
SqlParameter[] param = new SqlParameter[1] {
new
SqlParameter("@CategoryID", SqlDbType.Int , 4
,ParameterDirection.Input, false,10 ,0 ,
"", DataRowVersion.Proposed, CategoryID )
};
SqlHelper.FillDataset( Transaction ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectByID]",
StronglyTypedDataSet, new string[1] {"Categories"}, param );
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::FillDataSetWithSingle::Error occured.", ex);
}
}
#endregion
#region Select All Methods
public static DataTable SelectAll_DataTable( string ConnectionString )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[]{};
ds = SqlHelper.ExecuteDataset(
ConnectionString ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectAll]", param );
return
ds.Tables[0];
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new Exception("Categories::SelectAll_DataTable::Error
occured.", ex);
}
}
public static DataTable SelectAll_DataTable( SqlConnection
Connection )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[]{};
ds = SqlHelper.ExecuteDataset(
Connection ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectAll]", param );
return
ds.Tables[0];
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new Exception("Categories::SelectAll_DataTable::Error
occured.", ex);
}
}
public static DataTable SelectAll_DataTable( SqlTransaction
Transaction )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[]{};
ds = SqlHelper.ExecuteDataset(
Transaction ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectAll]", param );
return
ds.Tables[0];
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::SelectAll_DataTable::Error occured.", ex);
}
}
public static SqlDataReader SelectAll_DataReader( string ConnectionString )
{
try
{
SqlDataReader dr;
SqlParameter[] param = new SqlParameter[]{};
dr = SqlHelper.ExecuteReader(
ConnectionString ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectAll]", param );
return dr;
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new Exception("Categories::SelectAll_DataReader::Error
occured.", ex);
}
}
public static SqlDataReader SelectAll_DataReader(
SqlConnection Connection )
{
try
{
SqlDataReader dr;
SqlParameter[] param = new SqlParameter[]{};
dr = SqlHelper.ExecuteReader(
Connection ,
CommandType.StoredProcedure,"dbo.[yb_Categories_SelectAll]", param );
return dr;
}
catch ( Exception
ex )
{
// Rethrow the
error
throw new
Exception("Categories::SelectAll_DataReader::Error occured.", ex);
}
}
public static SqlDataReader SelectAll_DataReader(
SqlTransaction Transaction )
{
try