public static InventarioInicial TraerInventario(int id) { InventarioInicial m_entidad = new InventarioInicial(); 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_inventarioini_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 List <InventarioInicial> FetchList(int n_idemp) { List <InventarioInicial> m_listentidad = new List <InventarioInicial>(); 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_inventarioini_listar"; command.Parameters.Add(new MySqlParameter("@n_idemp", n_idemp)); connection.Open(); using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { InventarioInicial m_entidad = SetObject(reader); m_listentidad.Add(m_entidad); } } } } return(m_listentidad); }