private void cmbCurso_SelectedIndexChanged(object sender, EventArgs e) { if (carregado) { var idcurso = cmbCurso.SelectedValue.ToString(); if (idcurso != string.Empty) { Matricula matricula = new Matricula(); matricula.ConsultarPorIdCurso(Convert.ToInt32(idcurso)); //txtNome.Text = curso.Nome; } } }
private void btnInserir_Click(object sender, EventArgs e) { Matricula curso = new Matricula(); curso.IdAluno = Convert.ToInt32(cmbAluno.SelectedValue.ToString()); curso.IdCurso = Convert.ToInt32(cmbCurso.SelectedValue.ToString()); curso.IdUsuario = Convert.ToInt32(cmbUsuario.SelectedValue.ToString()); curso.Situacao = txtsituacao.Text; curso.Horario = txtHorario.Text; curso.Valor = Convert.ToDouble(txtValor.Text); curso.DiasSemana = txtDiadasemana.Text; curso.Matricular(); LimpaControles(); MessageBox.Show("Curso cadastrado com sucesso!"); }
private void button1_Click(object sender, EventArgs e) { Matricula matricula = new Matricula(); matricula.Situacao = txtSituação.Text; matricula.Horario = txtHorario.Text; matricula.DiaSemana = txtDiaSemana.Text; matricula.ValorCurso = Convert.ToDouble(txtValorCurso.Text); matricula.Inserir(); if (matricula.Id > 0) { txtMatriculaId.Text = matricula.Id.ToString(); MessageBox.Show("Matricula feita com sucesso!"); } else { } }