/// <summary>
        /// Inserts a new record into the dbo.Feedback table.
        /// SQL+ Routine: dbo.FeedbackInsert - Authored by Alan Hyneman
        /// </summary>
        public FeedbackInsertOutput FeedbackInsert(IFeedbackInsertInput input, bool bypassValidation = false)
        {
            if (!bypassValidation)
            {
                if (!input.IsValid())
                {
                    throw new ArgumentException("FeedbackInsertInput fails validation - use the FeedbackInsertInput.IsValid() method prior to passing the input argument to the FeedbackInsert method.", "input");
                }
            }
            FeedbackInsertOutput output = new FeedbackInsertOutput();

            if (sqlConnection != null)
            {
                using (SqlCommand cmd = GetFeedbackInsertCommand(sqlConnection, input))
                {
                    cmd.Transaction = sqlTransaction;
                    FeedbackInsertCommand(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 = GetFeedbackInsertCommand(cnn, input))
                        {
                            cnn.Open();
                            FeedbackInsertCommand(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 SetFeedbackInsertCommandOutputs(SqlCommand cmd, FeedbackInsertOutput output)
 {
     if (cmd.Parameters[0].Value != DBNull.Value)
     {
         output.FeedbackId = (int?)cmd.Parameters[0].Value;
     }
     if (cmd.Parameters[6].Value != DBNull.Value)
     {
         output.ReturnValue = (FeedbackInsertOutput.Returns)cmd.Parameters[6].Value;
     }
 }
 private void FeedbackInsertCommand(SqlCommand cmd, FeedbackInsertOutput output)
 {
     cmd.ExecuteNonQuery();
     SetFeedbackInsertCommandOutputs(cmd, output);
 }