private void btnAlterar_Click(object sender, EventArgs e) { for (int i = 0; i < dataGridView1.RowCount; i++) { dataGridView1.Rows[i].DataGridView.Columns.Clear(); } try { //pega codigo bloco apartamento BA ba = new BA(); BABO babo = new BABO(); ba.Apto = txtApto.Text; ba.Bloco = txtBloco.Text; babo.BuscaCodBA(ba); if ((ba.Bloco == "") || (ba.Apto == "")) { MessageBox.Show("Bloco/Apartamento não encontrado"); txtApto.Clear(); txtBloco.Clear(); } else { lblBACod.Text = Convert.ToString(ba.Ba_Cod); try { //pega codigo morador Moradores mor = new Moradores(); MoradoresBO morBO = new MoradoresBO(); mor.Nome = txtProprietario.Text; morBO.Buscar(mor); if (mor.Nome == "") { MessageBox.Show("Proprietário não encontrado"); txtProprietario.Clear(); } else { lblMoradorCod.Text = Convert.ToString(mor.CodMorador); //altera o pet try { Locacoes loc = new Locacoes(); LocacoesBO locBO = new LocacoesBO(); loc.CodLocacao = Convert.ToInt16(lblCodLocacao.Text); loc.Inicio = Convert.ToDateTime(mskHorarioInicio.Text); loc.Moradores.CodMorador = Convert.ToInt16(lblMoradorCod.Text); loc.BA.Ba_Cod = Convert.ToInt16(lblBACod.Text); loc.Termino = Convert.ToDateTime(mskHorarioTermino.Text); locBO.Editar(loc); MessageBox.Show("Locação editada com sucesso"); txtProprietario.Clear(); txtApto.Clear(); txtBloco.Clear();; mskHorarioTermino.Clear(); mskHorarioInicio.Clear(); txtBusca.Clear(); panel1.Enabled = false; btnAlterar.Enabled = false; } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }
private void btnBuscar_Click(object sender, EventArgs e) { Moradores moradores = new Moradores(); MoradoresBO moradoresBO = new MoradoresBO(); MoradorDAO moradordao = new MoradorDAO(); this.dataGridView1.DefaultCellStyle.Font = new Font("Arial", 10); if (rbtNome.Checked) { try { moradores.Nome = txtBuscaNome.Text; dataGridView1.DataSource = moradordao.BuscaMaior(txtBuscaNome.Text); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhum morador encontrado"); txtBuscaNome.Clear(); } } catch { MessageBox.Show("Preencha corretamente as informações"); } } if (rbtApto.Checked) { try { moradores.BA.Apto = txtBusca.Text; dataGridView1.DataSource = moradordao.BuscaAptoMaior(txtBusca.Text); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhum morador encontrado"); txtBusca.Clear(); } } catch { MessageBox.Show("Preencha corretamente as informações"); } } if (rbtBloco.Checked) { try { moradores.BA.Bloco = txtBusca.Text; dataGridView1.DataSource = moradordao.BuscaBlocoMaior(txtBusca.Text); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhum morador encontrado"); txtBusca.Clear(); } } catch { MessageBox.Show("Preencha corretamente as informações"); } } }
private void btnCadastrar_Click(object sender, EventArgs e) { try { //puxar codigo do ba BA ba = new BA(); BABO babo = new BABO(); ba.Apto = txtApto.Text; ba.Bloco = txtBloco.Text; babo.BuscaCodBA(ba); if ((ba.Bloco == "") || (ba.Apto == "")) { MessageBox.Show("Bloco/Apartamento não encontrado"); txtApto.Clear(); txtBloco.Clear(); } else { lblBACod.Text = Convert.ToString(ba.Ba_Cod); //ouxar codigo do morador try { Moradores mor = new Moradores(); MoradoresBO morBO = new MoradoresBO(); mor.Nome = txtProprietario.Text; morBO.Buscar(mor); if (mor.Nome == "") { MessageBox.Show("Proprietário não encontrado"); txtProprietario.Clear(); } else { lblMoradorCod.Text = Convert.ToString(mor.CodMorador); try { //add ocorrencias Ocorrencias ocorrencias = new Ocorrencias(); OcorrenciasBO ocorrenciasBO = new OcorrenciasBO(); ocorrencias.Motivo = txtMotivo.Text; if ((ocorrencias.Motivo == "") || (ocorrencias.Motivo == null)) { MessageBox.Show("Motivo não identificado"); } else { ocorrencias.Motivo = txtMotivo.Text.ToUpper(); ocorrencias.Moradores.CodMorador = Convert.ToInt16(lblMoradorCod.Text); ocorrencias.BA.Ba_Cod = Convert.ToInt16(lblBACod.Text); ocorrencias.Data = Convert.ToDateTime(mskData.Text); ocorrenciasBO.Gravar(ocorrencias); MessageBox.Show("Ocorrência cadastrada com sucesso"); txtProprietario.Clear(); txtApto.Clear(); txtBloco.Clear(); txtMotivo.Clear(); mskData.Clear(); } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }
private void btnAlterar_Click(object sender, EventArgs e) { for (int i = 0; i < dataGridView1.RowCount; i++) { dataGridView1.Rows[i].DataGridView.Columns.Clear(); } try { //puxar codigo do ba BA ba = new BA(); BABO babo = new BABO(); ba.Apto = txtApto.Text; ba.Bloco = txtBloco.Text; babo.BuscaCodBA(ba); if ((ba.Bloco == "") || (ba.Apto == "")) { MessageBox.Show("Bloco/Apartamento não encontrado"); txtApto.Clear(); txtBloco.Clear(); } else { lblBACod.Text = Convert.ToString(ba.Ba_Cod); try { Moradores mor = new Moradores(); MoradoresBO morBO = new MoradoresBO(); mor.Nome = txtNome.Text; if (mor.Nome == "") { MessageBox.Show("Criança não identificada"); txtNome.Clear(); } else { mor.CodMorador = Convert.ToInt16(lblMoradorCod.Text); mor.Nome = txtNome.Text.ToUpper(); mor.DataNasc = Convert.ToDateTime(mskDataNasc.Text); mor.Situacao = cbbSituacao.SelectedItem.ToString(); mor.Telefone = mskTelefone.Text; mor.Celular = mskCelular.Text; mor.BA.Ba_Cod = Convert.ToInt16(lblBACod.Text); morBO.Editar(mor); MessageBox.Show("Criança editada com sucesso"); txtNome.Clear(); mskDataNasc.Clear(); cbbSituacao.SelectedIndex = -1; mskTelefone.Clear(); mskCelular.Clear(); txtApto.Clear(); txtBloco.Clear(); panel1.Enabled = false; btnAlterar.Enabled = false; btnExcluir.Enabled = false; txtBusca.Clear(); txtBuscaNome.Clear(); } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }
private void btnBuscar_Click(object sender, EventArgs e) { Moradores mor = new Moradores(); MoradoresBO morBO = new MoradoresBO(); MoradorDAO DAO = new MoradorDAO(); if (rbtNome.Checked) { try { mor.Nome = txtBuscaNome.Text; dataGridView1.DataSource = DAO.BuscaMenor(txtBuscaNome.Text); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhuma criança encontrada"); txtBuscaNome.Clear(); } } catch { MessageBox.Show("Preencha corretamente as informações"); } } if (rbtApto.Checked) { try { mor.BA.Apto = txtBusca.Text; dataGridView1.DataSource = DAO.BuscaAptoMenor(txtBusca.Text); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhuma criança encontrada"); txtBusca.Clear(); } } catch { MessageBox.Show("Preencha corretamente as informações"); } } if (rbtBloco.Checked) { try { mor.BA.Bloco = txtBusca.Text; dataGridView1.DataSource = DAO.BuscaBlocoMenor(txtBusca.Text); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhuma criança encontrada"); txtBusca.Clear(); } } catch { MessageBox.Show("Preencha corretamente as informações"); } } }
private void btnAlterar_Click(object sender, EventArgs e) { for (int i = 0; i < dataGridView1.RowCount; i++) { dataGridView1.Rows[i].DataGridView.Columns.Clear(); } try { //pega codigo bloco apartamento BA ba = new BA(); BABO babo = new BABO(); ba.Apto = txtApto.Text; ba.Bloco = txtBloco.Text; babo.BuscaCodBA(ba); if ((ba.Bloco == "") || (ba.Apto == "")) { MessageBox.Show("Bloco/Apartamento não encontrado"); txtApto.Clear(); txtBloco.Clear(); } else { lblBACod.Text = Convert.ToString(ba.Ba_Cod); try { //pega codigo morador Moradores mor = new Moradores(); MoradoresBO morBO = new MoradoresBO(); mor.Nome = txtProprietario.Text; morBO.Buscar(mor); if (mor.Nome == "") { MessageBox.Show("Proprietário não encontrado"); txtProprietario.Clear(); } else { lblMoradorCod.Text = Convert.ToString(mor.CodMorador); //altera A ocorrencia try { Ocorrencias ocorrencias = new Ocorrencias(); OcorrenciasBO ocorrenciasBO = new OcorrenciasBO(); ocorrencias.Motivo = txtMotivo.Text.ToUpper(); if ((ocorrencias.Motivo == "") || (ocorrencias.Motivo == null)) { MessageBox.Show("Motivo não identificado"); } else { ocorrencias.CodOcorrencia = Convert.ToInt16(lblCodOcorrencia.Text); ocorrencias.Motivo = txtMotivo.Text.ToUpper(); ocorrencias.Moradores.CodMorador = Convert.ToInt16(lblMoradorCod.Text); ocorrencias.BA.Ba_Cod = Convert.ToInt16(lblBACod.Text); ocorrencias.Data = Convert.ToDateTime(mskData.Text); ocorrenciasBO.Editar(ocorrencias); MessageBox.Show("Ocorrência editada com sucesso"); txtProprietario.Clear(); txtApto.Clear(); txtBloco.Clear();; txtMotivo.Clear(); mskData.Clear(); txtBusca.Clear(); panel1.Enabled = false; btnAlterar.Enabled = false; lblCodOcorrencia.Text = ""; } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }
private void btnCadastrar_Click(object sender, EventArgs e) { try { //puxar codigo do ba BA ba = new BA(); BABO babo = new BABO(); ba.Apto = txtApto.Text; ba.Bloco = txtBloco.Text; babo.BuscaCodBA(ba); if ((ba.Bloco == "") || (ba.Apto == "")) { MessageBox.Show("Bloco/Apartamento não encontrado"); txtApto.Clear(); txtBloco.Clear(); } else { lblBACod.Text = Convert.ToString(ba.Ba_Cod); //cadastrar morador try { Moradores mor = new Moradores(); MoradoresBO morBO = new MoradoresBO(); mor.Nome = txtNome.Text; if ((mor.Nome == "") || (mor.Nome == null)) { MessageBox.Show("Nome do morador não identificado"); } else { mor.Nome = txtNome.Text.ToUpper(); mor.DataNasc = Convert.ToDateTime(mskDataNasc.Text); mor.Situacao = cbbSituacao.SelectedItem.ToString(); mor.Telefone = mskTelefone.Text; mor.Celular = mskCelular.Text; mor.BA.Ba_Cod = Convert.ToInt16(lblBACod.Text); morBO.Gravar(mor); MessageBox.Show("Morador cadastrado com sucesso"); txtApto.Clear(); txtBloco.Clear(); txtNome.Clear(); mskDataNasc.Clear(); cbbSituacao.SelectedIndex = -1; mskTelefone.Clear(); mskCelular.Clear(); } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }
private void btnCadastrar_Click(object sender, EventArgs e) { try { //puxar codigo do ba BA ba = new BA(); BABO babo = new BABO(); ba.Apto = txtApto.Text; ba.Bloco = txtBloco.Text; babo.BuscaCodBA(ba); if ((ba.Bloco == "") || (ba.Apto == "")) { MessageBox.Show("Bloco/Apartamento não encontrado"); txtApto.Clear(); txtBloco.Clear(); } else { lblBACod.Text = Convert.ToString(ba.Ba_Cod); //ouxar codigo do morador try { Moradores mor = new Moradores(); MoradoresBO morBO = new MoradoresBO(); mor.Nome = txtProprietario.Text; morBO.Buscar(mor); if (mor.Nome == "") { MessageBox.Show("Proprietário não encontrado"); txtProprietario.Clear(); } else { lblMoradorCod.Text = Convert.ToString(mor.CodMorador); try { //add pet Locacoes loca = new Locacoes(); LocacoesBO locaBO = new LocacoesBO(); loca.Moradores.Nome = txtProprietario.Text.ToUpper(); loca.Moradores.CodMorador = Convert.ToInt16(lblMoradorCod.Text); loca.BA.Ba_Cod = Convert.ToInt16(lblBACod.Text); loca.Inicio = Convert.ToDateTime(mskHorarioInicio.Text); loca.Termino = Convert.ToDateTime(mskHorarioTermino.Text); locaBO.Gravar(loca); MessageBox.Show("Locação cadastrada com sucesso"); txtProprietario.Clear(); txtApto.Clear(); txtBloco.Clear(); mskHorarioInicio.Clear(); mskHorarioTermino.Clear(); } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }
private void btnCadastrar_Click(object sender, EventArgs e) { try { //puxar codigo do ba BA ba = new BA(); BABO babo = new BABO(); ba.Apto = txtApto.Text; ba.Bloco = txtBloco.Text; babo.BuscaCodBA(ba); if ((ba.Bloco == "") || (ba.Apto == "")) { MessageBox.Show("Bloco/Apartamento não encontrado"); txtApto.Clear(); txtBloco.Clear(); } else { lblBACod.Text = Convert.ToString(ba.Ba_Cod); //ouxar codigo do morador try { Moradores mor = new Moradores(); MoradoresBO morBO = new MoradoresBO(); mor.Nome = txtTutor.Text; morBO.Buscar(mor); if (mor.Nome == "") { MessageBox.Show("Tutor não encontrado"); txtTutor.Clear(); } else { lblMoradorCod.Text = Convert.ToString(mor.CodMorador); try { //add pet Pets pets = new Pets(); PetsBO petsBO = new PetsBO(); pets.Nome = txtNome.Text; if ((pets.Nome == "") || (pets.Nome == null)) { MessageBox.Show("Nome do pet não identificado"); } else { pets.Nome = txtNome.Text.ToUpper(); pets.Moradores.CodMorador = Convert.ToInt16(lblMoradorCod.Text); pets.BA.Ba_Cod = Convert.ToInt16(lblBACod.Text); pets.Especie = cbbEspecie.SelectedItem.ToString(); petsBO.Gravar(pets); MessageBox.Show("Pet cadastrado com sucesso"); txtNome.Clear(); txtApto.Clear(); txtBloco.Clear(); txtTutor.Clear(); cbbEspecie.SelectedIndex = -1; } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }
private void btnAlterar_Click(object sender, EventArgs e) { for (int i = 0; i < dataGridView1.RowCount; i++) { dataGridView1.Rows[i].DataGridView.Columns.Clear(); } try { //pega codigo bloco apartamento BA ba = new BA(); BABO babo = new BABO(); ba.Apto = txtApto.Text; ba.Bloco = txtBloco.Text; babo.BuscaCodBA(ba); if ((ba.Bloco == "") || (ba.Apto == "")) { MessageBox.Show("Bloco/Apartamento não encontrado"); txtApto.Clear(); txtBloco.Clear(); } else { lblBACod.Text = Convert.ToString(ba.Ba_Cod); try { //pega codigo morador Moradores mor = new Moradores(); MoradoresBO morBO = new MoradoresBO(); mor.Nome = txtProprietario.Text; morBO.Buscar(mor); if (mor.Nome == "") { MessageBox.Show("Proprietário não encontrado"); txtProprietario.Clear(); } else { lblMoradorCod.Text = Convert.ToString(mor.CodMorador); //altera o veiculo try { Veiculos veiculos = new Veiculos(); VeiculosBO veiculosBO = new VeiculosBO(); veiculos.Modelo = txtModelo.Text; if ((veiculos.Modelo == "") || (veiculos.Modelo == null) || (veiculos.Placa == " -")) { MessageBox.Show("Preencha todos os campos"); } else { veiculos.Placa = mskPlaca.Text.ToUpper(); veiculos.Modelo = txtModelo.Text.ToUpper(); veiculos.Moradores.CodMorador = Convert.ToInt16(lblMoradorCod.Text); veiculos.BA.Ba_Cod = Convert.ToInt16(lblBACod.Text); veiculos.Cor = cbbCor.SelectedItem.ToString(); veiculosBO.Editar(veiculos); MessageBox.Show("Veículo editado com sucesso"); mskPlaca.Clear(); txtApto.Clear(); txtBloco.Clear();; txtModelo.Clear(); txtProprietario.Clear(); txtBusca.Clear(); cbbCor.SelectedIndex = -1; panel1.Enabled = false; btnAlterar.Enabled = false; btnExcluir.Enabled = false; } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }