/// <summary>
        /// Inserts a new record into the dbo.PlanObraSocial table.
        /// SQL+ Routine: dbo.PlanObraSocialInsert - Authored by Ivo Strficek
        /// </summary>
        public PlanObraSocialInsertOutput PlanObraSocialInsert(IPlanObraSocialInsertInput input)
        {
            if (!input.IsValid())
            {
                throw new ArgumentException("PlanObraSocialInsertInput fails validation - use the PlanObraSocialInsertInput.IsValid() method prior to passing the input argument to the PlanObraSocialInsert method.", "input");
            }

            PlanObraSocialInsertOutput output = new PlanObraSocialInsertOutput();

            if (sqlConnection != null)
            {
                using (SqlCommand cmd = GetPlanObraSocialInsertCommand(sqlConnection, input))
                {
                    cmd.Transaction = sqlTransaction;
                    PlanObraSocialInsertCommand(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 = GetPlanObraSocialInsertCommand(cnn, input))
                        {
                            cnn.Open();
                            PlanObraSocialInsertCommand(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 SetPlanObraSocialInsertCommandOutputs(SqlCommand cmd, PlanObraSocialInsertOutput output)
 {
     if (cmd.Parameters[0].Value != DBNull.Value)
     {
         output.IdPlanObraSocial = (int?)cmd.Parameters[0].Value;
     }
     if (cmd.Parameters[4].Value != DBNull.Value)
     {
         output.ReturnValue = (PlanObraSocialInsertOutput.Returns)cmd.Parameters[4].Value;
     }
 }
        private void PlanObraSocialInsertCommand(SqlCommand cmd, PlanObraSocialInsertOutput output)
        {
            cmd.ExecuteNonQuery();

            SetPlanObraSocialInsertCommandOutputs(cmd, output);
        }