コード例 #1
0
        private void btnSalvar_Click(object sender, RoutedEventArgs e)
        {
            if (txtNome.Text.Length == 0 || cmbLotacao.SelectedIndex < 0)
            {
                Alerta alerta = new Alerta("Favor preencher todos os campos");
                alerta.Show();
            }
            else
            {
                string      lotacao = Convert.ToString(((ComboBoxItem)cmbLotacao.SelectedItem).Content);
                Funcionario f       = new Funcionario(Convert.ToInt32(txtCodigo.Text), lotacao, txtNome.Text);

                FuncionarioDAO sDAO = new FuncionarioDAO();
                if (f.Codigo == 0)
                {
                    sDAO.incluir(f.encapsularLista());
                }
                else
                {
                    sDAO.atualizar(f.encapsularLista());
                }

                Alerta alerta = new Alerta("Salvo com sucesso.");
                alerta.Show();

                iniciarCampos();

                preencherLista();
            }
        }
コード例 #2
0
        private void gerarBurndown()
        {
            if (cmbSprint.SelectedIndex >= 0)
            {
                ComboBoxItem item   = (ComboBoxItem)cmbSprint.SelectedItem;
                int          codigo = Convert.ToInt32(item.Tag);

                SprintDAO     sDAO  = new SprintDAO();
                List <Sprint> lista = sDAO.recuperar(Sprint.criarListaParametros(codigo));
                if (lista.Count > 0)
                {
                    Sprint sprint  = lista[0];
                    int    numDias = sprint.DtFinal.Subtract(sprint.DtInicio).Days + 1;

                    //Eixo X
                    List <string> listaX = gerarEixoX(sprint);

                    //Eixo Y
                    TarefaHistoricoDAO thDAO           = new TarefaHistoricoDAO();
                    decimal            estimativaTotal = thDAO.recuperarEstimativaTotalPorSprint(sprint.Nome);

                    if (estimativaTotal > 0)
                    {
                        gerarGrafico(sprint.Nome, numDias, estimativaTotal, listaX);
                    }
                    else
                    {
                        Alerta alerta = new Alerta("Não Existem Tarefas com estimativas.");
                        alerta.Show();
                    }
                }
            }
        }
コード例 #3
0
        private void btnSalvar_Click(object sender, RoutedEventArgs e)
        {
            if (txtNome.Text.Length == 0 || txtId.Text.Length == 0 ||
                txtDtInicio.Text.Length == 0 || txtDtFinal.Text.Length == 0)
            {
                Alerta alerta = new Alerta("Favor preencher todos os campos");
                alerta.Show();
            }
            else if (!Util.Util.verificarStringNumero(txtId.Text))
            {
                Alerta alerta = new Alerta("Preencha o campo Id com numero");
                alerta.Show();
            }
            else
            {// int codigo, int ss, string tipo, int id, string nome, string sistema, string linguagem, string processo, string tipoProjeto,
             // string situacao, int conclusividade, decimal pfprev, decimal pfreal, decimal apropriacao, DateTime dtInicio, DateTime dtEntrega, DateTime dtFinal

                Projeto   p      = preencherProjeto();
                ProjetoBO projBO = new ProjetoBO();
                projBO.salvar(p);

                Alerta alerta = new Alerta("Salvo com sucesso.");
                alerta.Show();

                prepararTela();
                preencherLista(new Dictionary <string, string>());
            }
        }
コード例 #4
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();
                }
            }
        }
コード例 #5
0
        private void btnExcluir_Click(object sender, RoutedEventArgs e)
        {
            Projeto p = recuperarProjeto();

            if ((p != null) && (Convert.ToInt32(txtCodigo.Text) > 0) && (txtNome.Text.Length != 0 && cmbProjeto.SelectedIndex >= 0 &&
                                                                         txtDtInicio.Text.Length != 0 && txtDtFinal.Text.Length != 0))
            {
                Sprint s = new Sprint(Convert.ToInt32(txtCodigo.Text), txtNome.Text, Convert.ToDateTime(txtDtInicio.Text),
                                      Convert.ToDateTime(txtDtFinal.Text), p);

                if (p.Codigo > 0)
                {
                    SprintDAO sDAO = new SprintDAO();
                    sDAO.excluir(s.encapsularLista());

                    Alerta alerta = new Alerta("Excluido com sucesso.");
                    alerta.Show();
                }
            }
            else
            {
                Alerta alerta = new Alerta("Projeto não existente ou os dados do projeto foram alterados. Favor selecionar o projeto novamente.");
                alerta.Show();
            }

            iniciarCampos();
            preencherLista();
        }
コード例 #6
0
        private void btnSalvar_Click(object sender, RoutedEventArgs e)
        {
            if (txtNome.Text.Length == 0 || txtId.Text.Length == 0 ||
                txtDtInicio.Text.Length == 0 || txtDtFinal.Text.Length == 0)
            {
                Alerta alerta = new Alerta("Favor preencher todos os campos");
                alerta.Show();
            }
            else if (!Util.verificarStringNumero(txtId.Text))
            {
                Alerta alerta = new Alerta("Preencha o campo Id com numero");
                alerta.Show();
            }
            else
            {
                Projeto p = new Projeto(Convert.ToInt32(txtCodigo.Text), txtNome.Text, Convert.ToInt32(txtId.Text), Convert.ToDateTime(txtDtInicio.Text),
                                        Convert.ToDateTime(txtDtFinal.Text));

                ProjetoDAO pDAO = new ProjetoDAO();
                if (p.Codigo == 0)
                {
                    pDAO.incluir(p.encapsularLista());
                }
                else
                {
                    pDAO.atualizar(p.encapsularLista());
                }

                Alerta alerta = new Alerta("Salvo com sucesso.");
                alerta.Show();

                iniciarCampos();
                preencherLista();
            }
        }
コード例 #7
0
        private void btnSalvar_Click(object sender, RoutedEventArgs e)
        {
            if (txtNome.Text.Length == 0 || cmbProjeto.SelectedIndex < 0 ||
                txtDtInicio.Text.Length == 0 || txtDtFinal.Text.Length == 0)
            {
                Alerta alerta = new Alerta("Favor preencher todos os campos");
                alerta.Show();
            }
            else
            {
                Projeto p = recuperarProjeto();
                if (p != null)
                {
                    Sprint s = new Sprint(Convert.ToInt32(txtCodigo.Text), txtNome.Text, Convert.ToDateTime(txtDtInicio.Text),
                                          Convert.ToDateTime(txtDtFinal.Text), p);

                    SprintDAO sDAO = new SprintDAO();
                    if (s.Codigo == 0)
                    {
                        sDAO.incluir(s.encapsularLista());
                    }
                    else
                    {
                        sDAO.atualizar(s.encapsularLista());
                    }

                    Alerta alerta = new Alerta("Salvo com sucesso.");
                    alerta.Show();

                    iniciarCampos();

                    preencherLista();
                }
            }
        }
コード例 #8
0
        private void btnPesquisar_Click(object sender, RoutedEventArgs e)
        {
            Dictionary <string, string> param = new Dictionary <string, string>();

            if (txtFiltroNome.Text.Length > 0)
            {
                param.Add(Funcionario.NOME, txtFiltroNome.Text);
            }
            if (cmbFiltroLotacao.SelectedIndex > 0)
            {
                param.Add(Funcionario.LOTACAO, Convert.ToString(((ComboBoxItem)cmbFiltroLotacao.SelectedItem).Content));
            }

            if (param.Count > 0)
            {
                try
                {
                    FuncionarioDAO pDAO = new FuncionarioDAO();
                    tblFuncionario.ItemsSource = pDAO.recuperar(param);
                }
                catch (Exception ex)
                {
                    Alerta alerta = new Alerta("Problema ao tentar acessar o banco de dados: \n" + ex.Message);
                    alerta.Show();

                    this.Close();
                }
            }
            else
            {
                preencherLista();
            }
        }
コード例 #9
0
        private void btnExcluir_Click(object sender, RoutedEventArgs e)
        {
            if (Convert.ToInt32(txtCodigo.Text) > 0 && txtNome.Text.Length != 0 && cmbLotacao.SelectedIndex >= 0)
            {
                string      lotacao = Convert.ToString(((ComboBoxItem)cmbLotacao.SelectedItem).Content);
                Funcionario s       = new Funcionario(Convert.ToInt32(txtCodigo.Text), lotacao, txtNome.Text);

                FuncionarioDAO sDAO = new FuncionarioDAO();
                try
                {
                    sDAO.excluir(s.encapsularLista());
                    Alerta alerta = new Alerta("Excluido com sucesso.");
                    alerta.Show();
                }
                catch (Exception ex)
                {
                    Alerta alerta = new Alerta("Um erro inesperado ocorreu." + '\n' + ex.Message);
                    alerta.Show();
                }
            }
            else
            {
                Alerta alerta = new Alerta("Projeto não existente ou os dados do projeto foram alterados. Favor selecionar o projeto novamente.");
                alerta.Show();
            }

            iniciarCampos();
            preencherLista();
        }
コード例 #10
0
 private void btnConfirmar_Click(object sender, RoutedEventArgs e)
 {
     if (txtUpload.Text.Length == 0)
     {
         Alerta alerta = new Alerta("Favor preencher todos os campos");
         alerta.Show();
     }
     else
     {
         realizarUpload(txtUpload.Text);
     }
 }
コード例 #11
0
 private bool validarExibicaoTabela()
 {
     if (lstProjeto.SelectedIndex >= 0 && lstSprint.SelectedItems.Count > 0 && cmbLotacao.SelectedIndex >= 0 &&
         lstFuncionario.Items.Count > 0 && (chkTodosFuncionario.IsChecked == true || lstFuncionario.SelectedItems.Count > 0))
     {
         return(true);
     }
     else
     {
         Alerta alerta = new Alerta("Favor preencher todos os campos");
         alerta.Show();
     }
     return(false);
 }
コード例 #12
0
 private bool validarExibicaoTabela()
 {
     if (cmbLotacao.SelectedIndex >= 0 && cmbAno.SelectedIndex >= 0 && cmbMes.SelectedIndex >= 0 &&
         lstFuncionario.Items.Count > 0 && lstFuncionario.SelectedItems.Count == 1)
     {
         return(true);
     }
     else
     {
         Alerta alerta = new Alerta("Favor preencher todos os campos ou selecione apenas 1 funcionario.");
         alerta.Show();
     }
     return(false);
 }
コード例 #13
0
 private void preencherLista(Dictionary <string, string> param)
 {
     try
     {
         ItemBacklogDAO tDAO = new ItemBacklogDAO();
         tblItemBacklog.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();
     }
 }
コード例 #14
0
 private void preencherLista(Dictionary <string, string> param)
 {
     try
     {
         ProjetoBO projBO = new ProjetoBO();
         tblProjeto.ItemsSource = projBO.recuperar(param);
     }
     catch (Exception ex)
     {
         Alerta alerta = new Alerta();
         alerta.preencherMensagem("Problema ao tentar acessar o banco de dados: \n" + ex.Message);
         alerta.Show();
         this.Close();
     }
 }
コード例 #15
0
        private void preencherLista()
        {
            try
            {
                FuncionarioDAO pDAO = new FuncionarioDAO();
                tblFuncionario.ItemsSource = pDAO.recuperar();
            }
            catch (Exception ex)
            {
                Alerta alerta = new Alerta("Problema ao tentar acessar o banco de dados: \n" + ex.Message);
                alerta.Show();

                this.Close();
            }
        }
コード例 #16
0
        private void tblItemBacklog_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            // ... Get the TextBox that was edited.
            var element = e.EditingElement as System.Windows.Controls.TextBox;
            var text    = element.Text;

            ItemBacklog item = (ItemBacklog)e.Row.Item;

            var coluna = e.Column.DisplayIndex;

            // ... See if the text edit should be canceled.
            //     We cancel if the user typed a question mark.
            if (text.Length == 0)
            {
                e.Cancel = true;
            }
            else
            {
                ItemBacklogDAO iDAO = new ItemBacklogDAO();
                if (coluna < 7)
                {
                    Alerta alerta = new Alerta("Somente as colunas Valor Negocio, Tamanho, Complexidade e PF podem ser alteradas");
                    alerta.Show();
                    e.Cancel = true;
                }
                else
                {
                    if (coluna == 7)
                    {
                        item.ValorNegocio = Convert.ToInt32(text);
                    }
                    else if (coluna == 8)
                    {
                        item.Tamanho = Convert.ToInt32(text);
                    }
                    else if (coluna == 9)
                    {
                        item.Complexidade = Convert.ToInt32(text);
                    }
                    else if (coluna == 10)
                    {
                        item.Pf = Convert.ToDecimal(text);
                    }
                    iDAO.atualizar(item.encapsularLista());
                }
            }
        }
コード例 #17
0
        private void btnExcluir_Click(object sender, RoutedEventArgs e)
        {
            Projeto p = new Projeto(Convert.ToInt32(txtCodigo.Text), txtNome.Text, Convert.ToInt32(txtId.Text), Convert.ToDateTime(txtDtInicio.Text),
                                    Convert.ToDateTime(txtDtFinal.Text));

            if (p.Codigo > 0)
            {
                ProjetoDAO pDAO = new ProjetoDAO();
                pDAO.excluir(p.encapsularLista());

                Alerta alerta = new Alerta("Excluido com sucesso.");
                alerta.Show();
            }

            iniciarCampos();
            preencherLista();
        }
コード例 #18
0
        private void btnExcluir_Click(object sender, RoutedEventArgs e)
        {
            int codigo = Convert.ToInt32(txtCodigo.Text);

            if (codigo > 0)
            {
                ProjetoBO projBO = new ProjetoBO();
                Projeto   p      = preencherProjeto();
                projBO.excluir(p);

                Alerta alerta = new Alerta("Excluido com sucesso.");
                alerta.Show();
            }

            prepararTela();
            preencherLista(new Dictionary <string, string>());
        }
コード例 #19
0
        private void btnExcluir_Click(object sender, RoutedEventArgs e)
        {
            int codigo = Convert.ToInt32(txtCodigo.Text);

            if (codigo > 0)
            {
                SolicitacaoBO solicBO     = new SolicitacaoBO();
                Solicitacao   solicitacao = preencherSolicitacao();
                solicBO.excluir(solicitacao);

                Alerta alerta = new Alerta("Excluido com sucesso.");
                alerta.Show();
            }

            prepararTela();
            preencherLista(new Dictionary <string, string>());
        }
コード例 #20
0
        private void btnPesquisar_Click(object sender, RoutedEventArgs e)
        {
            Dictionary <string, string> param = new Dictionary <string, string>();

            if (txtFiltroNome.Text.Length > 0)
            {
                param.Add(Sprint.NOME, txtFiltroNome.Text);
            }
            if (cmbFiltroProjeto.SelectedIndex > 0)
            {
                int codigo = Convert.ToInt32(((ComboBoxItem)cmbFiltroProjeto.SelectedItem).Tag);
                param.Add(Sprint.PROJETO, Convert.ToString(codigo));
            }
            if (txtFiltroDtInicio.Text.Length > 0)
            {
                param.Add(Sprint.DTINICIO, txtFiltroDtInicio.Text);
            }
            if (txtFiltroDtFinal.Text.Length > 0)
            {
                param.Add(Sprint.DTFINAL, txtFiltroDtFinal.Text);
            }

            if (param.Count > 0)
            {
                try
                {
                    SprintDAO pDAO = new SprintDAO();
                    tblSprint.ItemsSource = pDAO.recuperar(param);
                }
                catch (Exception ex)
                {
                    Alerta alerta = new Alerta();
                    alerta.preencherMensagem("Problema ao tentar acessar o banco de dados: \n" + ex.Message);
                    alerta.Show();

                    this.Close();
                }
            }
            else
            {
                preencherLista();
            }
        }
コード例 #21
0
        private void btnPesquisar_Click(object sender, RoutedEventArgs e)
        {
            Dictionary <string, string> param = new Dictionary <string, string>();

            if (txtFiltroNome.Text.Length > 0)
            {
                param.Add(Projeto.NOME, txtFiltroNome.Text);
            }
            if (txtFiltroId.Text.Length > 0)
            {
                param.Add(Projeto.ID, txtFiltroId.Text);
            }
            if (txtFiltroDtInicio.Text.Length > 0)
            {
                param.Add(Projeto.DTINICIO, txtFiltroDtInicio.Text);
            }
            if (txtFiltroDtFinal.Text.Length > 0)
            {
                param.Add(Projeto.DTFINAL, txtFiltroDtFinal.Text);
            }

            if (param.Count > 0)
            {
                try
                {
                    ProjetoDAO pDAO = new ProjetoDAO();
                    tblProjeto.ItemsSource = pDAO.recuperar(param);
                }
                catch (Exception ex)
                {
                    Alerta alerta = new Alerta();
                    alerta.preencherMensagem("Problema ao tentar acessar o banco de dados: \n" + ex.Message);
                    alerta.Show();

                    this.Close();
                }
            }
            else
            {
                preencherLista();
            }
        }
コード例 #22
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                FuncionarioDAO fDAO = new FuncionarioDAO();
                fDAO.recuperar(1);
            }
            catch (Exception ex)
            {
                Alerta alerta = new Alerta("Problema ao tentar acessar o banco de dados: \n" + ex.Message);
                alerta.Show();
            }

            // testarFuncionario();
            // testarTarefa();
            // testarProjeto();
            // testarSprint();
            // testarHora();
        }
コード例 #23
0
        private void tblDefeito_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            // ... Get the TextBox that was edited.
            var element = e.EditingElement as System.Windows.Controls.TextBox;
            var text    = element.Text;

            Defeito item = (Defeito)e.Row.Item;

            var coluna = e.Column.DisplayIndex;

            // ... See if the text edit should be canceled.
            //     We cancel if the user typed a question mark.
            if (text.Length == 0)
            {
                e.Cancel = true;
            }
            else
            {
                DefeitoDAO iDAO = new DefeitoDAO();
                if (coluna < 7)
                {
                    Alerta alerta = new Alerta("Somente as colunas Resolucao e Pai podem ser alteradas");
                    alerta.Show();
                    e.Cancel = true;
                }
                else
                {
                    if (coluna == 9)
                    {
                        item.Resolucao = Convert.ToString(text);
                    }
                    else if (coluna == 10)
                    {
                        item.Pai = Convert.ToString(text);
                    }
                    iDAO.atualizar(item.encapsularLista());
                }
            }
        }
コード例 #24
0
        private void realizarUpload(string file)
        {
            string       msg  = "";
            ComboBoxItem item = (ComboBoxItem)cmbTipoCarga.SelectedItem;

            string[] linhas = System.IO.File.ReadAllLines(file);
            if (linhas.Length > 1 && validarArquivo(item.Content.ToString(), linhas[0]))
            {
                msg = "Arquivo incluido com sucesso";
                if (item.Content.Equals(Constantes.FUNCIONARIO))
                {
                    List <Funcionario> listaFuncionario = recuperarListaFuncionario(linhas);
                    FuncionarioBO      funcBO           = new FuncionarioBO();
                    funcBO.Incluir(listaFuncionario);
                }
                else if (item.Content.Equals(Constantes.TAREFA))
                {
                    List <Tarefa> listaTarefa = recuperarListaTarefa(linhas);
                    TarefaBO      tarefaBO    = new TarefaBO();
                    tarefaBO.Incluir(listaTarefa);
                }
                else if (item.Content.Equals(Constantes.DEFEITO) || item.Content.Equals(Constantes.RELATO))
                {
                    List <Bug> listaBug = recuperarListaBug(linhas);
                    BugBO      bugBO    = new BugBO(Constantes.DEFEITO);
                    bugBO.incluirLista(listaBug);
                }
                else if (item.Content.Equals(Constantes.APROPRIACAO))
                {
                    List <Apropriacao> listaApropriacao         = recuperarListaApropriacao(linhas);
                    ApropriacaoBO      apropBO                  = new ApropriacaoBO();
                    List <int>         listaTarefasInexistentes = apropBO.validarListaApropriacaoInexistente(listaApropriacao);
                    if (listaTarefasInexistentes.Count > 0)
                    {
                        msg = "As seguintes tarefas não estão cadastradas: ";
                        foreach (int i in listaTarefasInexistentes)
                        {
                            msg += i + ", ";
                        }
                        msg.Substring(0, msg.Length - 2);
                    }
                    else
                    {
                        apropBO.incluirLista(listaApropriacao);
                    }
                }
                else if (item.Content.Equals(Constantes.ITEM_BACKLOG))
                {
                    List <ItemBacklog> listaItemBacklog = recuperarListaItemBacklog(linhas);
                    ItemBacklogBO      itemBO           = new ItemBacklogBO();
                    itemBO.incluirLista(listaItemBacklog);
                }
                else if (item.Content.Equals(Constantes.SPRINT))
                {
                    List <Sprint> listaSprint = recuperarListaSprint(linhas);
                    SprintBO      itemBO      = new SprintBO();
                    itemBO.incluirLista(listaSprint);
                }
                else if (item.Content.Equals(Constantes.PROJETO))
                {
                    List <Projeto> listaProjeto = recuperarListaProjeto(linhas);
                    ProjetoBO      itemBO       = new ProjetoBO();
                    itemBO.incluirLista(listaProjeto);
                }
                else if (item.Content.Equals(Constantes.SISCOP))
                {
                    List <Siscop> listaSiscop = recuperarListaSiscop(linhas);
                    SiscopBO      itemBO      = new SiscopBO();
                    itemBO.incluirLista(listaSiscop);
                }
            }
            else
            {
                msg = "Arquivo sem dados ou invalido";
            }
            Alerta alerta = new Alerta(msg);

            alerta.Show();
        }
コード例 #25
0
        public void realizarUpload(String file)
        {
            string[] lines = System.IO.File.ReadAllLines(file);

            if (lines.Length > 1 && Util.validarArquivoDefeito(lines[0]) == true)
            {
                List <Defeito>     listaIncluir     = new List <Defeito>();
                List <Defeito>     listaAtualizar   = new List <Defeito>();
                List <Funcionario> listaFuncionario = new List <Funcionario>();
                List <Projeto>     listaProjeto     = new List <Projeto>();

                for (int i = 1; i < lines.Length; i++)
                {
                    string[] linha = lines[i].Replace("\"", "").Split('\t');
                    Defeito  item  = new Defeito();
                    item.Tipo              = linha[0];
                    item.Id                = Convert.ToInt32(linha[1]);
                    item.Titulo            = linha[2];
                    item.Responsavel       = baseWindow.recuperarFuncionarioInCache(listaFuncionario, Convert.ToString(linha[3]));
                    item.Status            = linha[4];
                    item.PlanejadoPara     = linha[5];
                    item.DataColeta        = Convert.ToDateTime(txtData.Text);
                    item.EncontradoProjeto = Convert.ToString(linha[6]);
                    item.TipoRelato        = Convert.ToString(linha[7]);
                    item.Resolucao         = Convert.ToString(linha[8]);
                    item.Pai               = linha[9].Replace("#", "");

                    int     codigo = Convert.ToInt32(((ComboBoxItem)cmbProjeto.SelectedItem).Tag);
                    string  nome   = Convert.ToString(((ComboBoxItem)cmbProjeto.SelectedItem).Content);
                    Projeto p      = baseWindow.recuperarProjetoInCache(listaProjeto, Convert.ToInt32(linha[10]), codigo, nome);
                    item.Projeto = p.Codigo;

                    if (!existeDefeito(item))
                    {
                        listaIncluir.Add(item);
                    }
                    else
                    {
                        listaAtualizar.Add(item);
                    }
                }
                DefeitoDAO tDAO = new DefeitoDAO();
                if (listaIncluir.Count > 0)
                {
                    tDAO.incluir(listaIncluir);
                }
                if (listaAtualizar.Count > 0)
                {
                    tDAO.atualizarPorId(listaAtualizar);
                }

                Alerta alerta = new Alerta("Arquivo incluido com sucesso!");
                alerta.Show();

                preencherLista(new Dictionary <string, string>());
            }
            else
            {
                Alerta alerta = new Alerta("Arquivo invalido");
                alerta.Show();
            }
        }
コード例 #26
0
        public void realizarUpload(String file)
        {
            string[] lines = System.IO.File.ReadAllLines(file);

            if (lines.Length > 1 && Util.validarArquivoItemBacklog(lines[0]) == true)
            {
                List <ItemBacklog> listaIncluir   = new List <ItemBacklog>();
                List <ItemBacklog> listaAtualizar = new List <ItemBacklog>();

                List <Projeto> listaProjeto = new List <Projeto>();

                for (int i = 1; i < lines.Length; i++)
                {
                    string[]    linha = lines[i].Replace("\"", "").Split('\t');
                    ItemBacklog item  = new ItemBacklog();
                    item.Tipo          = linha[0];
                    item.Id            = Convert.ToInt32(linha[1]);
                    item.Titulo        = linha[2];
                    item.Status        = linha[3];
                    item.PlanejadoPara = linha[4];
                    item.DataColeta    = Convert.ToDateTime(txtData.Text);
                    item.ValorNegocio  = Convert.ToInt32(linha[5].Replace("pts", "").Replace("pt", ""));
                    item.Tamanho       = Convert.ToInt32(linha[6]);
                    item.Complexidade  = Convert.ToInt32(linha[8]);
                    item.Pf            = Convert.ToDecimal(linha[9]);

                    Projeto p = recuperarProjeto(listaProjeto, Convert.ToInt32(linha[7]));
                    if (p != null)
                    {
                        item.Projeto = p.Codigo;
                    }
                    else
                    {
                        int codigo = Convert.ToInt32(((ComboBoxItem)cmbProjeto.SelectedItem).Tag);
                        item.Projeto = codigo;
                    }

                    if (!existeItemBacklog(item))
                    {
                        listaIncluir.Add(item);
                    }
                    else
                    {
                        listaAtualizar.Add(item);
                    }
                }
                ItemBacklogDAO tDAO = new ItemBacklogDAO();
                if (listaIncluir.Count > 0)
                {
                    tDAO.incluir(listaIncluir);
                }
                if (listaAtualizar.Count > 0)
                {
                    tDAO.atualizarPorId(listaAtualizar);
                }

                Alerta alerta = new Alerta("Arquivo incluido com sucesso!");
                alerta.Show();

                preencherLista(new Dictionary <string, string>());
            }
            else
            {
                Alerta alerta = new Alerta("Arquivo invalido");
                alerta.Show();
            }
        }
コード例 #27
0
        public void realizarUpload(String file)
        {
            string[] lines = System.IO.File.ReadAllLines(file);

            if (Util.validarArquivoTarefa(lines[0]) == true)
            {
                List <Funcionario> listaCacheFuncionario = new List <Funcionario>();

                TarefaDAO     tDAO             = new TarefaDAO();
                List <Tarefa> listaCacheTarefa = tDAO.recuperar();

                List <Tarefa> listaTarefaIncluir = new List <Tarefa>();

                List <Tarefa> listaTarefaAtualizar = new List <Tarefa>();

                List <Tarefa> listaTarefaHistorico = new List <Tarefa>();

                for (int i = 1; i < lines.Length; i++)
                {
                    string[] linha = lines[i].Replace("\"", "").Split('\t');

                    Tarefa t = new Tarefa();
                    // t.Codigo = reader.GetInt32(0);
                    t.Tipo                = linha[0];
                    t.Id                  = Convert.ToInt32(linha[1]);
                    t.Titulo              = linha[2];
                    t.Status              = linha[4];
                    t.PlanejadoPara       = linha[5];
                    t.Estimativa          = DataHoraUtil.formatarHora(linha[6]);
                    t.EstimativaCorrigida = DataHoraUtil.formatarHora(linha[7]);
                    t.TempoGasto          = DataHoraUtil.formatarHora(linha[8]);
                    t.Pai                 = linha[9].Replace("#", "");
                    t.DataColeta          = Convert.ToDateTime(txtData.Text);

                    String responsavel = linha[3];
                    t.Responsavel = recuperarFuncionario(listaCacheFuncionario, responsavel);

                    if (!existeTarefa(listaCacheTarefa, t))
                    {
                        listaTarefaIncluir.Add(t);
                    }
                    else
                    {
                        listaTarefaAtualizar.Add(t);
                    }
                    listaTarefaHistorico.Add(t);
                }

                if (listaTarefaIncluir.Count > 0)
                {
                    tDAO.incluir(listaTarefaIncluir);
                }
                if (listaTarefaAtualizar.Count > 0)
                {
                    tDAO.atualizar(listaTarefaAtualizar);
                }
                if (listaTarefaHistorico.Count > 0)
                {
                    TarefaHistoricoDAO thDAO = new TarefaHistoricoDAO();
                    thDAO.incluir(listaTarefaHistorico);
                }

                Alerta alerta = new Alerta("Arquivo incluido com sucesso!");
                alerta.Show();

                preencherLista(new Dictionary <string, string>());
            }
            else
            {
                Alerta alerta = new Alerta("Arquivo invalido");
                alerta.Show();
            }
        }