Exemple #1
0
        public IActionResult EditarTeste(int idTeste, [FromServices] VivoDAO vivoDAO)
        {
            TestesVivo teste = vivoDAO.GetTesteVivo(idTeste);

            ViewBag.CodRelease = teste.CodRelease;
            return(View(teste));
        }
Exemple #2
0
        internal TestesVivo GetTesteVivo(int idTeste)
        {
            TestesVivo testeVivo = new TestesVivo();

            try
            {
                string ConnectionString = _configuracoes.GetConnectionString("Sanity");

                using (var mysqlCon = new MySqlConnection(ConnectionString))
                {
                    testeVivo = mysqlCon.Query <TestesVivo>("SELECT * FROM Sanity.TestesVivo Where IdTeste = @IdTeste", new { IdTeste = idTeste }).First();
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
            }

            return(testeVivo);
        }
Exemple #3
0
        internal void UpdateTesteVivo(TestesVivo teste)
        {
            try
            {
                string updateQuery = @"UPDATE Sanity.TestesVivo
                                       SET
	                                        Analista = @Analista,
	                                        Login = @Login,
	                                        Senha = @Senha,
	                                        Demanda = @Demanda,
	                                        Sistema = @Sistema,
	                                        Plataforma = @Plataforma,
	                                        TipoTeste = @TipoTeste,
	                                        Funcionalidade = @Funcionalidade,
	                                        Descricao = @Descricao,
	                                        ResultEsperado = @ResultEsperado,
	                                        TipoMassa = @TipoMassa,
	                                        Massa = @Massa,
	                                        Documento = @Documento,
	                                        ICCID = @ICCID,
	                                        LinhaGerada = @LinhaGerada,
	                                        SolicGerada = @SolicGerada,
	                                        Status = @Status,
	                                        Observacao = @Observacao
                                       WHERE IdTeste = @IdTeste;";

                string ConnectionString = _configuracoes.GetConnectionString("Sanity");
                using (MySqlConnection mySqlCon = new MySqlConnection(ConnectionString))
                {
                    mySqlCon.Execute(updateQuery, teste);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
            }
        }
Exemple #4
0
 public IActionResult EditarTeste(TestesVivo teste, [FromServices] VivoDAO vivoDAO)
 {
     vivoDAO.UpdateTesteVivo(teste);
     return(RedirectToAction("ListaTestes", "Vivo", new { idRelease = teste.IdRelease }));
 }
Exemple #5
0
        public List <TestesVivo> VivoPlanTestes(IFormFile excel, int qtdTestes, string codRelease, int IdRelease)
        {
            List <TestesVivo> testesVivo = new List <TestesVivo>();

            string sFileExtension = Path.GetExtension(excel.FileName).ToLower();
            ISheet sheetCenarios;
            ISheet sheetMassas;

            string webRootPath = _hostingEnvironment.WebRootPath;
            string fullPath    = Path.Combine(webRootPath, excel.FileName);

            using (var stream = new FileStream(fullPath, FileMode.Create))
            {
                excel.CopyTo(stream);
                stream.Position = 0;

                if (sFileExtension == ".xls")
                {
                    HSSFWorkbook hssfwb = new HSSFWorkbook(stream); //This will read the Excel 97-2000 formats
                    sheetCenarios = hssfwb.GetSheetAt(2);           //get Cenarios do Sanity
                    sheetMassas   = hssfwb.GetSheetAt(1);
                }
                else
                {
                    XSSFWorkbook hssfwb = new XSSFWorkbook(stream); //This will read 2007 Excel format
                    sheetCenarios = hssfwb.GetSheetAt(2);           //get get Cenarios do Sanity
                    sheetMassas   = hssfwb.GetSheetAt(1);
                }

                IRow headerRow = sheetCenarios.GetRow(0); //Get Header Row
                int  cellCount = headerRow.LastCellNum;

                for (int i = (sheetCenarios.FirstRowNum + 1); i <= qtdTestes; i++)
                {
                    IRow row = sheetCenarios.GetRow(i);

                    string dataMassa = row.GetCell(15)?.ToString();
                    string massa     = null;
                    if (dataMassa is null)
                    {
                    }
                    else if (dataMassa.Contains("CPFs"))
                    {
                        var cr        = new CellReference(dataMassa);
                        var rowMassas = sheetMassas.GetRow(cr.Row);
                        massa = rowMassas.GetCell(cr.Col)?.ToString();
                    }
                    else
                    {
                        massa = dataMassa;
                    }

                    TestesVivo teste = new TestesVivo
                    {
                        CodRelease     = codRelease,
                        IdRelease      = IdRelease,
                        Excluido       = 0,
                        Cenario        = Convert.ToInt32(row.GetCell(0)?.ToString()),
                        Prioridade     = Convert.ToInt32(row.GetCell(1)?.ToString()),
                        Demanda        = row.GetCell(2).ToString() ?? "Regressão",
                        Analista       = row.GetCell(3)?.ToString(),
                        Login          = row.GetCell(4)?.ToString(),
                        Senha          = row.GetCell(5)?.ToString(),
                        Status         = 0,
                        Sistema        = row.GetCell(7)?.ToString(),
                        Plataforma     = row.GetCell(8)?.ToString(),
                        Funcionalidade = row.GetCell(9)?.ToString(),
                        Size           = row.GetCell(10)?.ToString(),
                        TipoTeste      = row.GetCell(11)?.ToString(),
                        Descricao      = row.GetCell(12)?.ToString(),
                        ResultEsperado = row.GetCell(13)?.ToString(),
                        TipoMassa      = row.GetCell(14)?.ToString(),
                        Massa          = massa,
                        Documento      = row.GetCell(16)?.ToString(),
                        ICCID          = row.GetCell(17)?.ToString(),
                        SolicGerada    = row.GetCell(18)?.ToString(),
                        LinhaGerada    = row.GetCell(19)?.ToString(),
                        Observacao     = row.GetCell(20)?.ToString()
                    };
                    testesVivo.Add(teste);
                }
            }

            File.Delete(fullPath);
            return(testesVivo);
        }