示例#1
0
        public static ProductoRecetaLinea Fetch(int id)
        {
            ProductoRecetaLinea m_entidad = new ProductoRecetaLinea();

            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_productosrecetaslineas_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);
        }
示例#2
0
        public static ObservableListSource <ProductoRecetaLinea> FetchList(int n_idpro, int n_idrec)
        {
            ObservableListSource <ProductoRecetaLinea> m_listentidad = new ObservableListSource <ProductoRecetaLinea>();

            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_productosrecetaslineas_listar_v2";
                    command.Parameters.Add(new MySqlParameter("@n_idpro", n_idpro));
                    command.Parameters.Add(new MySqlParameter("@n_idrec", n_idrec));
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            ProductoRecetaLinea m_entidad = SetObject(reader);
                            m_listentidad.Add(m_entidad);
                        }
                    }
                }
            }
            return(m_listentidad);
        }