Example #1
0
 private void SetGetObraSocialCommandOutputs(SqlCommand cmd, GetObraSocialOutput output)
 {
     if (cmd.Parameters[1].Value != DBNull.Value)
     {
         output.ReturnValue = (GetObraSocialOutput.Returns)cmd.Parameters[1].Value;
     }
 }
Example #2
0
        /// <summary>
        /// Get pacient's Obras sociales.
        /// SQL+ Routine: dbo.GetObraSocial - Authored by IStrficek
        /// </summary>
        public GetObraSocialOutput GetObraSocial(IGetObraSocialInput input)
        {
            if (!input.IsValid())
            {
                throw new ArgumentException("GetObraSocialInput fails validation - use the GetObraSocialInput.IsValid() method prior to passing the input argument to the GetObraSocial method.", "input");
            }

            GetObraSocialOutput output = new GetObraSocialOutput();

            if (sqlConnection != null)
            {
                using (SqlCommand cmd = GetGetObraSocialCommand(sqlConnection, input))
                {
                    cmd.Transaction = sqlTransaction;
                    GetObraSocialCommand(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 = GetGetObraSocialCommand(cnn, input))
                        {
                            cnn.Open();
                            GetObraSocialCommand(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);
        }
Example #3
0
 private void GetObraSocialCommand(SqlCommand cmd, GetObraSocialOutput output)
 {
     using (SqlDataReader rdr = cmd.ExecuteReader())
     {
         output.ResultData = new List <GetObraSocialResult>();
         while (rdr.Read())
         {
             output.ResultData.Add(GetGetObraSocialResultFromReader(rdr));
         }
         rdr.Close();
     }
     SetGetObraSocialCommandOutputs(cmd, output);
 }