/OR.Lazarus/OR.Lazarus.SampleSolution/OR.MyGoals.DataAccess/Generated/GoalRequiredExpertise.cs

# · C# · 246 lines · 130 code · 71 blank · 45 comment · 12 complexity · 27bb6fe5d1203e5a9745433269f2a288 MD5 · raw file

  1. ///***********************************************************************
  2. /// GoalRequiredExpertiseBase.cs
  3. /// Owner: joemu
  4. ///
  5. /// Provides a .NET Wrapper around the Stored Procedures in the
  6. /// Lazarus database.
  7. ///
  8. /// Copyright(c) Microsoft Corporation
  9. ///***********************************************************************
  10. using System;
  11. using System.Data;
  12. using System.Data.SqlClient;
  13. using System.Xml;
  14. using OR.Reuse.Persistence;
  15. using OR.MyGoals.DataAccess;
  16. namespace OR.MyGoals.DataAccess.Generated
  17. {
  18. /// <summary>
  19. /// Defines which Technology Focuses are is required to satisfy your various goals.
  20. /// </summary>
  21. public class GoalRequiredExpertiseBase : DataAccessBase
  22. {
  23. #region Private Property Fields
  24. #endregion
  25. #region Constructors
  26. /// <summary>
  27. /// Constructs a new GoalRequiredExpertise and initializes a new SqlConnection.
  28. /// </summary>
  29. public GoalRequiredExpertiseBase() : base()
  30. {
  31. }
  32. /// <summary>
  33. /// Constructs a new GoalRequiredExpertise initialized with the specified SqlConnection.
  34. /// </summary>
  35. public GoalRequiredExpertiseBase( SqlConnection existingConnection) : base( existingConnection )
  36. {
  37. }
  38. #endregion
  39. #region Public Methods
  40. /// <summary>
  41. /// Creates a new GoalRequiredExpertise.
  42. /// </summary>
  43. /// <param name="id"></param>
  44. /// <param name="goalId"></param>
  45. /// <param name="technologyId"></param>
  46. /// <param name="created"></param>
  47. /// <param name="modified"></param>
  48. public void Create
  49. (
  50. out System.Int32 id,
  51. System.Int32 goalId,
  52. System.Int32 technologyId,
  53. out System.DateTime created,
  54. System.DateTime modified
  55. )
  56. {
  57. SqlCommand currentCommand = new SqlCommand();
  58. currentCommand.CommandType = CommandType.StoredProcedure;
  59. currentCommand.CommandText = "[spGoalRequiredExpertiseCreate]";
  60. currentCommand.Connection = this.Connection;
  61. currentCommand.Parameters.Add( new SqlParameter( "@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null ) );
  62. currentCommand.Parameters.Add( new SqlParameter( "@id", SqlDbType.Int, 4 ) );
  63. currentCommand.Parameters[ "@id" ].Direction = ParameterDirection.Output;
  64. currentCommand.Parameters.Add( new SqlParameter( "@goalId", SqlDbType.Int, 4 ) ).Value = goalId;
  65. currentCommand.Parameters.Add( new SqlParameter( "@technologyId", SqlDbType.Int, 4 ) ).Value = technologyId;
  66. currentCommand.Parameters.Add( new SqlParameter( "@created", SqlDbType.DateTime, 1 ) );
  67. currentCommand.Parameters[ "@created" ].Direction = ParameterDirection.Output;
  68. currentCommand.Parameters.Add( new SqlParameter( "@modified", SqlDbType.DateTime, 1 ) ).Value = modified;
  69. if ( Connection.State != ConnectionState.Open ) { Connection.Open(); }
  70. currentCommand.ExecuteNonQuery();
  71. // Dump out the output params.
  72. id = ( System.Int32 )currentCommand.Parameters[ "@id" ].Value;created = ( System.DateTime )currentCommand.Parameters[ "@created" ].Value;
  73. if ( !this.MaintainConnection ) { this.Connection.Close(); }
  74. }
  75. /// <summary>
  76. /// Updates an existing GoalRequiredExpertise matching the specified ID.
  77. /// </summary>
  78. /// <param name="id"></param>
  79. /// <param name="goalId"></param>
  80. /// <param name="technologyId"></param>
  81. /// <param name="modified"></param>
  82. public void Update
  83. (
  84. System.Int32 id,
  85. System.Int32 goalId,
  86. System.Int32 technologyId,
  87. System.DateTime modified
  88. )
  89. {
  90. SqlCommand currentCommand = new SqlCommand();
  91. currentCommand.CommandType = CommandType.StoredProcedure;
  92. currentCommand.CommandText = "[spGoalRequiredExpertiseUpdate]";
  93. currentCommand.Connection = this.Connection;
  94. currentCommand.Parameters.Add( new SqlParameter( "@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null ) );
  95. currentCommand.Parameters.Add( new SqlParameter( "@id", SqlDbType.Int, 4 ) ).Value = id;
  96. currentCommand.Parameters.Add( new SqlParameter( "@goalId", SqlDbType.Int, 4 ) ).Value = goalId;
  97. currentCommand.Parameters.Add( new SqlParameter( "@technologyId", SqlDbType.Int, 4 ) ).Value = technologyId;
  98. currentCommand.Parameters.Add( new SqlParameter( "@modified", SqlDbType.DateTime, 1 ) ).Value = modified;
  99. if ( Connection.State != ConnectionState.Open ) { Connection.Open(); }
  100. currentCommand.ExecuteNonQuery();
  101. // Dump out the output params.
  102. if ( !this.MaintainConnection ) { this.Connection.Close(); }
  103. }
  104. /// <summary>
  105. /// Returns a single GoalRequiredExpertise matching the specified ID.
  106. /// </summary>
  107. /// <param name="id"></param>
  108. /// <returns>DataSet containing matching records.</returns>
  109. public override DataSet Get
  110. (
  111. System.Int32 id
  112. )
  113. {
  114. try
  115. {
  116. SqlCommand currentCommand = new SqlCommand();
  117. currentCommand.CommandType = CommandType.StoredProcedure;
  118. currentCommand.CommandText = "[spGoalRequiredExpertiseGet]";
  119. currentCommand.Connection = this.Connection;
  120. currentCommand.Parameters.Add( new SqlParameter( "@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null ) );
  121. currentCommand.Parameters.Add( new SqlParameter( "@id", SqlDbType.Int, 4 ) ).Value = id;
  122. if ( this.Connection.State != ConnectionState.Open ) { this.Connection.Open(); }
  123. SqlDataReader resultReader = currentCommand.ExecuteReader();
  124. // Dump out the output params.
  125. DataSet rtnVal = new DataSet();
  126. rtnVal.Load( resultReader, LoadOption.OverwriteChanges, "GoalRequiredExpertise" );
  127. resultReader.Close();
  128. if ( !this.MaintainConnection ) { this.Connection.Close(); }
  129. return( rtnVal );
  130. }
  131. catch ( SqlException e )
  132. {
  133. throw new Exception ( e.Message );
  134. }
  135. }
  136. /// <summary>
  137. /// Returns a list of GoalRequiredExpertise records.
  138. /// </summary>
  139. public DataSet List()
  140. {
  141. try
  142. {
  143. SqlCommand currentCommand = new SqlCommand();
  144. currentCommand.CommandType = CommandType.StoredProcedure;
  145. currentCommand.CommandText = "[spGoalRequiredExpertiseList]";
  146. currentCommand.Connection = this.Connection;
  147. currentCommand.Parameters.Add( new SqlParameter( "@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null ) );
  148. if ( this.Connection.State != ConnectionState.Open ) { this.Connection.Open(); }
  149. SqlDataReader resultReader = currentCommand.ExecuteReader();
  150. // Dump out the output params.
  151. DataSet rtnVal = new DataSet();
  152. rtnVal.Load( resultReader, LoadOption.OverwriteChanges, "GoalRequiredExpertise" );
  153. resultReader.Close();
  154. if ( !this.MaintainConnection ) { this.Connection.Close(); }
  155. return( rtnVal );
  156. }
  157. catch ( SqlException e )
  158. {
  159. throw new Exception ( e.Message );
  160. }
  161. }
  162. public override DataTable EmptyTable()
  163. {
  164. DataTable rtnVal = new DataTable();
  165. rtnVal.TableName = "GoalRequiredExpertise";
  166. rtnVal.Columns.Add( new DataColumn( "Id", typeof( System.Int32 ) ) );
  167. rtnVal.Columns.Add( new DataColumn( "GoalId", typeof( System.Int32 ) ) );
  168. rtnVal.Columns.Add( new DataColumn( "TechnologyId", typeof( System.Int32 ) ) );
  169. rtnVal.Columns.Add( new DataColumn( "Created", typeof( System.DateTime ) ) );
  170. rtnVal.Columns.Add( new DataColumn( "Modified", typeof( System.DateTime ) ) );
  171. return( rtnVal );
  172. }
  173. #endregion
  174. }
  175. }