public static ProductoRecetaLineaTarea Fetch(int id) { ProductoRecetaLineaTarea m_entidad = new ProductoRecetaLineaTarea(); 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 = "pro_productosrecetaslineastareas_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 <ProductoRecetaLineaTarea> FetchList(int n_idpro, int n_idrec, int n_idlin) { ObservableListSource <ProductoRecetaLineaTarea> m_listentidad = new ObservableListSource <ProductoRecetaLineaTarea>(); 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 = "pro_productosrecetaslineastareas_listar_v2"; command.Parameters.Add(new MySqlParameter("@n_idpro", n_idpro)); command.Parameters.Add(new MySqlParameter("@n_idrec", n_idrec)); command.Parameters.Add(new MySqlParameter("@n_idlin", n_idlin)); connection.Open(); using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { ProductoRecetaLineaTarea m_entidad = SetObject(reader); m_listentidad.Add(m_entidad); } } } } return(m_listentidad); }