public void Gravar(Ocorrencias ocorrencias) { OcorrenciasDAO ocorrenciasDao = new OcorrenciasDAO(); if ((ocorrencias.BA.Ba_Cod != 0) && (ocorrencias.Moradores.CodMorador != 0) && (ocorrencias.Motivo != "")) { ocorrenciasDao.Insert(ocorrencias); } }
public void Editar(Ocorrencias ocorrencias) { OcorrenciasDAO ocorrenciasDao = new OcorrenciasDAO(); if (ocorrencias.CodOcorrencia != 0) { ocorrenciasDao.Update(ocorrencias); } }
public OcorrenciasTO(bool conbd, bool instanciadependente) { if (conbd) { this._dao = new OcorrenciasDAO(); } if (instanciadependente) { this._status = new StatusTO(false); this._problemas = new ProblemasTO(false, true); this._usuario = new UsuarioTO(true, true, true); } }
private void btnBuscar_Click(object sender, EventArgs e) { Ocorrencias ocorrencias = new Ocorrencias(); OcorrenciasBO ocorrenciasBO = new OcorrenciasBO(); OcorrenciasDAO ocorrenciasDAO = new OcorrenciasDAO(); this.dataGridView1.DefaultCellStyle.Font = new Font("Arial", 10); if (rbtApto.Checked) { try { ocorrencias.BA.Apto = txtBusca.Text; dataGridView1.DataSource = ocorrenciasDAO.BuscaApto(txtBusca.Text); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhuma ocorrência encontrada"); txtBusca.Clear(); } } catch { MessageBox.Show("Preencha corretamente as informações"); } } if (rbtBloco.Checked) { try { ocorrencias.BA.Bloco = txtBusca.Text; dataGridView1.DataSource = ocorrenciasDAO.BuscaBloco(txtBusca.Text); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhuma ocorrência encontrada"); txtBusca.Clear(); } } catch { MessageBox.Show("Preencha corretamente as informações"); } } }