/// <summary>
        /// Builds the command object for SearchPaciente method.
        /// </summary>
        /// <param name="cnn">The connection that will execute the procedure.</param>
        /// <param name="input">SearchPacienteInput instance for loading parameter values.</param>
        /// <returns>SqlCommand ready for execution.</returns>
        private SqlCommand GetSearchPacienteCommand(SqlConnection cnn, ISearchPacienteInput input)
        {
            SqlCommand result = new SqlCommand()
            {
                CommandType = CommandType.StoredProcedure,
                CommandText = "dbo.SearchPaciente",
                Connection  = cnn
            };

            result.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@Searchtext",
                Direction     = ParameterDirection.Input,
                SqlDbType     = SqlDbType.VarChar,
                Size          = 100,
                Value         = input.Searchtext
            });

            result.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@ReturnValue",
                Direction     = ParameterDirection.ReturnValue,
                SqlDbType     = SqlDbType.Int,
                Scale         = 0,
                Precision     = 10,
                Value         = DBNull.Value
            });

            return(result);
        }
        /// <summary>
        /// Search for coincidences on Nombre, Apellido, DNI y Telefono.
        /// SQL+ Routine: dbo.SearchPaciente - Authored by IStrficek
        /// </summary>
        public SearchPacienteOutput SearchPaciente(ISearchPacienteInput input)
        {
            if (!input.IsValid())
            {
                throw new ArgumentException("SearchPacienteInput fails validation - use the SearchPacienteInput.IsValid() method prior to passing the input argument to the SearchPaciente method.", "input");
            }

            SearchPacienteOutput output = new SearchPacienteOutput();

            if (sqlConnection != null)
            {
                using (SqlCommand cmd = GetSearchPacienteCommand(sqlConnection, input))
                {
                    cmd.Transaction = sqlTransaction;
                    SearchPacienteCommand(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 = GetSearchPacienteCommand(cnn, input))
                        {
                            cnn.Open();
                            SearchPacienteCommand(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);
        }