From 14481611fd9174d830abe3f53ea645e970079665 Mon Sep 17 00:00:00 2001 From: FelipeRodrigues21 Date: Sat, 7 Oct 2017 10:39:01 -0300 Subject: [PATCH] Software de controle de tarefas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adicionado os arquivos para construção do software solicitado. --- conexao.java | 41 +++++++++++++ confirmar_reativacao.jsp | 34 +++++++++++ criar_tarefa.java | 51 ++++++++++++++++ excluir.jsp | 33 ++++++++++ finalizar.jsp | 31 ++++++++++ home.jsp | 128 +++++++++++++++++++++++++++++++++++++++ reativar.jsp | 80 ++++++++++++++++++++++++ registro_tarefa.jsp | 67 ++++++++++++++++++++ tarefa.sql | 60 ++++++++++++++++++ 9 files changed, 525 insertions(+) create mode 100644 conexao.java create mode 100644 confirmar_reativacao.jsp create mode 100644 criar_tarefa.java create mode 100644 excluir.jsp create mode 100644 finalizar.jsp create mode 100644 home.jsp create mode 100644 reativar.jsp create mode 100644 registro_tarefa.jsp create mode 100644 tarefa.sql diff --git a/conexao.java b/conexao.java new file mode 100644 index 0000000..c063fd9 --- /dev/null +++ b/conexao.java @@ -0,0 +1,41 @@ +package teste; +import java.sql.*; +import java.util.*; + +public class conexao { + + private String user = "root"; + private String senha = "326126kk"; + private String link = "jdbc:mysql://127.0.0.1:3306/tarefas?autoReconnect=true&useSSL=false"; + private String driver = "com.mysql.jdbc.Driver"; + public Connection conn; + // Conectar ao banco + public Connection conectar() throws Exception { + // Registrar o driver + Class.forName(driver); + // Capturar a conex�o + conn = DriverManager.getConnection(link, user, senha); + // Retorna a conexao aberta + + + //Testa sua conex�o// + + if (conn != null) { + + System.out.println("STATUS--->Conectado com sucesso!"); + + } else { + + System.out.println("STATUS--->N�o foi possivel realizar conex�o"); + + } + + return conn; + + + } + + + + +} diff --git a/confirmar_reativacao.jsp b/confirmar_reativacao.jsp new file mode 100644 index 0000000..5870a3e --- /dev/null +++ b/confirmar_reativacao.jsp @@ -0,0 +1,34 @@ +<%@ page language="java" import="teste.conexao, java.sql.*" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + +Insert title here + + +<% +String titulo="",data="",hora_ini="",hora_fim="",descricao=""; + +titulo=request.getParameter("titulo"); +data=request.getParameter("data"); +hora_ini=request.getParameter("hora_ini"); +hora_fim=request.getParameter("hora_fim"); +descricao=request.getParameter("descricao"); + +String alterar="update tarefa set titulo='"+titulo+"',data='"+data+"',hora_ini='"+hora_ini+"',hora_fim='"+hora_fim+"',descricao='"+descricao+"',status='Pendente' where id_tarefa="+request.getParameter("id_tarefa"); +conexao banco=new conexao(); +banco.conectar(); + + +PreparedStatement stmt= banco.conn.prepareStatement(alterar); +stmt.executeUpdate(); +stmt.close(); +banco.conn.close(); + +out.print(" + +

Controle de Tarefas

+
+
+<% + String titulo="",descricao="",data="",hora_ini="",hora_fim=""; + int id_tarefa=0; + + String titulo1="",descricao1="",data1="",hora_ini1="",hora_fim1=""; + int id_tarefa1=0; + + conexao banco=new conexao(); + banco.conectar(); + +%> + + Nova Tarefa +
+
+

Tarefas Pendentes

+ +<% + + + String sql="Select id_tarefa,descricao,titulo,data,hora_ini,hora_fim from tarefa where status='Pendente' order by data desc"; + + PreparedStatement stmt= banco.conn.prepareStatement(sql); + ResultSet rs = stmt.executeQuery(); + while(rs.next()){ + + id_tarefa=(rs.getInt("id_tarefa")); + descricao=(rs.getString("descricao")); + titulo=(rs.getString("titulo")); + data=(rs.getString("data")); + hora_ini=(rs.getString("hora_ini")); + hora_fim=(rs.getString("hora_fim")); + out.println(id_tarefa+"."+titulo+"
"); + out.println("Dia:"+data+" das "+hora_ini+"as "+hora_fim+"
"); + out.println(descricao+"
"); + String redirect_finaliza="finalizar.jsp?id_tarefa="+id_tarefa; + String redirect_exclui="excluir.jsp?id_tarefa="+id_tarefa; +%> + + +
+ + + + + +

+ ------------------------------ + <% + + } + + + + + + %> +
+
+

Tarefas concl�idas

+ +<% + +String sql1="Select id_tarefa,descricao,titulo,data,hora_ini,hora_fim from tarefa where status='Encerrado'"; + +PreparedStatement stmt1= banco.conn.prepareStatement(sql1); +ResultSet rs1 = stmt1.executeQuery(); +while(rs1.next()){ + + id_tarefa1=(rs1.getInt("id_tarefa")); + descricao1=(rs1.getString("descricao")); + titulo1=(rs1.getString("titulo")); + data1=(rs1.getString("data")); + hora_ini1=(rs1.getString("hora_ini")); + hora_fim1=(rs1.getString("hora_fim")); + + out.println(id_tarefa1+"."+titulo1+"
"); + out.println("Dia:"+data1+" das "+hora_ini1+"as "+hora_fim1+"
"); + out.println(descricao1+"
"); + String redirect_reativa="reativar.jsp?id_tarefa1="+id_tarefa1; + + + + + + + + + +%> + +
+------------------------------ +
+<% + +} + +%> + + + + \ No newline at end of file diff --git a/reativar.jsp b/reativar.jsp new file mode 100644 index 0000000..308690b --- /dev/null +++ b/reativar.jsp @@ -0,0 +1,80 @@ +<%@ page language="java" import="teste.conexao,java.sql.*,java.util.*" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + +Reativar tarefa + + +

Reativa��o de Tarefa

+
+ +<% + + +String titulo1="",descricao1="",data1="",hora_ini1="",hora_fim1=""; +int id_tarefa1=0; +conexao banco=new conexao(); +banco.conectar(); + + +String sql1="Select id_tarefa,descricao,titulo,data,hora_ini,hora_fim from tarefa where status='Encerrado' and id_tarefa="+ +request.getParameter("id_tarefa1"); + +PreparedStatement stmt1= banco.conn.prepareStatement(sql1); +ResultSet rs1 = stmt1.executeQuery(); +while(rs1.next()){ + + id_tarefa1=(rs1.getInt("id_tarefa")); + descricao1=(rs1.getString("descricao")); + titulo1=(rs1.getString("titulo")); + data1=(rs1.getString("data")); + hora_ini1=(rs1.getString("hora_ini")); + hora_fim1=(rs1.getString("hora_fim")); + + String redirect_reativa="reativar.jsp?id_tarefa1="+id_tarefa1; + + +%> + +
+ + Titulo de tarefa: + +
+
+ + Data + +

+ Hor�rio Inicial + +        + + Hor�rio final + + +
+
+ + Descri��o: +

+ +
+
+ + + +
+ +
+
+ <% + } + + + %> + Voltar + + \ No newline at end of file diff --git a/registro_tarefa.jsp b/registro_tarefa.jsp new file mode 100644 index 0000000..75fe713 --- /dev/null +++ b/registro_tarefa.jsp @@ -0,0 +1,67 @@ +<%@ page language="java" import="teste.criar_tarefa" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + +Nova Tarefa + + +

Nova Tarefa

+
+ +
+ + Titulo de tarefa: + +
+
+ + Data + +

+ Hor�rio Inicial + +        + + Hor�rio final + + +
+
+ + Descri��o: +

+ +
+
+ + + +
+ +
+
+ + + <% + + String titulo=request.getParameter("titulo"); + String data=request.getParameter("data"); + String hora_ini=request.getParameter("hora_ini"); + String hora_fim=request.getParameter("hora_fim"); + String descricao=request.getParameter("descricao"); + + + + criar_tarefa registrar=new criar_tarefa(); + + registrar.get_dados(titulo,descricao,data,hora_ini,hora_fim); + + + + %> +Voltar + + + \ No newline at end of file diff --git a/tarefa.sql b/tarefa.sql new file mode 100644 index 0000000..cd6bfd4 --- /dev/null +++ b/tarefa.sql @@ -0,0 +1,60 @@ +-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) +-- +-- Host: localhost Database: tarefas +-- ------------------------------------------------------ +-- Server version 5.7.18-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `tarefa` +-- + +DROP TABLE IF EXISTS `tarefa`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tarefa` ( + `id_tarefa` int(11) NOT NULL AUTO_INCREMENT, + `titulo` varchar(60) DEFAULT NULL, + `descricao` varchar(1000) DEFAULT NULL, + `data` varchar(45) DEFAULT NULL, + `hora_ini` varchar(45) DEFAULT NULL, + `hora_fim` varchar(45) DEFAULT NULL, + `status` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id_tarefa`) +) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `tarefa` +-- + +LOCK TABLES `tarefa` WRITE; +/*!40000 ALTER TABLE `tarefa` DISABLE KEYS */; +INSERT INTO `tarefa` VALUES (4,'Limpar a casa','Limpando a casa com raiva ','2015-12-11','09:00','12:00','Encerrado'),(5,'Lavar a Lou�a','Lavar a lou�a com carinho. ','1959-12-12','12:02','13:00','Inativo'),(27,'Limpeza de casa','Limpar a casa inteira','2015-12-12','13:00','14:00','Encerrado'),(28,'Adsasasa','asasasa asasa','2012-12-12','15:00','17:00','Pendente'),(29,NULL,NULL,NULL,NULL,NULL,'Inativo'),(30,NULL,NULL,NULL,NULL,NULL,'Inativo'),(31,NULL,NULL,NULL,NULL,NULL,'Inativo'),(32,NULL,NULL,NULL,NULL,NULL,'Inativo'),(33,NULL,NULL,NULL,NULL,NULL,'Inativo'),(34,NULL,NULL,NULL,NULL,NULL,'Inativo'),(35,NULL,NULL,NULL,NULL,NULL,'Inativo'),(36,NULL,NULL,NULL,NULL,NULL,'Inativo'),(37,NULL,NULL,NULL,NULL,NULL,'Inativo'); +/*!40000 ALTER TABLE `tarefa` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping routines for database 'tarefas' +-- +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2017-10-07 10:26:10