/App_Code/DAL/_LinkContactAttributeContact_DAL.cs

# · C# · 335 lines · 205 code · 46 blank · 84 comment · 2 complexity · 679fa4a7705bb40e04ebf25592dbe252 MD5 · raw file

  1. /*
  2. '===============================================================================
  3. ' Generated From - DAAB_DAL_NET2.vbgen
  4. ' It is based on the DAAB from the November 2005 Enterprise Library
  5. '
  6. ' This object is 'abstract' which means you need to inherit from it to be able
  7. ' to instantiate it. This is very easily done. You can override properties and
  8. ' methods in your derived class, this allows you to regenerate this class at any
  9. ' time and not worry about overwriting custom code.
  10. '
  11. ' Custom DAL methods should be written into the inherited class.
  12. '
  13. ' Version: 1.0
  14. ' Date: 30/01/06
  15. ' Summary: SelectOne, SelectAll, SelectAllWForeignKey, Insert, Update, Delete,
  16. ' DeleteAllWForeignKey.
  17. '===============================================================================
  18. */
  19. using System;
  20. using System.Data;
  21. using System.Data.Common;
  22. using System.Configuration;
  23. using System.Web;
  24. using System.Web.Security;
  25. using System.Web.UI;
  26. using System.Web.UI.WebControls;
  27. using System.Web.UI.WebControls.WebParts;
  28. using System.Web.UI.HtmlControls;
  29. using Microsoft.Practices.EnterpriseLibrary.Data;
  30. using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
  31. namespace PlacementManager.DAL
  32. {
  33. public abstract class _LinkContactAttributeContact_DAL
  34. {
  35. #region Members
  36. protected int _ContactAttributeContactId;
  37. protected int _ContactAttributeId;
  38. protected int _ContactId;
  39. protected bool _IsActive;
  40. protected DateTime _DateCreated;
  41. protected string _CreatedBy;
  42. protected DateTime _DateUpdated;
  43. protected string _UpdatedBy;
  44. #endregion
  45. #region Properties
  46. public int ContactAttributeContactId
  47. {
  48. get { return _ContactAttributeContactId; }
  49. set { _ContactAttributeContactId = value; }
  50. }
  51. public int ContactAttributeId
  52. {
  53. get { return _ContactAttributeId; }
  54. set { _ContactAttributeId = value; }
  55. }
  56. public int ContactId
  57. {
  58. get { return _ContactId; }
  59. set { _ContactId = value; }
  60. }
  61. public bool IsActive
  62. {
  63. get { return _IsActive; }
  64. set { _IsActive = value; }
  65. }
  66. public DateTime DateCreated
  67. {
  68. get { return _DateCreated; }
  69. set { _DateCreated = value; }
  70. }
  71. public string CreatedBy
  72. {
  73. get { return _CreatedBy; }
  74. set { _CreatedBy = value; }
  75. }
  76. public DateTime DateUpdated
  77. {
  78. get { return _DateUpdated; }
  79. set { _DateUpdated = value; }
  80. }
  81. public string UpdatedBy
  82. {
  83. get { return _UpdatedBy; }
  84. set { _UpdatedBy = value; }
  85. }
  86. #endregion
  87. //Constructor
  88. public _LinkContactAttributeContact_DAL()
  89. {
  90. }
  91. /// <summary>
  92. /// Purpose: SelectAll method. This method will Select all rows from the table.
  93. /// </summary>
  94. /// <returns></returns>
  95. public DataSet SelectAll()
  96. {
  97. // Create the Database object, using the default database service. The
  98. // default database service is determined through configuration.
  99. Database db = DatabaseFactory.CreateDatabase("PlacementManager");
  100. string sqlCommand = "pr_LinkContactAttributeContact_DAL_SelectAll";
  101. DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
  102. // Retrieve products from the specified category.
  103. db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
  104. DataSet dsToReturn = null;
  105. dsToReturn = db.ExecuteDataSet(dbCommand);
  106. return dsToReturn;
  107. }
  108. /// <summary>
  109. /// Purpose: Select method. This method will Select one existing row from the database, based on the Primary Key.
  110. /// </summary>
  111. /// <returns></returns>
  112. public DataSet SelectOne()
  113. {
  114. // Create the Database object, using the default database service. The
  115. // default database service is determined through configuration.
  116. Database db = DatabaseFactory.CreateDatabase("PlacementManager");
  117. string sqlCommand = "pr_LinkContactAttributeContact_DAL_SelectOne";
  118. DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
  119. db.AddInParameter(dbCommand, "ContactAttributeContactId", DbType.Int32, _ContactAttributeContactId);
  120. db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
  121. DataSet dsToReturn = null;
  122. dsToReturn = db.ExecuteDataSet(dbCommand);
  123. return dsToReturn;
  124. }
  125. /// <summary>
  126. /// Purpose: Select method for a foreign key. This method will Select one or more rows from the database, based on the Foreign Key 'ContactId'.
  127. /// </summary>
  128. /// <returns></returns>
  129. public DataSet SelectAllWContactId()
  130. {
  131. // Create the Database object, using the default database service. The
  132. // default database service is determined through configuration.
  133. Database db = DatabaseFactory.CreateDatabase("PlacementManager");
  134. string sqlCommand = "pr_LinkContactAttributeContact_DAL_SelectAllWContactId";
  135. DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
  136. db.AddInParameter(dbCommand, "ContactId", DbType.Int32, _ContactId);
  137. db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
  138. DataSet dsToReturn = null;
  139. dsToReturn = db.ExecuteDataSet(dbCommand);
  140. return dsToReturn;
  141. }
  142. /// <summary>
  143. /// Purpose: Select method for a foreign key. This method will Select one or more rows from the database, based on the Foreign Key 'ContactAttributeId'.
  144. /// </summary>
  145. /// <returns></returns>
  146. public DataSet SelectAllWContactAttributeId()
  147. {
  148. // Create the Database object, using the default database service. The
  149. // default database service is determined through configuration.
  150. Database db = DatabaseFactory.CreateDatabase("PlacementManager");
  151. string sqlCommand = "pr_LinkContactAttributeContact_DAL_SelectAllWContactAttributeId";
  152. DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
  153. db.AddInParameter(dbCommand, "ContactAttributeId", DbType.Int32, _ContactAttributeId);
  154. db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
  155. DataSet dsToReturn = null;
  156. dsToReturn = db.ExecuteDataSet(dbCommand);
  157. return dsToReturn;
  158. }
  159. /// <summary>
  160. /// Inserts the current instance data into the database.
  161. /// </summary>
  162. /// <returns></returns>
  163. public int Insert()
  164. {
  165. // Create the Database object, using the default database service. The
  166. // default database service is determined through configuration.
  167. Database db = DatabaseFactory.CreateDatabase("PlacementManager");
  168. string sqlCommand = "pr_LinkContactAttributeContact_DAL_Insert";
  169. DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
  170. // Add parameters
  171. db.AddInParameter(dbCommand,"ContactAttributeId", DbType.Int32, _ContactAttributeId);
  172. db.AddInParameter(dbCommand,"ContactId", DbType.Int32, _ContactId);
  173. db.AddInParameter(dbCommand,"IsActive", DbType.Boolean, _IsActive);
  174. db.AddInParameter(dbCommand,"DateCreated", DbType.DateTime, _DateCreated);
  175. db.AddInParameter(dbCommand,"CreatedBy", DbType.String, _CreatedBy);
  176. db.AddInParameter(dbCommand,"DateUpdated", DbType.DateTime, _DateUpdated);
  177. db.AddInParameter(dbCommand,"UpdatedBy", DbType.String, _UpdatedBy);
  178. db.AddOutParameter(dbCommand, "ContactAttributeContactId", DbType.Int32, 4);
  179. db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);
  180. db.ExecuteNonQuery(dbCommand);
  181. // Save output parameter values
  182. object param;
  183. param = db.GetParameterValue(dbCommand, "ContactAttributeContactId");
  184. if (param == DBNull.Value) return 0;
  185. _ContactAttributeContactId = (int)param;
  186. return _ContactAttributeContactId;
  187. }
  188. /// <summary>
  189. /// Purpose: Update method. This method will Update one existing row in the database.
  190. /// </summary>
  191. /// <returns></returns>
  192. public bool Update()
  193. {
  194. // Create the Database object, using the default database service. The
  195. // default database service is determined through configuration.
  196. Database db = DatabaseFactory.CreateDatabase("PlacementManager");
  197. string sqlCommand = "pr_LinkContactAttributeContact_DAL_Update";
  198. DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
  199. // Add parameters
  200. db.AddInParameter(dbCommand,"ContactAttributeContactId", DbType.Int32, _ContactAttributeContactId);
  201. db.AddInParameter(dbCommand,"ContactAttributeId", DbType.Int32, _ContactAttributeId);
  202. db.AddInParameter(dbCommand,"ContactId", DbType.Int32, _ContactId);
  203. db.AddInParameter(dbCommand,"IsActive", DbType.Boolean, _IsActive);
  204. db.AddInParameter(dbCommand,"DateCreated", DbType.DateTime, _DateCreated);
  205. db.AddInParameter(dbCommand,"CreatedBy", DbType.String, _CreatedBy);
  206. db.AddInParameter(dbCommand,"DateUpdated", DbType.DateTime, _DateUpdated);
  207. db.AddInParameter(dbCommand,"UpdatedBy", DbType.String, _UpdatedBy);
  208. db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
  209. //try
  210. //{
  211. db.ExecuteNonQuery(dbCommand);
  212. return true;
  213. //}
  214. //catch
  215. //{
  216. // return false;
  217. //}
  218. }
  219. /// <summary>
  220. /// Purpose: Delete method. This method will Delete one existing row in the database, based on the Primary Key.
  221. /// </summary>
  222. /// <returns></returns>
  223. public bool Delete()
  224. {
  225. // Create the Database object, using the default database service. The
  226. // default database service is determined through configuration.
  227. Database db = DatabaseFactory.CreateDatabase("PlacementManager");
  228. string sqlCommand = "pr_LinkContactAttributeContact_DAL_Delete";
  229. DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
  230. try
  231. {
  232. db.AddInParameter(dbCommand, "ContactAttributeContactId", DbType.Int32, _ContactAttributeContactId);
  233. db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
  234. db.ExecuteNonQuery(dbCommand);
  235. return true;
  236. }
  237. catch
  238. {
  239. return false;
  240. }
  241. }
  242. /// <summary>
  243. /// Purpose: Delete method for a foreign key. This method will Delete one or more rows from the database, based on the Foreign Key 'ContactId'.
  244. /// </summary>
  245. /// <returns></returns>
  246. public bool DeleteAllWContactId()
  247. {
  248. // Create the Database object, using the default database service. The
  249. // default database service is determined through configuration.
  250. Database db = DatabaseFactory.CreateDatabase("PlacementManager");
  251. string sqlCommand = "pr_LinkContactAttributeContact_DAL_DeleteAllWContactId";
  252. DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
  253. try
  254. {
  255. db.AddInParameter(dbCommand, "ContactId", DbType.Int32, _ContactId);
  256. db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
  257. db.ExecuteNonQuery(dbCommand);
  258. return true;
  259. }
  260. catch
  261. {
  262. return false;
  263. }
  264. }
  265. /// <summary>
  266. /// Purpose: Delete method for a foreign key. This method will Delete one or more rows from the database, based on the Foreign Key 'ContactAttributeId'.
  267. /// </summary>
  268. /// <returns></returns>
  269. public bool DeleteAllWContactAttributeId()
  270. {
  271. // Create the Database object, using the default database service. The
  272. // default database service is determined through configuration.
  273. Database db = DatabaseFactory.CreateDatabase("PlacementManager");
  274. string sqlCommand = "pr_LinkContactAttributeContact_DAL_DeleteAllWContactAttributeId";
  275. DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
  276. try
  277. {
  278. db.AddInParameter(dbCommand, "ContactAttributeId", DbType.Int32, _ContactAttributeId);
  279. db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
  280. db.ExecuteNonQuery(dbCommand);
  281. return true;
  282. }
  283. catch
  284. {
  285. return false;
  286. }
  287. }
  288. }
  289. }