public static InventarioUnimed Fetch(int id) { InventarioUnimed m_entidad = new InventarioUnimed(); using (MySqlConnection connection = new MySqlConnection( ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)) { using (MySqlCommand command = new MySqlCommand()) { command.Connection = connection; command.CommandType = System.Data.CommandType.StoredProcedure; command.CommandText = "alm_inventariounimed_traerregistro"; command.Parameters.Add(new MySqlParameter("@n_id", id)); connection.Open(); using (MySqlDataReader reader = command.ExecuteReader()) { if (reader.Read()) { m_entidad = SetObject(reader); } } } } return(m_entidad); }
public static ObservableListSource <InventarioUnimed> FetchList(int n_idite) { ObservableListSource <InventarioUnimed> m_listentidad = new ObservableListSource <InventarioUnimed>(); using (MySqlConnection connection = new MySqlConnection( ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)) { using (MySqlCommand command = new MySqlCommand()) { command.Connection = connection; command.CommandType = System.Data.CommandType.StoredProcedure; command.CommandText = "alm_inventariounimed_listar_v2"; command.Parameters.Add(new MySqlParameter("@n_idite", n_idite)); connection.Open(); using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { InventarioUnimed m_entidad = SetObject(reader); m_listentidad.Add(m_entidad); } } } } return(m_listentidad); }