Beispiel #1
0
        public void registrarVendedorDb()
        {
            string query_text = "INSERT INTO Vendedores (nombre, fecha_nacimiento, telefono, correo, direccion, contraseña) VALUES (" +
                                $"'{nombre}'," +
                                $"'{fechaNacimento.ToString()}'," +
                                $"'{telefono}'," +
                                $"'{correo}'," +
                                $"'{direccion}'," +
                                $"'{password}');";

            vendedor_id = DataBasePort.insertarDatos(query_text);
        }
Beispiel #2
0
        public void registrarMotoDB()
        {
            string query_register = "INSERT INTO Motos (nombre, descripcion, marca, year, modelo,color, tipo, precio, strock) VALUES (" +
                                    $"'{nombre}'," +
                                    $"'{descripcion}'," +
                                    $"'{marca}'," +
                                    $"{year}," +
                                    $"'{modelo}'," +
                                    $"'{color}'," +
                                    $"'{tipo}'," +
                                    $"{price}," +
                                    $"{stock});";

            moto_id = DataBasePort.insertarDatos(query_register);
        }
Beispiel #3
0
        public void realizarVenta(Moto moto, string nombre_cliente, string numero_tarjeta, string metodo_pago)
        {
            int   moto_id     = moto.moto_id;
            float moto_precio = moto.price;
            float IVA         = moto_precio * 0.15f;
            float Total       = moto_precio + IVA;

            string registerQuery = "INSERT INTO Ventas (vendedor_id, moto_id, nombre_cliente, numero_tarjeta, metodo_pago, monto, IVA, Total) VALUES (" +
                                   $"{vendedor_id}," +
                                   $"{moto_id}," +
                                   $"'{nombre_cliente}'," +
                                   $"'{numero_tarjeta}'," +
                                   $"'{metodo_pago}'," +
                                   $"{moto_precio}," +
                                   $"{IVA}," +
                                   $"{Total});";

            DataBasePort.insertarDatos(registerQuery);

            //Disminuir el stock
            DataBasePort.actualizarDatos($"UPDATE Motos SET strock = (strock -1) WHERE moto_id = {moto_id}");
        }