private void SetFeedbackUpdateCommandOutputs(SqlCommand cmd, FeedbackUpdateOutput output) { if (cmd.Parameters[6].Value != DBNull.Value) { output.ReturnValue = (FeedbackUpdateOutput.Returns)cmd.Parameters[6].Value; } }
/// <summary> /// Updates record for the dbo.Feedback table. /// SQL+ Routine: dbo.FeedbackUpdate - Authored by Alan Hyneman /// </summary> public FeedbackUpdateOutput FeedbackUpdate(IFeedbackUpdateInput input, bool bypassValidation = false) { if (!bypassValidation) { if (!input.IsValid()) { throw new ArgumentException("FeedbackUpdateInput fails validation - use the FeedbackUpdateInput.IsValid() method prior to passing the input argument to the FeedbackUpdate method.", "input"); } } FeedbackUpdateOutput output = new FeedbackUpdateOutput(); if (sqlConnection != null) { using (SqlCommand cmd = GetFeedbackUpdateCommand(sqlConnection, input)) { cmd.Transaction = sqlTransaction; FeedbackUpdateCommand(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 = GetFeedbackUpdateCommand(cnn, input)) { cnn.Open(); FeedbackUpdateCommand(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 FeedbackUpdateCommand(SqlCommand cmd, FeedbackUpdateOutput output) { cmd.ExecuteNonQuery(); SetFeedbackUpdateCommandOutputs(cmd, output); }