Пример #1
0
        public override int ActualizarUsuario(ClassDTO usuario, Int32 id)
        {
            int res = 0;

            try
            {
                // instanciamos el objeto base de datos
                Database dataBase = DatabaseFactory.CreateDatabase();

                //comando sql a ejecutar
                string sql = "UPDATE Usuarios SET nif ='" + usuario.getNif() + "' where UsuarioID=" + id + "";

                //ejecutamos el comando

                int fila = dataBase.ExecuteNonQuery(CommandType.Text, sql);

                sql = "UPDATE Usuarios SET nombre ='" + usuario.getNombre() + "' where UsuarioID=" + id + "";

                //ejecutamos el comando

                fila = dataBase.ExecuteNonQuery(CommandType.Text, sql);

                sql = "UPDATE Usuarios SET clave ='" + usuario.getClave() + "' where UsuarioID=" + id + "";

                //ejecutamos el comando

                fila = dataBase.ExecuteNonQuery(CommandType.Text, sql);

                sql = "UPDATE Usuarios SET rol ='" + usuario.getRol() + "' where UsuarioID=" + id + "";

                //ejecutamos el comando

                fila = dataBase.ExecuteNonQuery(CommandType.Text, sql);

                sql = "UPDATE Usuarios SET telefono ='" + usuario.getTelefono() + "' where UsuarioID=" + id + "";

                //ejecutamos el comando

                fila = dataBase.ExecuteNonQuery(CommandType.Text, sql);

                sql = "UPDATE Usuarios SET email ='" + usuario.getEmail() + "' where UsuarioID=" + id + "";

                //ejecutamos el comando

                fila = dataBase.ExecuteNonQuery(CommandType.Text, sql);

                sql = "UPDATE Usuarios SET direccion ='" + usuario.getDireccion() + "' where UsuarioID=" + id + "";

                //ejecutamos el comando

                fila = dataBase.ExecuteNonQuery(CommandType.Text, sql);

                sql = "UPDATE Usuarios SET proincia ='" + usuario.getProvincia() + "' where UsuarioID=" + id + "";

                //ejecutamos el comando

                fila = dataBase.ExecuteNonQuery(CommandType.Text, sql);

                sql = "UPDATE Usuarios SET ciudad ='" + usuario.getCiudad() + "' where UsuarioID=" + id + "";

                //ejecutamos el comando

                fila = dataBase.ExecuteNonQuery(CommandType.Text, sql);

                sql = "UPDATE Usuarios SET codigopostal ='" + usuario.getCodigoPostal() + "' where UsuarioID=" + id + "";

                //ejecutamos el comando

                fila = dataBase.ExecuteNonQuery(CommandType.Text, sql);

                sql = "UPDATE Usuarios SET saldo ='" + usuario.getSaldo() + "' where UsuarioID=" + id + "";

                //ejecutamos el comando

                fila = dataBase.ExecuteNonQuery(CommandType.Text, sql);

                res = 1;
                //lblnumfilafectadas.Text = cadena.ToString();
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
            return(res);
        }