Exemplo n.º 1
0
        public Tarefa Incluir(Tarefa tarefa)
        {
            var repositorioTarefa = new TarefaRepositorio();

            var tarefaNova = repositorioTarefa.Inserir(tarefa);

            return tarefaNova;
        }
Exemplo n.º 2
0
        public Tarefa Incluir(Tarefa tarefa)
        {
            var repositorioTarefa = new TarefaRepositorio();

            var tarefaNova = repositorioTarefa.Inserir(tarefa);

            return(tarefaNova);
        }
        public ActionResult Store(string titulo, int responsavel, int categoria, int projeto)
        {
            Tarefa tarefa = new Tarefa();

            tarefa.Titulo = titulo;
            tarefa.IdUsuarioResponsavel = responsavel;
            tarefa.IdCategoria          = categoria;
            tarefa.IdProjeto            = projeto;
            repository.Inserir(tarefa);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public void InserirTest()
        {
            var tarefa = new Tarefa();

            tarefa.Nome        = "Jose";
            tarefa.Concluida   = false;
            tarefa.Observacoes = "Me retornar ligação";
            tarefa.Prioridade  = Prioridade.Alta;
            tarefa.Id          = repositorio.Inserir(tarefa);

            Assert.AreNotEqual(tarefa.Id, 0);
        }
Exemplo n.º 5
0
        public void InserirTeste()
        {
            var tarefa = new Tarefa();

            tarefa.Nome       = "Limpar a casa";
            tarefa.Observacao = "Passar pano na casa toda";
            tarefa.Prioridade = Prioridade.Alta;
            tarefa.Concluida  = true;
            tarefa.Id         = repositorio.Inserir(tarefa);

            Assert.IsTrue(tarefa.Id > 0);
        }
Exemplo n.º 6
0
        public void InserirTest()
        {
            var tarefa = new Tarefa();

            tarefa.Concluida  = false;
            tarefa.Nome       = "Trocar lâmpada";
            tarefa.Obervacao  = "Obs";
            tarefa.Prioridade = Prioridade.Alta;

            var id = _tarefaRepositorio.Inserir(tarefa);

            Assert.IsTrue(id != 0);
        }
Exemplo n.º 7
0
        public void InserirTest()
        {
            var tarefa = new Tarefa();

            tarefa.Nome        = "Pagar cartão";
            tarefa.Prioridade  = Prioridade.Baixa;
            tarefa.Concluida   = false;
            tarefa.Observacoes = "Observações";

            var id = _tarefaRepositorio.Inserir(tarefa);

            Console.WriteLine(id);
        }
Exemplo n.º 8
0
        public void InserirTest()
        {
            var tarefa = new Tarefa();

            tarefa.Concluida  = true;
            tarefa.Nome       = "Teste de inserção2";
            tarefa.Prioridade = Prioridade.Baixa;
            tarefa.Observacao = "OBS Coreção 3";

            var id = _tarefarepositorio.Inserir(tarefa);

            Assert.IsTrue(id != 0);
        }
 public IActionResult Create(Tarefa tarefa)
 {
     try
     {
         repositorio.Inserir(tarefa);
         return(RedirectToAction("Index")); //volta pra pag
     }
     catch (Exception)
     {
         ModelState.AddModelError("", "Não foi possível inserir.");
         return(View(tarefa));
     }
 }
        public void InserirTest()
        {
            var tarefa = new Tarefa();

            tarefa.Concluida   = false;
            tarefa.Nome        = "Lavar Roupas";
            tarefa.Prioridade  = Prioridade.Alta;
            tarefa.Observacoes = "Urgente";

            tarefa.Id = _tarefarepositorio.Inserir(tarefa);

            Assert.AreNotEqual(tarefa.Id, 0);
        }
Exemplo n.º 11
0
        public void InserirTest()
        {
            var tarefa = new Tarefa();

            tarefa.Concluida   = false;
            tarefa.Nome        = "Passar roupa";
            tarefa.Observacoes = "Rápido";
            tarefa.Prioridade  = Prioridade.Alta;

            tarefa.Id = _tarefaRepositorio.Inserir(tarefa);

            Assert.AreNotEqual(tarefa.Id, 0);
        }
Exemplo n.º 12
0
        public ActionResult Store(string titulo, string descricao, DateTime duracao, int usuario, int projeto, int categoria)
        {
            Tarefa tarefa = new Tarefa();

            tarefa.Titulo               = titulo;
            tarefa.Descricao            = descricao;
            tarefa.Duracao              = duracao;
            tarefa.IdUsuarioResponsavel = usuario;
            tarefa.IdProjeto            = projeto;
            tarefa.IdCategoria          = categoria;
            repositorio.Inserir(tarefa);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 13
0
        public void InserirTest()
        {
            var tarefa = new Tarefa();

            tarefa.Nome        = "Fechamento";
            tarefa.Prioridade  = Prioridade.Alta; //Enum
            tarefa.Concluida   = false;
            tarefa.Observacoes = "BW Com";

            tarefa.Id = _tarefaRepositorio.Inserir(tarefa);

            Assert.AreNotEqual(tarefa.Id, 0);
        }
Exemplo n.º 14
0
        public ActionResult Create(TarefaViewModel tarefaViewModel)
        {
            try
            {
                _tarefaRepositorio.Inserir(Mapear(tarefaViewModel));

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(tarefaViewModel));
            }
        }
        public void InserirTeste()
        {
            Tarefa tarefa = new Tarefa()
            {
                Concluida  = true,
                Nome       = "Curso",
                Observacao = "Acabanco",
                Prioridade = Prioridade.Alta
            };

            tarefa.Id = repositorio.Inserir(tarefa);

            Assert.IsTrue(tarefa.Id > 0);
        }
Exemplo n.º 16
0
        public ActionResult Create(Tarefa tarefa)
        {
            try
            {
                tarefaRepositorio.Inserir(tarefa);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                ModelState.AddModelError("", "Não foi possível inserir a Tarefa."); //Onde vai ser exibito | Texto exibido
                return(View());
            }
        }
Exemplo n.º 17
0
        public void InserirTest()
        {
            var tarefa = new Tarefa();

            //tarefa.Concluida = Convert.ToBoolean(0);
            //tarefa.Concluida = Convert.ToBoolean("true");
            //tarefa.Concluida = false;
            tarefa.Concluida   = false;
            tarefa.Nome        = "Passar roupa";
            tarefa.Observacoes = "Muita roupa";
            tarefa.Prioridade  = Prioridade.Alta;

            _tarefaRepositorio.Inserir(tarefa);
        }
        public ActionResult Create(Tarefa tarefa)
        {
            try
            {
                // TODO: Add insert logic here
                tarefaRepositorio.Inserir(tarefa);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                ModelState.AddModelError("", "Não foi possível inserir a Tarefa.");
                return(View());
            }
        }
Exemplo n.º 19
0
        protected void gravarButton_Click(object sender, EventArgs e)
        {
            var tarefa = new Tarefa();

            tarefa.Concluida   = concluidaCheckBox.Checked;
            tarefa.Nome        = nomeTextBox.Text;
            tarefa.Observacoes = observacoesTextBox.Text;

            Enum.TryParse(prioridadeDropDownList.SelectedValue, out Prioridade prioridadeSelecionada);
            tarefa.Prioridade = prioridadeSelecionada;

            _tarefaRepositorio.Inserir(tarefa);

            Response.Redirect("~/Tarefas");
        }
Exemplo n.º 20
0
        public ActionResult Create(Tarefa tarefa)
        {
            try
            {
                //collection["Prioridade"]

                _tarefaRepositorio.Inserir(tarefa);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                ModelState.AddModelError("", "Não foi possível inserir a nova tarefa.");

                return(View(tarefa));
            }
        }
Exemplo n.º 21
0
        public static int RegistrarTarefa(int idusuario)
        {
            string descricao, nome;

            System.Console.WriteLine("Digite seu nome:");
            nome = Console.ReadLine();
            System.Console.WriteLine("Digite sua descrição:");
            descricao = Console.ReadLine();

            ModeloTarefas modelotarefa = new ModeloTarefas();

            modelotarefa.Nome      = nome;
            modelotarefa.Descricao = descricao;
            modelotarefa.IdUsuário = idusuario;

            tarefaRepositorio.Inserir(modelotarefa);

            System.Console.WriteLine("\nCadastro realizado com sucesso");

            return(idusuario);
        }
        public JsonResult Inserir(string usuarioLogado, TarefaInclusaoViewModel tarefaInclusaoViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    TarefaRepositorio  rep     = new TarefaRepositorio();
                    UsuarioRepositorio urep    = new UsuarioRepositorio();
                    Usuario            usuario = urep.EncontrarPorLogin(usuarioLogado);
                    Tarefa             tarefa  = new Tarefa()
                    {
                        IdTarefa    = 0,
                        Nome        = tarefaInclusaoViewModel.Nome,
                        DataEntrega = tarefaInclusaoViewModel.DataEntrega,
                        Descricao   = tarefaInclusaoViewModel.Descricao
                    };

                    Tarefa tarefa_inserida = rep.Inserir(usuario.IdUsuario, tarefa);

                    TarefaViewModel tarefaViewModel = new TarefaViewModel()
                    {
                        IdTarefa    = tarefa_inserida.IdTarefa,
                        Nome        = tarefa_inserida.Nome,
                        DataEntrega = tarefa_inserida.DataEntrega,
                        Descricao   = tarefa_inserida.Descricao
                    };

                    return(Json(new { sucesso = true, dados = tarefaViewModel }));
                }
                else
                {
                    return(Json(new { sucesso = false, dados = ModelState.Values.SelectMany(v => v.Errors).ToList() }));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 23
0
        public JsonResult CadastrarTarefa(TarefaCadastroViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var tarefa = Mapper.Map <Tarefa>(model);

                    repositorio.Inserir(tarefa);

                    return(Json($"Tarefa cadastrada com sucesso."));
                }
                catch (Exception e)
                {
                    return(Json("Ocorreu um erro: " + e.Message));
                }
            }
            else
            {
                Response.StatusCode = 400; //BAD REQUEST
                return(Json(ValidacaoUtil.ObterErros(ModelState)));
            }
        }
Exemplo n.º 24
0
        public static void CadastrarTarefa(UsuarioViewModel usuario)
        {
            string nome, descricao, tipo;
            int    IdUsuario;


            do
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Digite o nome da tarefa");
                Console.ResetColor();
                nome = Console.ReadLine();

                if (string.IsNullOrEmpty(nome))
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("Digite o nome");
                    Console.ResetColor();
                }
            } while (string.IsNullOrEmpty(nome));

            do
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Insira aqui a descrição da tarefa");
                Console.ResetColor();
                descricao = Console.ReadLine();

                if (string.IsNullOrEmpty(descricao))
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("Por favor insira a descrição");
                    Console.ResetColor();
                }
            } while (string.IsNullOrEmpty(descricao));

            do
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Insira o estágio em que se encontra a tarefa (a fazer, fazendo, feito ...)");
                Console.ResetColor();
                tipo = Console.ReadLine();

                if (string.IsNullOrEmpty(tipo))
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("Digite seu estágio na tarefa");
                    Console.ResetColor();
                }
            } while (string.IsNullOrEmpty(tipo));



            TarefaViewModel tarefaViewModel = new TarefaViewModel();

            tarefaViewModel.Nome      = nome;
            tarefaViewModel.Descricao = descricao;
            tarefaViewModel.Tipo      = tipo;

            tarefaRepositorio.Inserir(tarefaViewModel);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Tarefa cadastrada com sucesso");
            Console.ResetColor();
        }
Exemplo n.º 25
0
        public static void CadastrarTarefa()
        {
            string nomeTarefa;
            string descricaoTarefa;
            string tipoTarefa;

            System.Console.Write("Digite o título da nova Tarefa: ");
            nomeTarefa = Console.ReadLine();

            System.Console.Write("Digite a descrição da Tarefa: ");
            descricaoTarefa = Console.ReadLine();

            do
            {
                System.Console.WriteLine("Deseja adicionar a tarefa em: ");
                System.Console.WriteLine(" 1 - A FAZER");
                System.Console.WriteLine(" 2 - FAZENDO");
                System.Console.WriteLine(" 3 - FEITO");
                System.Console.Write("Código: ");
                int codigo = int.Parse(Console.ReadLine());
                if (1.Equals(codigo))
                {
                    System.Console.WriteLine("Registrando..");
                    Thread.Sleep(1500);
                    tipoTarefa = "A FAZER";
                    break;
                }
                else if (2.Equals(codigo))
                {
                    System.Console.WriteLine("Registrando..");
                    Thread.Sleep(1500);
                    tipoTarefa = "FAZENDO";
                    break;
                }
                else if (3.Equals(codigo))
                {
                    System.Console.WriteLine("Registrando..");
                    Thread.Sleep(1500);
                    tipoTarefa = "FEITO";
                    break;
                }
                else
                {
                    tipoTarefa = null;
                    System.Console.WriteLine("Código inválido, PRESS ENTER para digitar novamente");
                    Console.ReadLine();
                    // bool repetir1 = true;
                }
            } while (repetir1 == false);


            TarefaViewModel tarefa = new TarefaViewModel();

            tarefa.Nome        = nomeTarefa;
            tarefa.Descricao   = descricaoTarefa;
            tarefa.Datacriacao = DateTime.Now;
            tarefa.Id          = contador;
            tarefa.IdUsuario   = UsuarioViewController.UserSelecionado.Id;
            tarefa.TipoTarefa  = tipoTarefa;

            contador++;

            TarefaRepositorio.Inserir(tarefa);

            System.Console.WriteLine("TAREFA CADASTRADA COM SUCESSO! -- PRESS ENTER -- ");
            Console.ReadLine();
        }// FIM CADASTRAR