private void SetContactoEmergenciaByIdCommandOutputs(SqlCommand cmd, ContactoEmergenciaByIdOutput output) { if (cmd.Parameters[1].Value != DBNull.Value) { output.ReturnValue = (ContactoEmergenciaByIdOutput.Returns)cmd.Parameters[1].Value; } }
/// <summary> /// Selects single row from dbo.ContactoEmergencia table by identity column. /// SQL+ Routine: dbo.ContactoEmergenciaById - Authored by IvoStrficek /// </summary> public ContactoEmergenciaByIdOutput ContactoEmergenciaById(IContactoEmergenciaByIdInput input) { if (!input.IsValid()) { throw new ArgumentException("ContactoEmergenciaByIdInput fails validation - use the ContactoEmergenciaByIdInput.IsValid() method prior to passing the input argument to the ContactoEmergenciaById method.", "input"); } ContactoEmergenciaByIdOutput output = new ContactoEmergenciaByIdOutput(); if (sqlConnection != null) { using (SqlCommand cmd = GetContactoEmergenciaByIdCommand(sqlConnection, input)) { cmd.Transaction = sqlTransaction; ContactoEmergenciaByIdCommand(cmd, output); } return(output); } for (int idx = 0; idx <= retryOptions.RetryIntervals.Count; idx++) { if (idx > 0) { System.Threading.Thread.Sleep(retryOptions.RetryIntervals[idx - 1]); } try { using (SqlConnection cnn = new SqlConnection(connectionString)) using (SqlCommand cmd = GetContactoEmergenciaByIdCommand(cnn, input)) { cnn.Open(); ContactoEmergenciaByIdCommand(cmd, output); cnn.Close(); } break; } catch (SqlException sqlException) { bool throwException = true; if (retryOptions.TransientErrorNumbers.Contains(sqlException.Number)) { throwException = (idx == retryOptions.RetryIntervals.Count); if (retryOptions.Logger != null) { retryOptions.Logger.Log(sqlException); } } if (throwException) { throw; } } } return(output); }
private void ContactoEmergenciaByIdCommand(SqlCommand cmd, ContactoEmergenciaByIdOutput output) { using (SqlDataReader rdr = cmd.ExecuteReader()) { if (rdr.Read()) { output.ResultData = GetContactoEmergenciaByIdResultFromReader(rdr); } rdr.Close(); } SetContactoEmergenciaByIdCommandOutputs(cmd, output); }