/App_Code/DAL/_LinkVenueCategory_DAL.cs
# · C# · 335 lines · 205 code · 46 blank · 84 comment · 2 complexity · 1e199f1f793d7f117f0e04379a66242b MD5 · raw file
- /*
- '===============================================================================
- ' Generated From - DAAB_DAL_NET2.vbgen
- ' It is based on the DAAB from the November 2005 Enterprise Library
- '
- ' This object is 'abstract' which means you need to inherit from it to be able
- ' to instantiate it. This is very easily done. You can override properties and
- ' methods in your derived class, this allows you to regenerate this class at any
- ' time and not worry about overwriting custom code.
- '
- ' Custom DAL methods should be written into the inherited class.
- '
- ' Version: 1.0
- ' Date: 30/01/06
- ' Summary: SelectOne, SelectAll, SelectAllWForeignKey, Insert, Update, Delete,
- ' DeleteAllWForeignKey.
- '===============================================================================
- */
- using System;
- using System.Data;
- using System.Data.Common;
- using System.Configuration;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using Microsoft.Practices.EnterpriseLibrary.Data;
- using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
-
-
- namespace PlacementManager.DAL
- {
- public abstract class _LinkVenueCategory_DAL
- {
- #region Members
- protected int _VenueCategoryId;
- protected int _VenueId;
- protected int _CategoryId;
- protected bool _IsActive;
- protected DateTime _DateCreated;
- protected string _CreatedBy;
- protected DateTime _DateUpdated;
- protected string _UpdatedBy;
- #endregion
-
- #region Properties
-
- public int VenueCategoryId
- {
- get { return _VenueCategoryId; }
- set { _VenueCategoryId = value; }
- }
-
- public int VenueId
- {
- get { return _VenueId; }
- set { _VenueId = value; }
- }
-
- public int CategoryId
- {
- get { return _CategoryId; }
- set { _CategoryId = value; }
- }
-
- public bool IsActive
- {
- get { return _IsActive; }
- set { _IsActive = value; }
- }
-
- public DateTime DateCreated
- {
- get { return _DateCreated; }
- set { _DateCreated = value; }
- }
-
- public string CreatedBy
- {
- get { return _CreatedBy; }
- set { _CreatedBy = value; }
- }
-
- public DateTime DateUpdated
- {
- get { return _DateUpdated; }
- set { _DateUpdated = value; }
- }
-
- public string UpdatedBy
- {
- get { return _UpdatedBy; }
- set { _UpdatedBy = value; }
- }
-
- #endregion
-
- //Constructor
- public _LinkVenueCategory_DAL()
- {
-
- }
-
- /// <summary>
- /// Purpose: SelectAll method. This method will Select all rows from the table.
- /// </summary>
- /// <returns></returns>
- public DataSet SelectAll()
- {
- // Create the Database object, using the default database service. The
- // default database service is determined through configuration.
- Database db = DatabaseFactory.CreateDatabase("PlacementManager");
-
- string sqlCommand = "pr_LinkVenueCategory_DAL_SelectAll";
- DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
-
- // Retrieve products from the specified category.
- db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
-
- DataSet dsToReturn = null;
- dsToReturn = db.ExecuteDataSet(dbCommand);
- return dsToReturn;
- }
-
- /// <summary>
- /// Purpose: Select method. This method will Select one existing row from the database, based on the Primary Key.
- /// </summary>
- /// <returns></returns>
- public DataSet SelectOne()
- {
- // Create the Database object, using the default database service. The
- // default database service is determined through configuration.
- Database db = DatabaseFactory.CreateDatabase("PlacementManager");
-
- string sqlCommand = "pr_LinkVenueCategory_DAL_SelectOne";
- DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
-
- db.AddInParameter(dbCommand, "VenueCategoryId", DbType.Int32, _VenueCategoryId);
-
- db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
-
- DataSet dsToReturn = null;
- dsToReturn = db.ExecuteDataSet(dbCommand);
- return dsToReturn;
- }
-
- /// <summary>
- /// Purpose: Select method for a foreign key. This method will Select one or more rows from the database, based on the Foreign Key 'CategoryId'.
- /// </summary>
- /// <returns></returns>
- public DataSet SelectAllWCategoryId()
- {
- // Create the Database object, using the default database service. The
- // default database service is determined through configuration.
- Database db = DatabaseFactory.CreateDatabase("PlacementManager");
- string sqlCommand = "pr_LinkVenueCategory_DAL_SelectAllWCategoryId";
- DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
- db.AddInParameter(dbCommand, "CategoryId", DbType.Int32, _CategoryId);
- db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
- DataSet dsToReturn = null;
- dsToReturn = db.ExecuteDataSet(dbCommand);
- return dsToReturn;
- }
- /// <summary>
- /// Purpose: Select method for a foreign key. This method will Select one or more rows from the database, based on the Foreign Key 'VenueId'.
- /// </summary>
- /// <returns></returns>
- public DataSet SelectAllWVenueId()
- {
- // Create the Database object, using the default database service. The
- // default database service is determined through configuration.
- Database db = DatabaseFactory.CreateDatabase("PlacementManager");
- string sqlCommand = "pr_LinkVenueCategory_DAL_SelectAllWVenueId";
- DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
- db.AddInParameter(dbCommand, "VenueId", DbType.Int32, _VenueId);
- db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
- DataSet dsToReturn = null;
- dsToReturn = db.ExecuteDataSet(dbCommand);
- return dsToReturn;
- }
-
- /// <summary>
- /// Inserts the current instance data into the database.
- /// </summary>
- /// <returns></returns>
- public int Insert()
- {
- // Create the Database object, using the default database service. The
- // default database service is determined through configuration.
- Database db = DatabaseFactory.CreateDatabase("PlacementManager");
-
- string sqlCommand = "pr_LinkVenueCategory_DAL_Insert";
- DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
-
- // Add parameters
- db.AddInParameter(dbCommand,"VenueId", DbType.Int32, _VenueId);
- db.AddInParameter(dbCommand,"CategoryId", DbType.Int32, _CategoryId);
- db.AddInParameter(dbCommand,"IsActive", DbType.Boolean, _IsActive);
- db.AddInParameter(dbCommand,"DateCreated", DbType.DateTime, _DateCreated);
- db.AddInParameter(dbCommand,"CreatedBy", DbType.AnsiString, _CreatedBy);
- db.AddInParameter(dbCommand,"DateUpdated", DbType.DateTime, _DateUpdated);
- db.AddInParameter(dbCommand,"UpdatedBy", DbType.AnsiString, _UpdatedBy);
- db.AddOutParameter(dbCommand, "VenueCategoryId", DbType.Int32, 4);
- db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);
-
- db.ExecuteNonQuery(dbCommand);
-
- // Save output parameter values
- object param;
- param = db.GetParameterValue(dbCommand, "VenueCategoryId");
- if (param == DBNull.Value) return 0;
- _VenueCategoryId = (int)param;
-
- return _VenueCategoryId;
- }
-
- /// <summary>
- /// Purpose: Update method. This method will Update one existing row in the database.
- /// </summary>
- /// <returns></returns>
- public bool Update()
- {
- // Create the Database object, using the default database service. The
- // default database service is determined through configuration.
- Database db = DatabaseFactory.CreateDatabase("PlacementManager");
-
- string sqlCommand = "pr_LinkVenueCategory_DAL_Update";
- DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
-
-
- // Add parameters
- db.AddInParameter(dbCommand,"VenueCategoryId", DbType.Int32, _VenueCategoryId);
- db.AddInParameter(dbCommand,"VenueId", DbType.Int32, _VenueId);
- db.AddInParameter(dbCommand,"CategoryId", DbType.Int32, _CategoryId);
- db.AddInParameter(dbCommand,"IsActive", DbType.Boolean, _IsActive);
- db.AddInParameter(dbCommand,"DateCreated", DbType.DateTime, _DateCreated);
- db.AddInParameter(dbCommand,"CreatedBy", DbType.AnsiString, _CreatedBy);
- db.AddInParameter(dbCommand,"DateUpdated", DbType.DateTime, _DateUpdated);
- db.AddInParameter(dbCommand,"UpdatedBy", DbType.AnsiString, _UpdatedBy);
-
-
- db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
-
- //try
- //{
- db.ExecuteNonQuery(dbCommand);
- return true;
- //}
- //catch
- //{
- // return false;
- //}
- }
-
-
- /// <summary>
- /// Purpose: Delete method. This method will Delete one existing row in the database, based on the Primary Key.
- /// </summary>
- /// <returns></returns>
- public bool Delete()
- {
- // Create the Database object, using the default database service. The
- // default database service is determined through configuration.
- Database db = DatabaseFactory.CreateDatabase("PlacementManager");
-
- string sqlCommand = "pr_LinkVenueCategory_DAL_Delete";
- DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
-
- try
- {
-
- db.AddInParameter(dbCommand, "VenueCategoryId", DbType.Int32, _VenueCategoryId);
-
- db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
- db.ExecuteNonQuery(dbCommand);
- return true;
- }
- catch
- {
- return false;
- }
- }
- /// <summary>
- /// Purpose: Delete method for a foreign key. This method will Delete one or more rows from the database, based on the Foreign Key 'CategoryId'.
- /// </summary>
- /// <returns></returns>
- public bool DeleteAllWCategoryId()
- {
- // Create the Database object, using the default database service. The
- // default database service is determined through configuration.
- Database db = DatabaseFactory.CreateDatabase("PlacementManager");
- string sqlCommand = "pr_LinkVenueCategory_DAL_DeleteAllWCategoryId";
- DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
- try
- {
- db.AddInParameter(dbCommand, "CategoryId", DbType.Int32, _CategoryId);
- db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
- db.ExecuteNonQuery(dbCommand);
- return true;
- }
- catch
- {
- return false;
- }
- }
- /// <summary>
- /// Purpose: Delete method for a foreign key. This method will Delete one or more rows from the database, based on the Foreign Key 'VenueId'.
- /// </summary>
- /// <returns></returns>
- public bool DeleteAllWVenueId()
- {
- // Create the Database object, using the default database service. The
- // default database service is determined through configuration.
- Database db = DatabaseFactory.CreateDatabase("PlacementManager");
- string sqlCommand = "pr_LinkVenueCategory_DAL_DeleteAllWVenueId";
- DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
- try
- {
- db.AddInParameter(dbCommand, "VenueId", DbType.Int32, _VenueId);
- db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
- db.ExecuteNonQuery(dbCommand);
- return true;
- }
- catch
- {
- return false;
- }
- }
-
-
- }
- }