using System;
using System.Data;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;
using System.Xml;
namespace YellowbridgeSoftwareInc.DataLayer
{
/// <summary>
/// Purpose: Data Access class for the table 'Products'.
/// </summary>
public class Products
{
public Products( )
{
}
#region Select One Methods
public static DataTable SelectOne_DataTable( string ConnectionString, SqlInt32 ProductID )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@ProductID", SqlDbType.Int , 4 ,ParameterDirection.Input, false,10 ,0 , "", DataRowVersion.Proposed, ProductID )
};
ds = SqlHelper.ExecuteDataset( ConnectionString , CommandType.StoredProcedure,"dbo.[yb_Products_SelectByID]", param );
return ds.Tables[0];
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Products::SelectOne_DataTable::Error occured.", ex);
}
}
public static DataTable SelectOne_DataTable( SqlConnection Connection, SqlInt32 ProductID )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@ProductID", SqlDbType.Int , 4 ,ParameterDirection.Input, false,10 ,0 , "", DataRowVersion.Proposed, ProductID )
};
ds = SqlHelper.ExecuteDataset( Connection , CommandType.StoredProcedure,"dbo.[yb_Products_SelectByID]", param );
return ds.Tables[0];
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Products::SelectOne_DataTable::Error occured.", ex);
}
}
public static DataTable SelectOne_DataTable( SqlTransaction Transaction, SqlInt32 ProductID )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@ProductID", SqlDbType.Int , 4 ,ParameterDirection.Input, false,10 ,0 , "", DataRowVersion.Proposed, ProductID )
};
ds = SqlHelper.ExecuteDataset( Transaction , CommandType.StoredProcedure,"dbo.[yb_Products_SelectByID]", param );
return ds.Tables[0];
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Products::SelectOne_DataTable::Error occured.", ex);
}
}
public static DataSet SelectOne_DataSet( string ConnectionString, SqlInt32 ProductID )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@ProductID", SqlDbType.Int , 4 ,ParameterDirection.Input, false,10 ,0 , "", DataRowVersion.Proposed, ProductID )
};
ds = SqlHelper.ExecuteDataset( ConnectionString , CommandType.StoredProcedure,"dbo.[yb_Products_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 ProductID )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@ProductID", SqlDbType.Int , 4 ,ParameterDirection.Input, false,10 ,0 , "", DataRowVersion.Proposed, ProductID )
};
ds = SqlHelper.ExecuteDataset( Connection , CommandType.StoredProcedure,"dbo.[yb_Products_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 ProductID )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@ProductID", SqlDbType.Int , 4 ,ParameterDirection.Input, false,10 ,0 , "", DataRowVersion.Proposed, ProductID )
};
ds = SqlHelper.ExecuteDataset( Transaction , CommandType.StoredProcedure,"dbo.[yb_Products_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 ProductID )
{
try
{
SqlDataReader dr;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@ProductID", SqlDbType.Int , 4 ,ParameterDirection.Input, false,10 ,0 , "", DataRowVersion.Proposed, ProductID )
};
dr = SqlHelper.ExecuteReader( ConnectionString , CommandType.StoredProcedure,"dbo.[yb_Products_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 ProductID )
{
try
{
SqlDataReader dr;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@ProductID", SqlDbType.Int , 4 ,ParameterDirection.Input, false,10 ,0 , "", DataRowVersion.Proposed, ProductID )
};
dr = SqlHelper.ExecuteReader( Connection , CommandType.StoredProcedure,"dbo.[yb_Products_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 ProductID )
{
try
{
SqlDataReader dr;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@ProductID", SqlDbType.Int , 4 ,ParameterDirection.Input, false,10 ,0 , "", DataRowVersion.Proposed, ProductID )
};
dr = SqlHelper.ExecuteReader( Transaction , CommandType.StoredProcedure,"dbo.[yb_Products_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_Products_SelectAll]", StronglyTypedDataSet, new string[1] {"Products"}, 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_Products_SelectAll]", StronglyTypedDataSet, new string[1] {"Products"}, 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_Products_SelectWhere]", StronglyTypedDataSet, new string[1] {"Products"}, 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_Products_SelectWhere]", StronglyTypedDataSet, new string[1] {"Products"}, 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 ProductID )
{
try
{
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@ProductID", SqlDbType.Int , 4 ,ParameterDirection.Input, false,10 ,0 , "", DataRowVersion.Proposed, ProductID )
};
SqlHelper.FillDataset( ConnectionString , CommandType.StoredProcedure,"dbo.[yb_Products_SelectByID]", StronglyTypedDataSet, new string[1] {"Products"}, param );
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Categories::FillDataSetWithSingle::Error occured.", ex);
}
}
public static void FillDataSetWithSingle( SqlConnection Connection, DataSet StronglyTypedDataSet, SqlInt32 ProductID )
{
try
{
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@ProductID", SqlDbType.Int , 4 ,ParameterDirection.Input, false,10 ,0 , "", DataRowVersion.Proposed, ProductID )
};
SqlHelper.FillDataset( Connection, CommandType.StoredProcedure,"dbo.[yb_Products_SelectByID]", StronglyTypedDataSet, new string[1] {"Products"}, param );
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Categories::FillDataSetWithSingle::Error occured.", ex);
}
}
public static void FillDataSetWithSingle( SqlTransaction Transaction, DataSet StronglyTypedDataSet, SqlInt32 ProductID )
{
try
{
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@ProductID", SqlDbType.Int , 4 ,ParameterDirection.Input, false,10 ,0 , "", DataRowVersion.Proposed, ProductID )
};
SqlHelper.FillDataset( Transaction , CommandType.StoredProcedure,"dbo.[yb_Products_SelectByID]", StronglyTypedDataSet, new string[1] {"Products"}, 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_Products_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_Products_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_Products_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_Products_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_Products_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
{
SqlDataReader dr;
SqlParameter[] param = new SqlParameter[]{};
dr = SqlHelper.ExecuteReader( Transaction , CommandType.StoredProcedure,"dbo.[yb_Products_SelectAll]", param );
return dr;
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Categories::SelectAll_DataReader::Error occured.", ex);
}
}
public static DataSet SelectAll_DataSet( string ConnectionString )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[]{};
ds = SqlHelper.ExecuteDataset( ConnectionString , CommandType.StoredProcedure,"dbo.[yb_Products_SelectAll]", param );
return ds;
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Categories::SelectAll_DataSet::Error occured.", ex);
}
}
public static DataSet SelectAll_DataSet( SqlConnection Connection )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[]{};
ds = SqlHelper.ExecuteDataset( Connection , CommandType.StoredProcedure,"dbo.[yb_Products_SelectAll]", param );
return ds;
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Categories::SelectAll_DataSet::Error occured.", ex);
}
}
public static DataSet SelectAll_DataSet( SqlTransaction Transaction )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[]{};
ds = SqlHelper.ExecuteDataset( Transaction , CommandType.StoredProcedure,"dbo.[yb_Products_SelectAll]", param );
return ds;
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Categories::SelectAll_DataSet::Error occured.", ex);
}
}
#endregion
#region Select Where Methods
public static DataTable SelectWhere_DataTable( string ConnectionString, string WhereClause )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@WhereClause", SqlDbType.VarChar , 500 ,ParameterDirection.Input, false ,0 ,0 , "", DataRowVersion.Proposed, WhereClause.ToString() )
};
ds = SqlHelper.ExecuteDataset( ConnectionString , CommandType.StoredProcedure,"dbo.[yb_Products_SelectWhere]", param );
return ds.Tables[0];
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Categories::SelectWhere_DataTable::Error occured.", ex);
}
}
public static DataTable SelectWhere_DataTable( SqlConnection Connection, string WhereClause )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@WhereClause", SqlDbType.VarChar , 500 ,ParameterDirection.Input, false ,0 ,0 , "", DataRowVersion.Proposed, WhereClause.ToString() )
};
ds = SqlHelper.ExecuteDataset( Connection , CommandType.StoredProcedure,"dbo.[yb_Products_SelectWhere]", param );
return ds.Tables[0];
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Categories::SelectWhere_DataTable::Error occured.", ex);
}
}
public static DataTable SelectWhere_DataTable( SqlTransaction Transaction, string WhereClause )
{
try
{
DataSet ds;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@WhereClause", SqlDbType.VarChar , 500 ,ParameterDirection.Input, false ,0 ,0 , "", DataRowVersion.Proposed, WhereClause.ToString() )
};
ds = SqlHelper.ExecuteDataset( Transaction , CommandType.StoredProcedure,"dbo.[yb_Products_SelectWhere]", param );
return ds.Tables[0];
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Categories::SelectWhere_DataTable::Error occured.", ex);
}
}
public static SqlDataReader SelectWhere_DataReader( SqlConnection Connection, string WhereClause )
{
try
{
SqlDataReader dr;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@WhereClause", SqlDbType.VarChar , 500 ,ParameterDirection.Input, false ,0 ,0 , "", DataRowVersion.Proposed, WhereClause.ToString() )
};
dr = SqlHelper.ExecuteReader( Connection, CommandType.StoredProcedure,"dbo.[yb_Products_SelectWhere]", param );
return dr;
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Categories::SelectWhere_DataReader::Error occured.", ex);
}
}
public static SqlDataReader SelectWhere_DataReader( SqlTransaction Transaction, string WhereClause )
{
try
{
SqlDataReader dr;
SqlParameter[] param = new SqlParameter[1] {
new SqlParameter("@WhereClause", SqlDbType.VarChar , 500 ,ParameterDirection.Input, false ,0 ,0 , "", DataRowVersion.Proposed, WhereClause.ToString() )
};
dr = SqlHelper.ExecuteReader( Transaction , CommandType.StoredProcedure,"dbo.[yb_Products_SelectWhere]", param );
return dr;
}
catch ( Exception ex )
{
// Rethrow the error
throw new Exception("Categories::SelectWhere_