private async void copiarTeste(object sender, RoutedEventArgs e) { //Mesmos passos de adicionar um novo teste if (selectedCase == null) { mainWindow.FlyOutFeedBack("Selecione um caso de teste para ser copiado."); return; } string nomeCtf; MetroDialogSettings st = new MetroDialogSettings(); st.AffirmativeButtonText = "Ok"; st.NegativeButtonText = "Cancelar"; nomeCtf = await this.mainWindow.ShowInputAsync("Copiar ", "Insira o CÓDIGO do NOVO Caso de Teste", st); if (!String.IsNullOrEmpty(nomeCtf)) { bool testExists = false; //verificar se o código não existe // foreach (TestCase test in testCases) { if (test.Codigo.ToUpper() == nomeCtf.ToUpper()) { testExists = true; } } if (testExists == false) { TestCase_DAO.CopyTestCase(nomeCtf, selectedCase); //testCaseToAddPassos.Salvar(); Sistema sisTemp = this.selectedSistema; await this.mainWindow.ShowMessageAsync("Sucesso!", "Caso de Teste " + nomeCtf.ToUpper() + " adicionado com sucesso!"); this.refresh(); foreach (Sistema item in this.sistemaComboBox.Items) { if (item.Id == sisTemp.Id) { this.selectedSistema = item; this.sistemaComboBox.SelectedItem = this.selectedSistema; break; } } } else { await this.mainWindow.ShowMessageAsync("Erro", "Caso de Teste não adicionado (Código já existe)"); } } else { await this.mainWindow.ShowMessageAsync("Código Não Informado", "O novoa Caso de Teste não foi adicionado"); } }
// GET: TestCase/Random public ViewResult Random() { Random randomizer = new Random(); List <Sistema> sistemas = Sistema_DAO.getAllSistemas().ToList(); Sistema randomSistema = sistemas[randomizer.Next(0, sistemas.Count)]; List <TestCase> testCases = TestCase_DAO.GetAllFromSistema(randomSistema); var testCase = testCases[randomizer.Next(0, testCases.Count)]; return(View(testCase)); }
// GET: TestCase public ActionResult Index() { //Recuperar Todas os TestCase possíveis List <Sistema> sistemas = Sistema_DAO.getAllSistemas().ToList(); List <TestCase> allTestCases = new List <TestCase>(); foreach (Sistema sis in sistemas) { allTestCases.AddRange(TestCase_DAO.GetAllFromSistema(sis)); } return(View(allTestCases)); }
//public ObservableCollection<Tela> getTelas() //{ // return Tela_DAO.getAllTelas(this); //} public ObservableCollection <TestCase> getTestCasesFromDb() { var testCases = new ObservableCollection <TestCase>(TestCase_DAO.GetAllFromSistema(this)); return(testCases); //ObservableCollection<TestCase> testCases = new ObservableCollection<TestCase>(); //string conexao = "Data Source=db/testplayerdb.db"; //string nomebanco = "db/testplayerdb.db"; //if (!File.Exists(nomebanco)) //{ // Logger.escrever("Não Encontrado o Arquivo de Banco. Criando.."); //} //else //{ // //Db existe // //Abre conexão // SQLiteConnection conn = new SQLiteConnection(conexao); // if (conn.State == ConnectionState.Closed) // conn.Open(); // //Carrega Registros // SQLiteCommand sql_cmd = new SQLiteCommand("SELECT * FROM TestCase WHERE IdSistema=@IdSistema", conn); // sql_cmd.Parameters.AddWithValue("@IdSistema", this.Id); // SQLiteDataReader sql_dataReader = sql_cmd.ExecuteReader(); // while (sql_dataReader.Read()) // { // TestCase testCase = new TestCase(sql_dataReader["Codigo"].ToString()); // testCase.Id = Convert.ToInt32(sql_dataReader["Id"]); // testCase.Nome = sql_dataReader["Nome"].ToString(); // testCase.Descricao = sql_dataReader["Descricao"].ToString(); // if (!sql_dataReader.IsDBNull(4)) // { // testCase.UltimaVezExecutado = Convert.ToDateTime(sql_dataReader["UltimaExec"]); // } // testCase.Funcao = sql_dataReader["FuncNome"].ToString(); // testCase.Modulo = sql_dataReader["ModuloNome"].ToString(); // if (!sql_dataReader.IsDBNull(8)) // testCase.TotalExecutado = Convert.ToInt32(sql_dataReader["TotalExec"]); // if (!sql_dataReader.IsDBNull(10)) // { // testCase.TotalApr = Convert.ToInt32(sql_dataReader["TotalAppr"]); // testCase.TotalErr = testCase.TotalExecutado - testCase.TotalApr; // } // if (!sql_dataReader.IsDBNull(9)) // { // testCase.UltimaSituacao = Convert.ToBoolean(sql_dataReader["UltimaSituacao"]); // if (testCase.UltimaSituacao == true) // { // testCase.testSituationImg = TestCase.IMG_APPR; // } // else // { // testCase.testSituationImg = TestCase.IMG_ERRO; // } // } // testCase.PreCondicao = sql_dataReader["PreCond"].ToString(); // testCase.PosCondicao = sql_dataReader["PosCond"].ToString(); // testCase.SistemaPai = this; // if (!sql_dataReader.IsDBNull(13)) // testCase.tempoEstimado = TimeSpan.Parse(DateTime.Parse(sql_dataReader["TempoEstimado"].ToString()).ToLongTimeString()); // testCases.Add(testCase); // } //} //return testCases; }
public void DeletarDoBD() { TestCase_DAO.Deletar(this); }
public void GetPassosFromDB() { TestCase_DAO.GetPassos(this); ordenarPassos(); }
public void Salvar() { TestCase_DAO.Salvar(this); }