Ejemplo n.º 1
0
        /// <summary>
        /// Método que retorna o texto do cenário
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        private static string GetTextoCenario(MD_Cenario cenario, bool completo)
        {
            Util.CL_Files.WriteOnTheLog("Document.GetTextoCenario()", Util.Global.TipoLog.DETALHADO);
            StringBuilder texto = new StringBuilder();

            if (completo)
            {
                texto.Append("\\tDescrição\\et" + Environment.NewLine);
                texto.Append(cenario.Project.Descricao + Environment.NewLine + "|");
            }

            texto.Append("\\center\\tTestes - \\u" + (cenario.EhReparo == Enumerator.Reparo.SIM ? "Reparo" : "Mudança") + "\\eu " + cenario.Tarefa + " - Status: \\u" + cenario.Status.Nome + "\\eu - Analista " + cenario.Project.NomeTester + "\\et\\ecenter" + Environment.NewLine);
            if (!string.IsNullOrEmpty(cenario.BancoUtilizado))
            {
                texto.Append("\\tBanco:\\et" + cenario.BancoUtilizado + (cenario.BancoUtilizado.LastIndexOf('.') == (cenario.BancoUtilizado.Length - 1) ? "" : ".") + Environment.NewLine);
            }
            if (!string.IsNullOrEmpty(cenario.Entrada))
            {
                texto.Append("\\tEntrada:\\et" + Environment.NewLine + cenario.Entrada + (cenario.Entrada.LastIndexOf('.') == (cenario.Entrada.Length - 1) ? "" : ".") + Environment.NewLine);
            }
            if (!string.IsNullOrEmpty(cenario.Saida))
            {
                texto.Append("\\tSaída:\\et" + Environment.NewLine + cenario.Saida + (cenario.Saida.LastIndexOf('.') == (cenario.Saida.Length - 1) ? "" : ".") + Environment.NewLine);
            }
            if (!string.IsNullOrEmpty(cenario.Passos))
            {
                texto.Append("\\tPassos:\\et" + Environment.NewLine + cenario.Passos + (cenario.Passos.LastIndexOf('.') == (cenario.Passos.Length - 1) ? "" : ".") + Environment.NewLine);
            }

            return(texto.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Método que abre a página selecionada no treeview
        /// </summary>
        /// <param name=""></param>
        public void AbrePagina(string code)
        {
            Util.CL_Files.WriteOnTheLog("FO_Principal.AbrePagina()", Util.Global.TipoLog.DETALHADO);
            int    codigo = 0;
            string _base  = code.Split(':')[0];

            if (_base.Equals("tag"))
            {
                return;
            }
            else if (_base.Equals("projeto"))
            {
                codigo = int.Parse(code.Split(':')[1]);
                AbrirJanelaDeCadastro(codigo, int.Parse(code.Split(':')[2]), Util.Enumerator.Tarefa.VISUALIZANDO);
            }
            else if (_base.Equals("estimativa"))
            {
                codigo = int.Parse(code.Split(':')[1]);
                MD_Project project = new MD_Project(int.Parse(code.Split(':')[2]), int.Parse(code.Split(':')[3]));

                UC_CadastroEstimativa estimativa = new UC_CadastroEstimativa(this, new MD_Estimativa(codigo, project), Tarefa.VISUALIZANDO, Telas.CADASTRO_ESTIMATIVA);
                AbreJanela(estimativa, "Estimativa - " + project.Nome, Telas.CADASTRO_ESTIMATIVA);
            }
            else if (_base.Equals("cenario"))
            {
                codigo = int.Parse(code.Split(':')[1]);

                MD_Project project = new MD_Project(int.Parse(code.Split(':')[2]), int.Parse(code.Split(':')[3]));
                MD_Cenario cenario = new MD_Cenario(codigo, project);

                UC_CadastroCenarios estimativa = new UC_CadastroCenarios(this, cenario.Project, cenario, Tarefa.VISUALIZANDO, Telas.CADASTRO_ESTIMATIVA, TipoSistema.GENERICO);
                AbreJanela(estimativa, "Cenario " + cenario.Codigo, Telas.CADASTRO_CENARIO);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Método que monta o arquivo csv a partir dos anexos do cenário
        /// </summary>
        /// <param name="cenario">Cenário a se criar o relatório</param>
        /// <param name="mensagemErro">Mensagem de Erro</param>
        /// <returns>True - csv criado com sucesso; False - Não foi possível gerar o relatório</returns>
        private static bool MontaCSVCenario(MD_Cenario cenario, string caminhoSaida, ref string mensagemErro)
        {
            Util.CL_Files.WriteOnTheLog("Document.MontaCSVCenario()", Util.Global.TipoLog.DETALHADO);
            mensagemErro = "";
            try
            {
                File.Delete(Global.app_temp_file_csv);

                string[] texto = Directory.GetFiles(Global.app_Prints_directory(cenario.Project) + cenario.Codigo + "\\");
                if (texto.Count() == 0)
                {
                    return(true);
                }

                StringBuilder builder = new StringBuilder();

                bool      first     = true;
                string[]  txt       = texto[0].Split('\\');
                MD_Anexos anexo_old = MD_Anexos.RetornaAnexoFromFileName(txt[txt.Count() - 1], cenario);
                MD_Anexos anexos    = anexo_old;
                for (int i = 0; i < texto.Count(); i++)
                {
                    txt = texto[i].Split('\\');
                    FileInfo info = new FileInfo(texto[i]);
                    anexos = MD_Anexos.RetornaAnexoFromFileName(txt[txt.Count() - 1], cenario);

                    if (info.Extension.Equals(".jpg") || info.Extension.Equals(".jpeg") || info.Extension.Equals(".png"))
                    {
                        if (first)
                        {
                            builder.Append("<img src=\"" + texto[i] + "\" width=\"90%\" height=\"90%\" >");
                            anexo_old = anexos;
                            first     = false;
                        }
                        else
                        {
                            builder.Append(";<img src=\"" + texto[i] + "\" width=\"90%\" height=\"90%\" >" + Environment.NewLine);
                            builder.Append(anexo_old.Descricao + ";" + anexos.Descricao + Environment.NewLine);
                            first = true;
                        }
                    }
                }
                if (!first)
                {
                    builder.Append(";" + Environment.NewLine);
                    builder.Append(anexo_old.Descricao + ";" + Environment.NewLine);
                }

                CL_Files file = new CL_Files(caminhoSaida);
                file.WriteOnTheEnd(builder.ToString());
                file = null;
            }
            catch (Exception e)
            {
                mensagemErro = e.Message;
                CL_Files.WriteOnTheLog("Erro: " + e.Message, Global.TipoLog.SIMPLES);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Método que cria o relatório de testes
        /// </summary>
        /// <param name="cenario">Cenario para se criar o relatório</param>
        /// <param name="diretorio_saida">Diretório para salvar a saída do relatório</param>
        /// <param name="mensagem"></param>
        /// <returns></returns>
        public static bool CriaRelatorio(MD_Cenario cenario, string diretorio_saida, ref string mensagem)
        {
            CL_Files.WriteOnTheLog("Document.CriaRelatoria", Global.TipoLog.DETALHADO);
            mensagem = "";
            try
            {
                if (!CriaArquivoJson(cenario.Project, ref mensagem))
                {
                    return(false);
                }

                if (!CriaArquivoXMLFromCenario(cenario, ref mensagem))
                {
                    return(false);
                }

                if (!CriarPdf(Global.app_temp_file_xml, diretorio_saida, ref mensagem))
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                mensagem = e.Message;
                CL_Files.WriteOnTheLog("Erro: " + e.Message, Global.TipoLog.SIMPLES);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Método que cria o arquivo xml a partir de um cenário
        /// </summary>
        /// <param name="cenario">cenário a se criar o arquivo xml</param>
        /// <param name="mensagemErro">mensagem se houver erro</param>
        /// <returns></returns>
        public static bool CriaArquivoXMLFromCenario(MD_Cenario cenario, ref string mensagemErro)
        {
            CL_Files.WriteOnTheLog("Document.CriaArquivoXML", Global.TipoLog.DETALHADO);
            mensagemErro = "";

            try
            {
                File.Delete(Global.app_temp_file_xml);

                if (!MontaCSVCenario(cenario, Global.app_temp_file_csv, ref mensagemErro))
                {
                    return(false);
                }

                StringBuilder texto = new StringBuilder();

                texto.Append("<?xml version=\"1.0\"?>" + Environment.NewLine);
                texto.Append("<document>" + Environment.NewLine);
                texto.Append("  <page>" + Environment.NewLine);
                texto.Append("      <title>" + Environment.NewLine);
                texto.Append("          " + cenario.Project.NumeroTarefa + "-" + cenario.Project.Nome + " - Relatório de Testes" + Environment.NewLine);
                texto.Append("      </title>" + Environment.NewLine);
                texto.Append("      <informacoes>" + Environment.NewLine);
                texto.Append("      </informacoes>" + Environment.NewLine);
                texto.Append("      <text>" + GetTextoCenario(cenario, true) + Environment.NewLine);
                texto.Append("      </text>" + Environment.NewLine);
                texto.Append("  </page>" + Environment.NewLine);

                if (Directory.GetFiles(Global.app_Prints_directory(cenario.Project) + cenario.Codigo + "\\").Count() > 0)
                {
                    texto.Append("  <page>" + Environment.NewLine);
                    texto.Append("      <title>" + Environment.NewLine);
                    texto.Append("          Relatório de Testes" + Environment.NewLine);
                    texto.Append("      </title>" + Environment.NewLine);
                    texto.Append("      <informacoes>" + Environment.NewLine);
                    texto.Append("      </informacoes>" + Environment.NewLine);
                    texto.Append("      <table_lines>2</table_lines>" + Environment.NewLine);
                    texto.Append("      <csv_file>" + Global.app_temp_file_csv + "</csv_file>" + Environment.NewLine);
                    texto.Append("  </page>" + Environment.NewLine);
                }

                texto.Append("</document>" + Environment.NewLine);

                CL_Files arquivo = new CL_Files(Global.app_temp_file_xml);
                arquivo.WriteOnTheEnd(texto.ToString());
                arquivo = null;
            }
            catch (Exception e)
            {
                mensagemErro = e.Message;
                CL_Files.WriteOnTheLog("Erro: " + e.Message, Global.TipoLog.SIMPLES);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Evento lançado na seleção do botão direito no tree view
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void item_editar_cenario_selected_Click(object sender, EventArgs e)
        {
            Util.CL_Files.WriteOnTheLog("FO_Principal.item_editar_cenario_selected_Click()", Util.Global.TipoLog.DETALHADO);
            MenuItem item = (MenuItem)sender;

            MD_Cenario cen = (MD_Cenario)item.Tag;

            UC_CadastroCenarios cenario = new UC_CadastroCenarios(this, cen.Project, cen, Tarefa.EDITANDO, Telas.CADASTRO_CENARIO, TipoSistema.GENERICO);

            AbreJanela(cenario, "Cenário " + cen.Codigo, Telas.CADASTRO_CENARIO);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Método que adicionar os cenários de teste cadastrado para o projeto
        /// </summary>
        /// <param name="project">Projeto selecionado no node</param>
        /// /// <param name="node">Node a acionar os cenários</param>
        public void AdicionaCenarios(MD_Project project, ref TreeNode node)
        {
            Util.CL_Files.WriteOnTheLog("FO_Principal.AdicionaCenarios()", Util.Global.TipoLog.DETALHADO);
            MenuItem item_incluir_cenario = new MenuItem("Adicionar Cenário", item_incluir_caso_uso_selected_Click);
            MenuItem item_modelos_cenrios = new MenuItem("Modelos");
            MenuItem item_modelos_SSI     = new MenuItem("SSI", item_incluir_caso_usomodeloSSI_selected_Click);

            item_modelos_cenrios.MenuItems.Add(item_modelos_SSI);

            item_incluir_cenario.Tag = project.Codigo + ":" + project.NumeroTarefa;
            item_modelos_SSI.Tag     = project.Codigo + ":" + project.NumeroTarefa;

            TreeNode nodeCenarios = new TreeNode("Cenários");

            nodeCenarios.Tag                = "tag:" + -1;
            nodeCenarios.ImageIndex         = 2;
            nodeCenarios.SelectedImageIndex = 2;

            ContextMenu menuCenario = new ContextMenu();

            menuCenario.MenuItems.Add(item_incluir_cenario);
            menuCenario.MenuItems.Add(item_modelos_cenrios);
            nodeCenarios.ContextMenu = menuCenario;

            MenuItem item_editar_cenario  = new MenuItem("Editar", item_editar_cenario_selected_Click);
            MenuItem item_excluir_cenario = new MenuItem("Excluir", item_excluir_cenario_selected_Click);



            SQLiteDataReader reader = new MD_Cenario(0, project).RetornaTodosCenarios();

            while (reader.Read())
            {
                MD_Cenario cenario = new MD_Cenario(int.Parse(reader["CODIGOCEN"].ToString()), project);

                TreeNode node_cen = new TreeNode("Cenario " + cenario.TipoDoSistema.ToString());
                node_cen.Tag                = "cenario:" + cenario.Codigo + ":" + project.Codigo + ":" + project.NumeroTarefa;
                node_cen.ImageIndex         = 3;
                node_cen.SelectedImageIndex = 3;
                item_editar_cenario.Tag     = cenario;
                item_excluir_cenario.Tag    = cenario;

                ContextMenu menuCen = new ContextMenu();
                menuCen.MenuItems.Add(item_editar_cenario);
                menuCen.MenuItems.Add(item_excluir_cenario);

                node_cen.ContextMenu = menuCen;

                nodeCenarios.Nodes.Add(node_cen);
            }
            reader.Close();
            node.Nodes.Add(nodeCenarios);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Construtor principal da classe
        /// </summary>
        /// <param name="principal">Instância da tela que abriu o user control</param>
        /// <param name="project">Projeto referente o cenário de teste</param>
        /// <param name="cenario">Cenário de teste que dará o load da classe</param>
        /// <param name="tarefa">Tarefa a ser executada na tela</param>
        /// <param name="tela">Código da tela</param>
        public UC_CadastroCenarios(FO_Principal principal, MD_Project project, MD_Cenario cenario, Tarefa tarefa, Telas tela, TipoSistema sistema)
        {
            Util.CL_Files.WriteOnTheLog("UC_CadastroCenarios.UC_CadastroCenarios()", Util.Global.TipoLog.DETALHADO);
            this.principal = principal;
            this.project   = project;
            this.cenario   = cenario;
            this.tarefa    = tarefa;
            this.Tag       = (int)tela;

            InitializeComponent();
            CarregaForm();
            PopulaCampos(sistema);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Evento lançado na seleção do botão direito no tree view
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void item_incluir_caso_usomodeloLdxMail_selected_Click(object sender, EventArgs e)
        {
            Util.CL_Files.WriteOnTheLog("FO_Principal.item_incluir_caso_uso_selected_Click()", Util.Global.TipoLog.DETALHADO);
            MenuItem item = (MenuItem)sender;

            string codigo       = item.Tag.ToString().Split(':')[0];
            string numerotarefa = item.Tag.ToString().Split(':')[1];

            MD_Project project = new MD_Project(int.Parse(codigo), int.Parse(numerotarefa));
            MD_Cenario cen     = new MD_Cenario(Util.DataBase.GetIncrement("MAKCENARIOS"), project);

            UC_CadastroCenarios cenario = new UC_CadastroCenarios(this, project, cen, Tarefa.INCLUINDO, Telas.CADASTRO_CENARIO, TipoSistema.SSU);

            AbreJanela(cenario, "Cenário " + cen.Codigo, Telas.CADASTRO_CENARIO);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Evento lançado na seleção do botão direito no tree view
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void item_excluir_cenario_selected_Click(object sender, EventArgs e)
        {
            Util.CL_Files.WriteOnTheLog("FO_Principal.item_excluir_cenario_selected_Click()", Util.Global.TipoLog.DETALHADO);
            MenuItem item = (MenuItem)sender;

            MD_Cenario cen = (MD_Cenario)item.Tag;

            if (MessageBox.Show("Deseja excluir o cenário " + cen.Codigo + "?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                if (cen.Delete())
                {
                    MessageBox.Show("Excluído com sucesso!");
                    CarregaTreeView();
                }
                else
                {
                    MessageBox.Show("Erro ao excluir o cenário + " + cen.Codigo + "!");
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Método que importa backup
        /// </summary>
        /// <param name="mensagemErro"></param>
        /// <returns>True - importacao realizada; False - erro</returns>
        private static bool ImportaBancoBackup(ref string mensagemErro)
        {
            mensagemErro = "";
            try
            {
                ZipFile file = new ZipFile(Global.nome_arquivo_backup);
                file.ExtractAll(Global.app_backup_directory);
                file.Dispose();

                DataBase.CloseConnection();
                DataBase.OpenConnection(Global.app_backup_directory + Global.app_base_file.Replace(Global.app_main_directoty, ""));

                List <MD_Project> project = new List <MD_Project>();
                // Criar tabela ou campos que não existem
                MD_Project pr = new MD_Project(0, 0);

                List <MD_Estimativa> estimativas = new List <MD_Estimativa>();
                // Criar tabela ou campos que não existem
                MD_Estimativa es = new MD_Estimativa(0, pr);

                List <MD_Status> status = new List <MD_Status>();
                // Criar tabela ou campos que não existem
                MD_Status st = new MD_Status(0);

                List <MD_Cenario> cenarios = new List <MD_Cenario>();
                // Criar tabela ou campos que não existem
                MD_Cenario ce = new MD_Cenario(0, pr);

                List <MD_Anexos> anexos = new List <MD_Anexos>();
                // Criar tabela ou campos que não existem
                MD_Anexos an = new MD_Anexos(0, ce);

                string           sentenca = "SELECT CODIGOPROJ, TAREFA FROM MAKDOCUMENTS";
                SQLiteDataReader reader   = DataBase.Select(sentenca);
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        project.Add(new MD_Project(int.Parse(reader["CODIGOPROJ"].ToString()), int.Parse(reader["TAREFA"].ToString())));
                    }
                    reader.Close();
                }

                sentenca = "SELECT EST.CODIGOEST, DOC.CODIGOPROJ, EST.TAREFA FROM MAKESTIMATIVAS EST, MAKDOCUMENTS DOC WHERE DOC.TAREFA = EST.TAREFA ";
                reader   = DataBase.Select(sentenca);
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        estimativas.Add(new Model.MD_Estimativa(int.Parse(reader["CODIGOEST"].ToString()), new Model.MD_Project(int.Parse(reader["CODIGOPROJ"].ToString()), int.Parse(reader["TAREFA"].ToString()))));
                    }
                    reader.Close();
                }

                sentenca = "SELECT CODIGOSTAT FROM MAKSTATUS ";
                reader   = DataBase.Select(sentenca);
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        status.Add(new Model.MD_Status(int.Parse(reader["CODIGOSTAT"].ToString())));
                    }
                    reader.Close();
                }

                sentenca = "SELECT CEN.CODIGOCEN, DOC.CODIGOPROJ, CEN.TAREFA FROM MAKCENARIOS CEN, MAKDOCUMENTS DOC WHERE DOC.TAREFA = CEN.TAREFA ";
                reader   = DataBase.Select(sentenca);
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        cenarios.Add(new Model.MD_Cenario(int.Parse(reader["CODIGOCEN"].ToString()), new Model.MD_Project(int.Parse(reader["CODIGOPROJ"].ToString()), int.Parse(reader["TAREFA"].ToString()))));
                    }
                    reader.Close();
                }

                sentenca = "SELECT ANEX.CODIGOANEXO, CEN.CODIGOCEN, CEN.TAREFA, DOC.CODIGOPROJ FROM MAKANEXOS ANEX, MAKCENARIOS CEN, MAKDOCUMENTS DOC WHERE ANEX.TAREFA = CEN.TAREFA AND ANEX.CODIGOCEN = CEN.CODIGOCEN AND ANEX.TAREFA = DOC.TAREFA";
                reader   = DataBase.Select(sentenca);
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        anexos.Add(new Model.MD_Anexos(int.Parse(reader["CODIGOCEN"].ToString()), new Model.MD_Cenario(int.Parse(reader["CODIGOCEN"].ToString()), new Model.MD_Project(int.Parse(reader["CODIGOPROJ"].ToString()), int.Parse(reader["TAREFA"].ToString())))));
                    }
                    reader.Close();
                }

                DataBase.CloseConnection();
                DataBase.OpenConnection();

                foreach (MD_Project proj in project)
                {
                    proj.Load();

                    if (proj.Empty)
                    {
                        if (!proj.Insert())
                        {
                            return(false);
                        }
                        if (!CopiaAnexos(proj, ref mensagemErro))
                        {
                            return(false);
                        }
                    }
                }

                foreach (MD_Estimativa est in estimativas)
                {
                    est.Load();
                    if (est.Empty)
                    {
                        if (!est.Insert())
                        {
                            return(false);
                        }
                    }
                }


                foreach (MD_Status stat in status)
                {
                    stat.Load();
                    if (stat.Empty)
                    {
                        if (!stat.Insert())
                        {
                            return(false);
                        }
                    }
                }


                foreach (MD_Cenario cen in cenarios)
                {
                    cen.Load();
                    if (cen.Empty)
                    {
                        if (!cen.Insert())
                        {
                            return(false);
                        }
                    }
                }

                foreach (MD_Anexos anex in anexos)
                {
                    anex.Load();
                    if (anex.Empty)
                    {
                        if (!anex.Insert())
                        {
                            return(false);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                mensagemErro = e.Message;
                Util.CL_Files.WriteOnTheLog(mensagemErro, Global.TipoLog.SIMPLES);
                return(false);
            }
            return(true);
        }