private void SetGetObraSocialCompleteCommandOutputs(SqlCommand cmd, GetObraSocialCompleteOutput output) { if (cmd.Parameters[1].Value != DBNull.Value) { output.ReturnValue = (GetObraSocialCompleteOutput.Returns)cmd.Parameters[1].Value; } }
public List <ObraSocial> GetObraSocial(int idPaciente) { Service service = GetService(); GetObraSocialCompleteInput input = new GetObraSocialCompleteInput() { idPaciente = idPaciente }; GetObraSocialCompleteOutput listaObrasSociales = service.GetObraSocialComplete(input); if (listaObrasSociales.ReturnValue == GetObraSocialCompleteOutput.Returns.Ok) { return((from obraSocial in listaObrasSociales.ResultData select new ObraSocial() { IdObraSocial = obraSocial.IdObraSocial.Value, Nombre = obraSocial.Nombre, Codigo = obraSocial.Codigo, Afiliado = obraSocial.Afiliado, AsociadoTitular = obraSocial.AsociadoTitular, Empresa = obraSocial.Empresa, Plan = obraSocial.Plan, Gravado = obraSocial.Gravado.HasValue? false : obraSocial.Gravado.Value }).ToList()); } else { return(new List <ObraSocial>()); } }
/// <summary> /// Selects rows with all the information about obra social. /// SQL+ Routine: dbo.GetObraSocialComplete - Authored by IvoStrficek /// </summary> public GetObraSocialCompleteOutput GetObraSocialComplete(IGetObraSocialCompleteInput input) { if (!input.IsValid()) { throw new ArgumentException("GetObraSocialCompleteInput fails validation - use the GetObraSocialCompleteInput.IsValid() method prior to passing the input argument to the GetObraSocialComplete method.", "input"); } GetObraSocialCompleteOutput output = new GetObraSocialCompleteOutput(); if (sqlConnection != null) { using (SqlCommand cmd = GetGetObraSocialCompleteCommand(sqlConnection, input)) { cmd.Transaction = sqlTransaction; GetObraSocialCompleteCommand(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 = GetGetObraSocialCompleteCommand(cnn, input)) { cnn.Open(); GetObraSocialCompleteCommand(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 GetObraSocialCompleteCommand(SqlCommand cmd, GetObraSocialCompleteOutput output) { using (SqlDataReader rdr = cmd.ExecuteReader()) { output.ResultData = new List <GetObraSocialCompleteResult>(); while (rdr.Read()) { output.ResultData.Add(GetGetObraSocialCompleteResultFromReader(rdr)); } rdr.Close(); } SetGetObraSocialCompleteCommandOutputs(cmd, output); }