private void BntCadastrarPresidente_Click(object sender, EventArgs e) { Inserir inserir = new Inserir(); Vereador ver = new Vereador(); inserir.Cadastrar(7, Convert.ToInt32(txtNumVereador.Text), txtNomeVereador.Text, ComboBox.SelectedItem.ToString(), ver.ConsultaVereador()); }
// GET: Vereadors/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Vereador vereador = db.Vereadors.Find(id); if (vereador == null) { return(HttpNotFound()); } return(View(vereador)); }
private void salvarVereador() { //EDITAR if (CRUD == EDITAR) { for (int i = 0; i < VirtualBD.candidatos.Count; i++) { if (candidato.Nome.Equals(VirtualBD.candidatos[i].Nome) && candidato.Codigo == VirtualBD.candidatos[i].Codigo) { Vereador v = new Vereador(); v.Nome = nome.Text; v.Partido = VirtualBD.partidos[partido_combo_box.SelectedIndex]; v.Email = email.Text; v.Nascimento = data_nascimento.Value; v.Codigo = candidato.Codigo; VirtualBD.candidatos[i] = v; this.Close(); } } }//CADASTRAR else if (CRUD == CADASTRAR) { for (int i = 0; i < VirtualBD.candidatos.Count; i++) { if (int.Parse(codigo_candidato.Text) == VirtualBD.candidatos[i].Codigo) { MessageBox.Show("Código já cadastrado", "Candidato", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } } Vereador v = new Vereador(); v.Nome = nome.Text; v.Partido = VirtualBD.partidos[partido_combo_box.SelectedIndex]; v.Email = email.Text; v.Nascimento = data_nascimento.Value; v.Codigo = int.Parse(codigo_candidato.Text); VirtualBD.candidatos.Add(v); this.Close(); } }
private void FormVereadores_Load(object sender, EventArgs e) { AtualizarPartidos(); AtualizarMaximoCaracteres(); openFileDialog.Title = "Escolher Imagem"; cbSexo.Items.AddRange(SexosHuman.Types); cbSexo.SelectedIndex = 0; this.ActiveControl = txNome; this.vereador = new Vereador(); }