public Tables.tblOrderItem_Record GetOne_tblOrderItem_Record(Guid id) { Params.spS_tblOrderItem param = new Params.spS_tblOrderItem(true); param.SetUpConnection(string.Empty); param.Param_Oit_GuidID = id; using (SPs.spS_tblOrderItem sp = new SPs.spS_tblOrderItem(true)) { System.Data.SqlClient.SqlDataReader sqlDataReader = null; sp.Execute(ref param, out sqlDataReader); param.Dispose(); if (sqlDataReader.Read()) { Tables.tblOrderItem_Record record = new Tables.tblOrderItem_Record(); record.Col_Oit_GuidID.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidID.ColumnIndex); if (!record.Col_Oit_GuidID.UseNull) { record.Col_Oit_GuidID.Value = sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidID.ColumnIndex).Value; } record.Col_Oit_GuidOrderID.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidOrderID.ColumnIndex); if (!record.Col_Oit_GuidOrderID.UseNull) { record.Col_Oit_GuidOrderID.Value = sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidOrderID.ColumnIndex).Value; } record.Col_Oit_GuidProductID.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidProductID.ColumnIndex); if (!record.Col_Oit_GuidProductID.UseNull) { record.Col_Oit_GuidProductID.Value = sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidProductID.ColumnIndex).Value; } record.Col_Oit_LngAmount.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_LngAmount.ColumnIndex); if (!record.Col_Oit_LngAmount.UseNull) { record.Col_Oit_LngAmount.Value = sqlDataReader.GetSqlInt32(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_LngAmount.ColumnIndex).Value; } sqlDataReader.Close(); sp.Connection.Close(); return(record); } else { sqlDataReader.Close(); sp.Connection.Close(); return(null); } } }
/// <summary> /// [To be supplied.] /// </summary> /// <returns>[To be supplied.]</returns> public bool Refresh() { this.displayName = null; this.col_Oit_GuidOrderIDWasUpdated = false; this.col_Oit_GuidOrderIDWasSet = false; this.col_Oit_GuidOrderID = System.Data.SqlTypes.SqlGuid.Null; this.col_Oit_GuidProductIDWasUpdated = false; this.col_Oit_GuidProductIDWasSet = false; this.col_Oit_GuidProductID = System.Data.SqlTypes.SqlGuid.Null; this.col_Oit_LngAmountWasUpdated = false; this.col_Oit_LngAmountWasSet = false; this.col_Oit_LngAmount = System.Data.SqlTypes.SqlInt32.Null; bool alreadyOpened = false; Params.spS_tblOrderItem Param = new Params.spS_tblOrderItem(true); Param.CommandTimeOut = this.selectCommandTimeOut; switch (this.lastKnownConnectionType) { case OlymarsDemo.DataClasses.ConnectionType.ConnectionString: Param.SetUpConnection(this.connectionString); break; case OlymarsDemo.DataClasses.ConnectionType.SqlConnection: Param.SetUpConnection(this.sqlConnection); alreadyOpened = (this.sqlConnection.State == System.Data.ConnectionState.Open); break; case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction: Param.SetUpConnection(this.sqlTransaction); break; } if (!this.col_Oit_GuidID.IsNull) { Param.Param_Oit_GuidID = this.col_Oit_GuidID; } System.Data.SqlClient.SqlDataReader sqlDataReader = null; SPs.spS_tblOrderItem Sp = new SPs.spS_tblOrderItem(false); if (Sp.Execute(ref Param, out sqlDataReader)) { if (sqlDataReader.Read()) { if (!sqlDataReader.IsDBNull(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidOrderID.ColumnIndex)) { this.col_Oit_GuidOrderID = sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidOrderID.ColumnIndex); } if (!sqlDataReader.IsDBNull(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidProductID.ColumnIndex)) { this.col_Oit_GuidProductID = sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidProductID.ColumnIndex); } if (!sqlDataReader.IsDBNull(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_LngAmount.ColumnIndex)) { this.col_Oit_LngAmount = sqlDataReader.GetSqlInt32(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_LngAmount.ColumnIndex); } if (sqlDataReader != null && !sqlDataReader.IsClosed) { sqlDataReader.Close(); } CloseConnection(Sp.Connection, alreadyOpened); this.recordIsLoaded = true; return(true); } else { if (sqlDataReader != null && !sqlDataReader.IsClosed) { sqlDataReader.Close(); } CloseConnection(Sp.Connection, alreadyOpened); this.recordIsLoaded = false; return(false); } } else { if (sqlDataReader != null && !sqlDataReader.IsClosed) { sqlDataReader.Close(); } CloseConnection(Sp.Connection, alreadyOpened); throw new OlymarsDemo.DataClasses.CustomException(Param, "OlymarsDemo.BusinessComponents.tblOrderItem_Record", "Refresh"); } }