Skip to content

Instantly share code, notes, and snippets.

@jofese
Created August 2, 2017 14:52
Show Gist options
  • Save jofese/f9194a32a24d988ac73ff4641c67506f to your computer and use it in GitHub Desktop.
Save jofese/f9194a32a24d988ac73ff4641c67506f to your computer and use it in GitHub Desktop.
public List<cls_Convenios_Detalle> Buscar(int idConvenio)
{
SqlConnection _conexion = new SqlConnection(cls_Datos.cadenaconexion);
SqlCommand _comando = new SqlCommand("PA_Convenios_Detalle", _conexion) { CommandType = CommandType.StoredProcedure };
_comando.Parameters.AddWithValue("@idConvenio", SqlDbType.Int).Value = idConvenio;
_comando.Parameters.AddWithValue("@Tipo", SqlDbType.Int).Value = 1;
List<cls_Convenios_Detalle> ListaConvenioDetalle = new List<cls_Convenios_Detalle>();
try
{
if (_conexion.State == ConnectionState.Closed)
{
_conexion.Open();
}
SqlDataReader dr = _comando.ExecuteReader();
while (dr.Read())
{
cls_Convenios_Detalle oConveniosDetalle = new cls_Convenios_Detalle();
oConveniosDetalle.IdConvenioDetalle = Convert.ToInt32(dr["idConvenioDetalle"]);
oConveniosDetalle.IdConvenio = Convert.ToInt32(dr["IdConvenio"]);
oConveniosDetalle.IdAseguradora = Convert.ToInt32(dr["IdAseguradora"]);
oConveniosDetalle.Fecreg = Convert.ToDateTime(dr["fecreg"]);
oConveniosDetalle.Fecmov = Convert.ToDateTime(dr["fecmov"]);
oConveniosDetalle.Hostname = dr["hostname"].ToString();
oConveniosDetalle.Segraz = dr["segraz"].ToString();
ListaConvenioDetalle.Add(oConveniosDetalle);
}
}
catch
{
throw;
}
finally
{
_conexion.Close();
}
return ListaConvenioDetalle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment