Exemplo n.º 1
0
        private void dgvAgenda_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            TarefaDAO tarefaDao = new TarefaDAO();

            if (e.ColumnIndex == 4 && e.RowIndex != -1)
            {
                bool statusB = false;

                if (dgvAgenda.CurrentRow.Cells[4].Value.Equals("Pendente"))
                {
                    statusB = true;
                }

                Tarefa tarefa = new Tarefa
                {
                    id        = (int)dgvAgenda.CurrentRow.Cells[0].Value,
                    titulo    = dgvAgenda.CurrentRow.Cells[1].Value.ToString(),
                    descricao = dgvAgenda.CurrentRow.Cells[2].Value.ToString(),
                    tempo     = (int)dgvAgenda.CurrentRow.Cells[3].Value,
                    status    = statusB
                };

                tarefaDao.Atualizar(tarefa);
                CarregarGrid();
            }
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            TarefaDAO     tarefasDatabase = new TarefaDAO();
            List <Tarefa> tarefas         = tarefasDatabase.Listar();

            return(View(tarefas));
        }
 private void BtnPesquisar_Click(object sender, RoutedEventArgs e)
 {
     if (!txtIdTarefa.Text.Equals(""))
     {
         t = TarefaDAO.BuscarTarefaPorId(Convert.ToInt32(txtIdTarefa.Text));
         if (t != null)
         {
             txtIdTarefa.Text = t.TarefaId.ToString();
             txtNomeTarefa.Text = t.Titulo;
             txtTipo.Text = t.Tipo;
             txtStatus.Text = t.Status;
             txtPrioridade.Text = t.Prioridade.ToString();
             txtResolucao.Text = t.Resolucao;
             txtDesc.Text = t.Descricao;
             //cbAssinatura.SelectedItem = t.Assinatura.Nickname.ToString();
             //cbCliente.SelectedValue = t.Cliente.Nome;
             //cbRequisitante.SelectedValue = t.Requisitante.Nickname;
             dtCriadoEm.Text = t.CriadoEm.ToString();
         }
         else
         {
             lbMensagem.Foreground = new SolidColorBrush(Colors.DarkRed);
             MensagemDeConfirmacaoOuErro("Tarefa não encontrada !");
         }
     }
     else
     {
         lbMensagem.Foreground = new SolidColorBrush(Colors.DarkRed);
         MensagemDeConfirmacaoOuErro("Informe o nome da tarefa antes de pesquisar !");
     }
 }
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            TarefaDAO tarefaDao = new TarefaDAO();

            if (this.tarefa == null)
            {
                Tarefa tarefa = new Tarefa
                {
                    titulo    = txbTitulo.Text,
                    descricao = txbDescricao.Text,
                    tempo     = Convert.ToInt32(txbTempo.Text),
                    status    = ckbStatus.Checked
                };

                tarefaDao.Inserir(tarefa);
            }
            else
            {
                this.tarefa.titulo    = txbTitulo.Text;
                this.tarefa.descricao = txbDescricao.Text;
                this.tarefa.tempo     = Convert.ToInt32(txbTempo.Text);
                this.tarefa.status    = ckbStatus.Checked;

                tarefaDao.Atualizar(this.tarefa);
            }

            this.Close();
        }
Exemplo n.º 5
0
        protected void btnConsultar_Click(object sender, EventArgs e)
        {
            try
            {
                lblMensagem.Text = "";
                DateTime dataInicial = DateTime.ParseExact(txtDataInicial.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                DateTime dataFinal   = DateTime.ParseExact(txtDataFinal.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);

                if (dataInicial.CompareTo(dataFinal) == 1)
                {
                    lblMensagem.Text       = "Data Final é menor que a Data Inicial";
                    gridTarefas.DataSource = null;
                    gridTarefas.DataBind();
                    return;
                }

                TarefaDAO t = new TarefaDAO();
                gridTarefas.DataSource = t.ListarPorDataInicialDataFinal(dataInicial.ToString("MM/dd/yyyy"), dataFinal.ToString("MM/dd/yyyy"));
                gridTarefas.DataBind();
            }
            catch (Exception ex)
            {
                lblMensagem.Text = ex.Message;
            }
        }
Exemplo n.º 6
0
        protected void btnAtualizarCliente(object sender, EventArgs e)
        {
            try
            {
                Tarefa t = new Tarefa();
                t.Codigo      = Convert.ToInt32(txtCodigo.Text);
                t.Nome        = Convert.ToString(txtNome.Text);
                t.Tipo        = ddltipo.SelectedItem.Text;
                t.Responsavel = Convert.ToString(txtResponsavel.Text);
                t.DataEntrega = Convert.ToString(txtDataEntrega.Text);

                TarefaDAO d = new TarefaDAO();
                d.Atualizar(t);
                lblMensagem.Text = "Tarefa atualizado com sucesso.";

                txtNome.Text          = string.Empty;
                ddltipo.SelectedIndex = 0;
                txtResponsavel.Text   = string.Empty;
                txtDataEntrega.Text   = string.Empty;
            }
            catch (Exception ex)
            {
                lblMensagem.Text = ex.Message;
            }
        }
Exemplo n.º 7
0
        private void PreencherGridView()
        {
            IDAO <Tarefa> dao = new TarefaDAO();

            grdTarefa.DataSource = dao.GetAll();
            grdTarefa.DataBind();
        }
Exemplo n.º 8
0
 public ProjetoController(ProjetoDAO projetoDAO, TarefaDAO tarefaDAO, UserManager <Usuario> userManager, UsuarioDAO usuarioDAO)
 {
     _projetoDAO  = projetoDAO;
     _tarefaDAO   = tarefaDAO;
     _usuarioDAO  = usuarioDAO;
     _userManager = userManager;
 }
        public void Delete(long Id)
        {
            TarefaDAO tarefa = _context.Tarefas.FirstOrDefault(x => x.Id_Tarefa == Id);

            _context.Tarefas.Remove(tarefa);
            _context.SaveChanges();
        }
Exemplo n.º 10
0
        public Tarefa GetTarefa(long Id)
        {
            TarefaDAO tarefa  = _context.Tarefas.Find(Id);
            var       projeto = tarefa.ProjetoId_Projeto != null?_context.Projetos.Find(tarefa.ProjetoId_Projeto) : null;

            return(tarefa != null ?
                   new Tarefa
            {
                Id_Tarefa = tarefa.Id_Tarefa,
                Descricao = tarefa.Descricao,
                Observacao = tarefa.Observacao,
                Situacao = tarefa.Situacao,
                Data_Abertura = tarefa.Data_Abertura,
                Data_Entrega = tarefa.Data_Entrega,
                Projeto = projeto != null ? new Projeto
                {
                    Id_Projeto = projeto.Id_Projeto,
                    Razao_Social = projeto.Razao_Social,
                    CNPJ = projeto.CNPJ,
                    Horas_Projeto = projeto.Horas_Projeto,
                    Data_Inicial_Contrato = projeto.Data_Inicial_Contrato,
                    Observacoes = projeto.Observacoes
                } : null,
            } : null);
        }
Exemplo n.º 11
0
        protected void btnCadastrarCliente(object sender, EventArgs e)
        {
            try
            {
                Tarefa t = new Tarefa();
                t.Nome        = txtNome.Text;
                t.Tipo        = ddltipo.SelectedItem.Text;
                t.Responsavel = txtResponsavel.Text;
                t.DataEntrega = txtDataEntrega.Text;

                TarefaDAO d = new TarefaDAO();

                //Método que grava a tarefa no banco de dados
                d.Gravar(t);
                lblMensagem.Text = "Tarefa " + t.Nome + " gravado com sucesso.";

                txtNome.Text          = string.Empty;
                ddltipo.SelectedIndex = 0;
                txtResponsavel.Text   = string.Empty;
                txtDataEntrega.Text   = string.Empty;
            }
            catch (Exception er)
            {
                lblMensagem.Text = er.Message;
            }
        }
Exemplo n.º 12
0
        protected void btnPesquisar_Click(object sender, EventArgs e)
        {
            TarefaDAO dao = new TarefaDAO();

            grdTarefa.DataSource = dao.FindByTitulo(inputPesquisar.Text);
            grdTarefa.DataBind();
        }
Exemplo n.º 13
0
        private void btnConfirmar_Click(object sender, RoutedEventArgs e)
        {
            if (cmbProjeto.SelectedIndex < 0 || cmbSprint.SelectedIndex < 0 ||
                txtData.Text.Length == 0 || txtUpload.Text.Length == 0)
            {
                Alerta alerta = new Alerta("Favor preencher todos os campos");
                alerta.Show();
            }
            else
            {
                TarefaDAO       tDAO      = new TarefaDAO();
                List <DateTime> listaData = tDAO.recuperarListaDatasPorString(recuperarSprint());

                bool upload = true;
                foreach (DateTime data in listaData)
                {
                    if (Convert.ToDateTime(txtData.Text).Equals(data))
                    {
                        upload = false;
                        break;
                    }
                }

                if (upload == true)
                {
                    realizarUpload(txtUpload.Text);
                }
                else
                {
                    AlertaUpload alerta = new AlertaUpload(this, txtUpload.Text, recuperarSprint(), txtData.Text);
                    alerta.Show();
                }
            }
        }
Exemplo n.º 14
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            int       id        = (int)dgvAgenda.CurrentRow.Cells[0].Value;
            TarefaDAO tarefaDao = new TarefaDAO();

            tarefaDao.Excluir(id);
            CarregarGrid();
        }
Exemplo n.º 15
0
        private void CarregarGrid()
        {
            TarefaDAO tarefaDao = new TarefaDAO();
            DataTable dataTable = tarefaDao.GetTarefas();

            dgvAgenda.DataSource = dataTable;
            dgvAgenda.Refresh();
            statusStrip.Items[0].Text = tarefaDao.ContarTarefas() + " tarefa(s)";
        }
Exemplo n.º 16
0
        //private int ProjetoId;

        public JobController(JobDAO jobDAO, TarefaDAO tarefaDAO, DepartamentoDAO departamentoDAO, ProjetoDAO projetoDAO, StatusDAO statusDAO, IHostingEnvironment hosting)
        {
            _projetoDAO      = projetoDAO;
            _jobDAO          = jobDAO;
            _tarefaDAO       = tarefaDAO;
            _departamentoDAO = departamentoDAO;
            _statusDAO       = statusDAO;
            _hosting         = hosting;
        }
Exemplo n.º 17
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            List <Tarefa> tarefas = TarefaDAO.ListarTarefas();

            //dgTarefas.ItemsSource = TarefaDAO.ListarTarefas();
            lbUserLogado.Foreground    = new SolidColorBrush(Colors.White);
            lbUserLogado.Content       = ValidaLogin.user;
            btnConfigurações.IsEnabled = ValidaLogin.adminLogado;
        }
Exemplo n.º 18
0
        //private int JobId;

        public TarefaController(ProjetoDAO projetoDAO, JobDAO jobDAO, TarefaDAO tarefaDAO, FuncionarioDAO funcionarioDAO, StatusDAO statusDAO, IHostingEnvironment hosting)
        {
            _projetoDAO     = projetoDAO;
            _jobDAO         = jobDAO;
            _tarefaDAO      = tarefaDAO;
            _funcionarioDAO = funcionarioDAO;
            _statusDAO      = statusDAO;
            _hosting        = hosting;
        }
Exemplo n.º 19
0
        private void BtnInserir_Click(object sender, RoutedEventArgs e)
        {
            if (!txtNomeTarefa.Text.Equals("") &&
                !txtTipo.Text.Equals("") &&
                !cbRequisitante.SelectedValue.Equals("")
                )
            {
                t = new Tarefa()
                {
                    Titulo     = txtNomeTarefa.Text,
                    Tipo       = txtTipo.Text,
                    Status     = txtStatus.Text,
                    Prioridade = txtPrioridade.Text,
                    Resolucao  = txtResolucao.Text,
                    Descricao  = txtDesc.Text
                };
                p = new Projeto()
                {
                    Nome = cbProjetos.SelectedValue.ToString(),
                };//Validar aqui, cliente vazio estoura exceção
                //c = new Cliente() {
                //    Nome = cbCliente.SelectedValue.ToString(),
                //};
                assinatura = new Usuario()
                {
                    Nickname = cbAssinatura.SelectedValue.ToString(),
                };
                requisitante = new Usuario()
                {
                    Nickname = cbRequisitante.SelectedValue.ToString(),
                };
                p         = ProjetoDAO.BuscarProjetoPorNome(p.Nome);
                t.Projeto = p;

                //c = ClienteDAO.BuscarClientePorNome(c.Nome);
                //t.Cliente = c;

                assinatura   = UsuarioDAO.BuscarUsuarioPorNome(assinatura.Nickname);
                t.Assinatura = assinatura;

                requisitante   = UsuarioDAO.BuscarUsuarioPorNome(requisitante.Nickname);
                t.Requisitante = requisitante;

                t.CriadoEm = DateTime.Now;

                TarefaDAO.CadastrarTarefa(t);

                lbMensagem.Foreground = new SolidColorBrush(Colors.DarkGreen);
                MensagemDeConfirmacaoOuErro("Tarefa criada !");
                LimparCampos();
            }
            else
            {
                lbMensagem.Foreground = new SolidColorBrush(Colors.DarkRed);
                MensagemDeConfirmacaoOuErro("Preencha os campos obrigatórios para criar uma tarefa !");
            }
        }
Exemplo n.º 20
0
 public FuncionarioController(FuncionarioDAO funcionarioDAO,
     UserManager<UsuarioLogado> userManager,
     SignInManager<UsuarioLogado> signInManager,
     TarefaDAO tarefaDAO
     )
 {
     _funcionarioDAO = funcionarioDAO;
     _userManager = userManager;
     _signInManager = signInManager;
     _tarefaDAO = tarefaDAO;
 }
Exemplo n.º 21
0
        private void button1_Click(object sender, EventArgs e)
        {
            String NomeRestaurante = textBox1.Text;
            float  longitude       = Convert.ToSingle((textBox2.Text));
            float  latitude        = Convert.ToSingle((textBox3.Text));

            String Descricao  = textBox4.Text;
            String Localidade = textBox5.Text;
            String Rua        = textBox6.Text;
            String CodPostal  = textBox7.Text;
            int    Telefone;

            int.TryParse(textBox8.Text, out Telefone);
            String email = textBox9.Text;
            String datai = dateTimePicker1.Text;
            String dataf = dateTimePicker2.Text;
            int    idRestaurante;

            if ((idRestaurante = Restaurante.calculaCodigo(NomeRestaurante)) != -1)
            {
                Tarefa tar = new Tarefa(idRestaurante, longitude, latitude, Descricao, Localidade, Rua, CodPostal, Telefone, email, datai, dataf);
                if (TarefaDAO.putTarefa(tar) != -1)
                {
                    MessageBox.Show("Tarefa adicionada");
                    mp.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Ocorreu algum erro");
                    mp.Show();
                    this.Hide();
                }
            }
            else
            {
                Restaurante rest = new Restaurante(NomeRestaurante, longitude, latitude, Descricao, Localidade, Rua, CodPostal, Telefone, email);
                RestauranteDAO.putRestaurante(rest);
                idRestaurante = Restaurante.calculaCodigo(NomeRestaurante);
                Tarefa tar = new Tarefa(idRestaurante, longitude, latitude, Descricao, Localidade, Rua, CodPostal, Telefone, email, datai, dataf);
                if (TarefaDAO.putTarefa(tar) != -1)
                {
                    MessageBox.Show("Tarefa adicionada");
                    mp.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Ocorreu algum erro");
                    mp.Show();
                    this.Hide();
                }
            }
        }
Exemplo n.º 22
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            lbUserLogado.Foreground    = new SolidColorBrush(Colors.White);
            lbUserLogado.Content       = ValidaLogin.user;
            btnConfigurações.IsEnabled = ValidaLogin.adminLogado;

            int users    = UsuarioDAO.ListarUsuarios().Count;
            int projetos = ProjetoDAO.ListarProjetos().Count;
            int tarefas  = TarefaDAO.ListarTarefas().Count;

            GraficoUsuarios.Value = users;
            GraficoProjetos.Value = projetos;
            GraficoTarefas.Value  = tarefas;
        }
Exemplo n.º 23
0
        public ActionResult Delete(int id)
        {
            try
            {
                TarefaDAO tarefasDatabase = new TarefaDAO();
                tarefasDatabase.Deletar(id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 24
0
        private void btnSim_Click(object sender, RoutedEventArgs e)
        {
            TarefaDAO tDAO = new TarefaDAO();

            tDAO.excluirPorSprintPorData(this.planejadoPara, this.data);

            TarefaHistoricoDAO thDAO = new TarefaHistoricoDAO();

            thDAO.excluirPorSprintPorData(this.planejadoPara, this.data);

            this.uploadTela.realizarUpload(this.file);

            this.Close();
        }
Exemplo n.º 25
0
        protected void btnPesquisarCliente(object sender, EventArgs e)
        {
            try
            {
                lblMensagem.Text = string.Empty;
                int       codigo = Convert.ToInt32(txtCodigo.Text);
                TarefaDAO d      = new TarefaDAO();
                Tarefa    t      = d.ObterPorCodigo(codigo);

                if (t != null)
                {
                    panelDados.Visible = true;
                    txtNome.Text       = t.Nome;

                    if (t.Tipo.Equals("Atividade Complementar"))
                    {
                        ddltipo.SelectedIndex = 0;
                    }
                    else if (t.Tipo.Equals("Dependência"))
                    {
                        ddltipo.SelectedIndex = 1;
                    }
                    else if (t.Tipo.Equals("Prova"))
                    {
                        ddltipo.SelectedIndex = 2;
                    }
                    else if (t.Tipo.Equals("Trabalho"))
                    {
                        ddltipo.SelectedIndex = 3;
                    }
                    else if (t.Tipo.Equals("Outras Atividades"))
                    {
                        ddltipo.SelectedIndex = 4;
                    }

                    txtResponsavel.Text = t.Responsavel;
                    txtDataEntrega.Text = t.DataEntrega;
                }
                else
                {
                    lblMensagem.Text = "Tarefa não encontrada";
                    txtCodigo.Text   = string.Empty;
                }
            }
            catch (Exception ex)
            {
                lblMensagem.Text = ex.Message;
            }
        }
Exemplo n.º 26
0
        private void preencherLista(Dictionary <string, string> param)
        {
            try
            {
                TarefaDAO tDAO = new TarefaDAO();
                tblTarefa.ItemsSource = tDAO.recuperar(param);
            }
            catch (Exception ex)
            {
                Alerta alerta = new Alerta("Problema ao tentar acessar o banco de dados: \n" + ex.Message);
                alerta.Show();

                this.Close();
            }
        }
Exemplo n.º 27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             TarefaDAO d = new TarefaDAO();
             gridTarefas.DataSource = d.Listar(); //popular a grid
             gridTarefas.DataBind();              //exibir conteudo da grid
         }
         catch (Exception ex)
         {
             lblMensagem.Text = ex.Message;
         }
     }
 }
Exemplo n.º 28
0
        public void Update(Tarefa item)
        {
            TarefaDAO tarefa = _context.Tarefas.FirstOrDefault(x => x.Id_Tarefa == item.Id_Tarefa);

            tarefa.Descricao     = item.Descricao;
            tarefa.Observacao    = item.Observacao;
            tarefa.Situacao      = item.Situacao;
            tarefa.Data_Abertura = item.Data_Abertura;
            tarefa.Data_Entrega  = item.Data_Entrega;
            if (item.Projeto != null)
            {
                tarefa.ProjetoId_Projeto = item.Projeto.Id_Projeto;
            }

            _context.SaveChanges();
        }
Exemplo n.º 29
0
        public ActionResult Edit(int id)
        {
            Tarefa tarefa = new Tarefa();

            try
            {
                TarefaDAO tarefasDatabase = new TarefaDAO();
                tarefa = tarefasDatabase.BuscarTarefa(id);
            }
            catch
            {
                return(View());
            }

            return(View(tarefa));
        }
Exemplo n.º 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string    DataAtual = DateTime.Now.ToString("MM/dd/yyyy");
                TarefaDAO d         = new TarefaDAO();

                //Popula a Grid das tarefas que expiram na data de hoje
                gridDatas.DataSource = d.ListarPorData(DataAtual); //popular a grid
                gridDatas.DataBind();                              //exibir conteudo da grid
            }
            catch (Exception ex)
            {
                lblMensagem.Visible = true;
                lblMensagem.Text    = ex.Message;
            }
        }