Пример #1
0
        // Refactorizado para SQLite
        public void insertProductoInventario(ProductoLaboratorio producto)
        {
            string sql = "INSERT INTO ProductoInventario(CO_PRODUCTO, CO_LABORATORIO, IN_PROD_FRACCIONADO, NU_ANAQUEL, NU_ANAQUEL_CONCAT, VA_FRACCION, CA_ENTERO, CA_FRACCION) "
                         + "VALUES('" + producto.getCoProducto() + "', '" + producto.getCoLaboratorio() + "', '" + producto.getInProdFraccionado() + "', '" + producto.getNuAnaquel() + "', '" + producto.getNuAnaquel() + "', " + producto.getVaFraccion() + ", " + producto.getCaEntero() + ", " + producto.getCaFraccion() + ")";

            using (SQLiteTransaction sqlTransaction = Connection.getConexion().BeginTransaction())
            {
                SQLiteCommand command = new SQLiteCommand(sql, Connection.getConexion());
                command.ExecuteNonQuery();
                sqlTransaction.Commit();
            }
        }
Пример #2
0
        public void updateAnaquelConcat(ProductoLaboratorio producto)
        {
            string sql = "UPDATE ProductoInventario SET "
                         + "nu_anaquel_concat= '" + producto.getNuAnaquelConcat() + "' "
                         + " WHERE co_producto='" + producto.getCoProducto() + "' ";

            using (SQLiteTransaction sqlTransaction = Connection.getConexion().BeginTransaction())
            {
                SQLiteCommand command = new SQLiteCommand(sql, Connection.getConexion());
                command.ExecuteNonQuery();
                sqlTransaction.Commit();
            }
        }
Пример #3
0
        public string getNuAnaquelConcatInventario(ProductoLaboratorio producto)
        {
            string           sql             = "SELECT nu_anaquel_concat FROM ProductoInventario WHERE co_producto = '" + producto.getCoProducto() + "'";
            SQLiteCommand    command         = new SQLiteCommand(sql, Connection.getConexion());
            SQLiteDataReader reader          = command.ExecuteReader();
            String           nuAnaquelConcat = "";

            try
            {
                while (true)
                {
                    if (!reader.Read())
                    {
                        reader.Close();
                        reader = null;
                        command.Dispose();
                        command = null;
                        break;
                    }
                    nuAnaquelConcat = reader.GetString(0);
                }
            }
            catch (SQLiteException e)
            {
                throw e;
            }

            //return nuAnaquelConcat;
            return(nuAnaquelConcat);
        }
Пример #4
0
        // Refactorizado para SQLite
        public void getDatosProductoInventario(ProductoLaboratorio productoLaboratorio)
        {
            string           sql     = "SELECT ca_entero, ca_fraccion, nu_anaquel FROM ProductoInventario where co_producto='" + productoLaboratorio.getCoProducto() + "'";
            SQLiteCommand    command = new SQLiteCommand(sql, Connection.getConexion());
            SQLiteDataReader reader  = command.ExecuteReader();

            while (true)
            {
                if (!reader.Read())
                {
                    reader.Close();
                    reader = null;
                    command.Dispose();
                    command = null;
                    return;
                }
                productoLaboratorio.setCaEntero(reader.GetInt32(0));
                productoLaboratorio.setCaFraccion(reader.GetInt32(1));
                productoLaboratorio.setNuAnaquel((string)reader["nu_anaquel"]);
                productoLaboratorio.setNuevo(false);
            }
        }