private void SetFeedbackDeleteCommandOutputs(SqlCommand cmd, FeedbackDeleteOutput output) { if (cmd.Parameters[1].Value != DBNull.Value) { output.ReturnValue = (FeedbackDeleteOutput.Returns)cmd.Parameters[1].Value; } }
/// <summary> /// Deletes single row from dbo.Feedback table by identity column. /// SQL+ Routine: dbo.FeedbackDelete - Authored by Alan Hyneman /// </summary> public FeedbackDeleteOutput FeedbackDelete(IFeedbackDeleteInput input, bool bypassValidation = false) { if (!bypassValidation) { if (!input.IsValid()) { throw new ArgumentException("FeedbackDeleteInput fails validation - use the FeedbackDeleteInput.IsValid() method prior to passing the input argument to the FeedbackDelete method.", "input"); } } FeedbackDeleteOutput output = new FeedbackDeleteOutput(); if (sqlConnection != null) { using (SqlCommand cmd = GetFeedbackDeleteCommand(sqlConnection, input)) { cmd.Transaction = sqlTransaction; FeedbackDeleteCommand(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 = GetFeedbackDeleteCommand(cnn, input)) { cnn.Open(); FeedbackDeleteCommand(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 FeedbackDeleteCommand(SqlCommand cmd, FeedbackDeleteOutput output) { cmd.ExecuteNonQuery(); SetFeedbackDeleteCommandOutputs(cmd, output); }