public static InventarioLote Fetch(int id) { InventarioLote m_entidad = new InventarioLote(); 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_inventariolotes_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 <InventarioLote> FetchList(int n_idmov) { ObservableListSource <InventarioLote> m_listentidad = new ObservableListSource <InventarioLote>(); 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_inventariolotes_listar"; command.Parameters.Add(new MySqlParameter("@n_idemp", n_idmov)); connection.Open(); using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { InventarioLote m_entidad = SetObject(reader); m_listentidad.Add(m_entidad); } } } } return(m_listentidad); }