private void btn_cadastrar_Click(object sender, EventArgs e) { var caminho = "https://localhost:44355/AdmProfessor/Adicionar"; AdmProfessor pessoa = new AdmProfessor(); pessoa.Nome = txt_nome.Text; pessoa.Sobrenome = txt_sobrenome.Text; pessoa.Cpf = txt_cpf.Text; pessoa.DataNascimento = Convert.ToDateTime(txt_data.Text); pessoa.Função = cb_função.Text; var verificador = new Validaçoes().Verificaadmprofessocadastro(pessoa); if (verificador.Valido) { new Adicionar().Add(pessoa, caminho); txt_nome.Clear(); txt_sobrenome.Clear(); txt_data.Clear(); txt_cpf.Clear(); MessageBox.Show(" Cadastrado!"); } else { MessageBox.Show(verificador.Erros); } }
private void btn_cadastro_Click(object sender, EventArgs e) { var verificador = new Validaçoes().VerificaNota(txt_nota.Text); if (verificador.Valido) { var caminho = "https://localhost:44355/Materia/Nota"; AlunoMateriaNotas nota = new AlunoMateriaNotas(); var materia = cb_materia.Text; materia = materia.Substring(0, materia.IndexOf("-")); nota.IdMateria = Convert.ToInt32(materia); var aluno = cb_aluno.Text; aluno = aluno.Substring(0, aluno.IndexOf("-")); nota.IdAluno = Convert.ToInt32(aluno); nota.Nota = Convert.ToInt32(txt_nota.Text); var httpClient = new HttpClient(); var resultRequest = httpClient.PostAsync($"{caminho}?idaluno={nota.IdAluno}&idmateria={nota.IdMateria}¬a={nota.Nota}", null); resultRequest.Wait(); var result = resultRequest.Result.Content.ReadAsStringAsync(); result.Wait(); MessageBox.Show(result.Result); txt_nota.Clear(); } else { MessageBox.Show(verificador.Erros); } }
private void btn_verificar_Click(object sender, EventArgs e) { try { var verificador = new Validaçoes().VerificaCpf(txt_cpf.Text); if (verificador.Valido) { var cpf = txt_cpf.Text; var httpClient = new HttpClient(); var URL = "https://localhost:44355/Aluno/ListarNotas"; var resultRequest = httpClient.GetAsync($"{URL}?cpf={cpf}"); var result = resultRequest.GetAwaiter().GetResult(); if (result.IsSuccessStatusCode) { var resultJson = result.Content.ReadAsStringAsync() .GetAwaiter().GetResult(); var data = JsonConvert.DeserializeObject <List <AlunoMateriaNotas> >(resultJson); foreach (var materia in data) { txt_notas.Text = $"Materia : {materia.Materia.Nome}\t Nota : {materia.Nota}"; } } } else { MessageBox.Show(verificador.Erros); } } catch { } }
public void data() { var data = "15/02/2005"; var result = new Validaçoes().Verificadata(data); Assert.True(result.Valido); }
public void dataerro() { var data = "158/02/2005"; var result = new Validaçoes().Verificadata(data); Assert.False(result.Valido); }
public void cpffalse() { var cpf = "12345678912aa"; var result = new Validaçoes().VerificaCpf(cpf); Assert.False(result.Valido); }
public void cpf() { var cpf = "12345678912"; var result = new Validaçoes().VerificaCpf(cpf); Assert.True(result.Valido); }
public void Notafalse() { AlunoMateriaNotas nota = new AlunoMateriaNotas { Nota = 200 }; var result = new Validaçoes().VerificaNota(nota.Nota.ToString()); Assert.False(result.Valido); }
public void CadastroAdmProf() { AdmProfessor pessoa = new AdmProfessor() { Nome = "Camila", Sobrenome = "Martins", DataNascimento = Convert.ToDateTime("12/09/1996"), Cpf = "36201777123", Função = "Professor" }; var result = new Validaçoes().Verificaadmprofessocadastro(pessoa); Assert.True(result.Valido); }
public void CadastroMateriadata() { Materia materia = new Materia() { Nome = "Camila", Descrição = "Martins1111", DataCadastro = Convert.ToDateTime("12/09/2021"), Situação = "Ativa", IdCurso = 1 }; var result = new Validaçoes().VerificaMateria(materia); Assert.False(result.Valido); }
public void CadastroAlunoNãovalidoidade() { Aluno aluno = new Aluno() { Nome = "Camila", Sobrenome = "Martins", DataNascimento = Convert.ToDateTime("12/09/2010"), Cpf = "36201777123", IdCurso = 1, Função = "Aluno" }; var result = new Validaçoes().Verificaalunocadastro(aluno); Assert.False(result.Valido); }
public void CadastroAlunoValido() { Aluno aluno = new Aluno() { Nome = "Camila", Sobrenome = "Martins", DataNascimento = Convert.ToDateTime("12/09/1996"), Cpf = "65478912358", IdCurso = 1, Função = "Aluno" }; var result = new Validaçoes().Verificaalunocadastro(aluno); Assert.True(result.Valido); }
private void button1_Click(object sender, EventArgs e) { var verificadata = new Validaçoes().Verificadata(txt_data.Text); if (verificadata.Valido) { var caminho = "https://localhost:44355/Materia/Adicionar"; Materia materia = new Materia(); materia.Nome = txt_nome.Text; materia.Descrição = txt_descrição.Text; materia.DataCadastro = Convert.ToDateTime(txt_data.Text); materia.IdCurso = (cb_curso.SelectedIndex) + 1; materia.Situação = cb_situação.Text; var verificador = new Validaçoes().VerificaMateria(materia); if (verificador.Valido) { var httpClient = new HttpClient(); var serializedProduto = JsonConvert.SerializeObject(materia); var content = new StringContent(serializedProduto, Encoding.UTF8, "application/json"); var resultRequest = httpClient.PostAsync(caminho, content); resultRequest.Wait(); var result = resultRequest.Result.Content.ReadAsStringAsync(); result.Wait(); txt_nome.Clear(); txt_data.Clear(); txt_descrição.Clear(); MessageBox.Show(result.Result); } else { MessageBox.Show(verificador.Erros); } } else { MessageBox.Show(verificadata.Erros); } }
private void btn_cadastrar_Click(object sender, EventArgs e) { var verificadata = new Validaçoes().Verificadata(txt_data.Text); var verficacpf = new Validaçoes().Existecpfaluno(txt_cpf.Text); if (verificadata.Valido && verficacpf.Valido) { var caminho = "https://localhost:44355/Aluno/Adicionar"; Aluno aluno = new Aluno(); aluno.Nome = txt_nome.Text; aluno.Sobrenome = txt_sobrenome.Text; aluno.Cpf = txt_cpf.Text; aluno.DataNascimento = Convert.ToDateTime(txt_data.Text); aluno.Função = "Aluno"; var curso = cb_curso.Text; curso = curso.Substring(0, curso.IndexOf("-")); aluno.IdCurso = Convert.ToInt32(curso); var verificador = new Validaçoes().Verificaalunocadastro(aluno); if (verificador.Valido) { new Adicionar().Add(aluno, caminho); txt_nome.Clear(); txt_sobrenome.Clear(); txt_data.Clear(); txt_cpf.Clear(); MessageBox.Show("Aluno Cadastrado!"); } else { MessageBox.Show(verificador.Erros); } } else { MessageBox.Show(verificadata.Erros); } }