private void SetPacienteUpdateCommandOutputs(SqlCommand cmd, PacienteUpdateOutput output) { if (cmd.Parameters[9].Value != DBNull.Value) { output.ReturnValue = (PacienteUpdateOutput.Returns)cmd.Parameters[9].Value; } }
/// <summary> /// Updates record for the dbo.Paciente table. /// SQL+ Routine: dbo.PacienteUpdate - Authored by IStrficek /// </summary> public PacienteUpdateOutput PacienteUpdate(IPacienteUpdateInput input) { if (!input.IsValid()) { throw new ArgumentException("PacienteUpdateInput fails validation - use the PacienteUpdateInput.IsValid() method prior to passing the input argument to the PacienteUpdate method.", "input"); } PacienteUpdateOutput output = new PacienteUpdateOutput(); if (sqlConnection != null) { using (SqlCommand cmd = GetPacienteUpdateCommand(sqlConnection, input)) { cmd.Transaction = sqlTransaction; PacienteUpdateCommand(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 = GetPacienteUpdateCommand(cnn, input)) { cnn.Open(); PacienteUpdateCommand(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 PacienteUpdateCommand(SqlCommand cmd, PacienteUpdateOutput output) { cmd.ExecuteNonQuery(); SetPacienteUpdateCommandOutputs(cmd, output); }