Exemple #1
0
 private void SetGetAllObraSocialCommandOutputs(SqlCommand cmd, GetAllObraSocialOutput output)
 {
     if (cmd.Parameters[0].Value != DBNull.Value)
     {
         output.ReturnValue = (GetAllObraSocialOutput.Returns)cmd.Parameters[0].Value;
     }
 }
Exemple #2
0
 private void GetAllObraSocialCommand(SqlCommand cmd, GetAllObraSocialOutput output)
 {
     using (SqlDataReader rdr = cmd.ExecuteReader())
     {
         output.ResultData = new List <GetAllObraSocialResult>();
         while (rdr.Read())
         {
             output.ResultData.Add(GetGetAllObraSocialResultFromReader(rdr));
         }
         rdr.Close();
     }
     SetGetAllObraSocialCommandOutputs(cmd, output);
 }
Exemple #3
0
        /// <summary>
        /// Get All obras sociales.
        /// SQL+ Routine: dbo.GetAllObraSocial - Authored by IStrficek
        /// </summary>
        public GetAllObraSocialOutput GetAllObraSocial()
        {
            GetAllObraSocialOutput output = new GetAllObraSocialOutput();

            if (sqlConnection != null)
            {
                using (SqlCommand cmd = GetGetAllObraSocialCommand(sqlConnection))
                {
                    cmd.Transaction = sqlTransaction;
                    GetAllObraSocialCommand(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 = GetGetAllObraSocialCommand(cnn))
                        {
                            cnn.Open();
                            GetAllObraSocialCommand(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);
        }
        public List <ObraSocial> GetAllObraSocial()
        {
            Service service = GetService();
            GetAllObraSocialOutput listaIbrasSociales = service.GetAllObraSocial();

            if (listaIbrasSociales.ReturnValue == GetAllObraSocialOutput.Returns.Ok)
            {
                return((from obraSocial in listaIbrasSociales.ResultData
                        select new ObraSocial()
                {
                    IdObraSocial = obraSocial.IdObraSocial,
                    Nombre = obraSocial.Nombre,
                    Codigo = obraSocial.Codigo
                }).ToList());
            }
            else
            {
                return(new List <ObraSocial>());
            }
        }