Пример #1
0
        private void btnSalvarApto_Click(object sender, EventArgs e)
        {
            try
            {
                BA   ba   = new BA();
                BABO baBO = new BABO();

                ba.Bloco = txtBloco.Text;
                ba.Apto  = txtApto.Text;
                if ((ba.Bloco != "") && (ba.Apto != ""))
                {
                    baBO.Gravar(ba);
                    MessageBox.Show("Apto cadastrado com sucesso");

                    grpCadApto.Visible = true;
                    txtBloco.Clear();
                    txtApto.Clear();
                }
                else
                {
                    MessageBox.Show("Preencha todos os campos");
                }
            }
            catch
            {
                MessageBox.Show("Verifique os dados e tente novamente");
            }
        }
Пример #2
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow linhaSelecionada;

            linhaSelecionada = dataGridView1.CurrentRow;


            txtApto.Text         = linhaSelecionada.Cells[0].Value.ToString();
            txtBloco.Text        = linhaSelecionada.Cells[1].Value.ToString();
            txtProprietario.Text = linhaSelecionada.Cells[2].Value.ToString();

            mskHorarioInicio.Text  = linhaSelecionada.Cells[3].Value.ToString();
            mskHorarioTermino.Text = linhaSelecionada.Cells[4].Value.ToString();
            lblCodLocacao.Text     = linhaSelecionada.Cells[5].Value.ToString();

            panel1.Enabled     = true;
            btnAlterar.Enabled = true;
            btnExcluir.Enabled = true;

            try
            {
                //puxar codigo do BA
                BA   ba   = new BA();
                BABO babo = new BABO();

                ba.Apto  = txtApto.Text;
                ba.Bloco = txtBloco.Text;

                babo.BuscaCodBA(ba);
                lblBACod.Text = Convert.ToString(ba.Ba_Cod);

                //puxar codigo do MORADOR
                Moradores   mor   = new Moradores();
                MoradoresBO morBO = new MoradoresBO();

                mor.Nome = txtProprietario.Text;
                morBO.Buscar(mor);

                lblMoradorCod.Text = Convert.ToString(mor.CodMorador);
            }
            catch
            {
                MessageBox.Show("Verifique os dados e tente novamente");
            }
        }
Пример #3
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            BA    ba    = new BA();
            BABO  baBO  = new BABO();
            BADAO baDao = new BADAO();

            try
            {
                ba.Bloco = txtBlocoConsulta.Text;

                dataGridView1.DataSource = baDao.Consulta(txtBlocoConsulta.Text);
                for (int i = 1; i == dataGridView1.RowCount; i++)
                {
                    MessageBox.Show("Nenhum bloco encontrado");
                    txtBlocoConsulta.Clear();
                }
            }
            catch
            {
                MessageBox.Show("Preencha corretamente as informações");
            }
        }
Пример #4
0
        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 = txtTutor.Text;
                        morBO.Buscar(mor);

                        if (mor.Nome == "")
                        {
                            MessageBox.Show("Tutor não encontrado");
                            txtTutor.Clear();
                        }

                        else
                        {
                            lblMoradorCod.Text = Convert.ToString(mor.CodMorador);
                            //altera o pet
                            try
                            {
                                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.CodPet = Convert.ToInt16(lblCodPet.Text);
                                    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.Editar(pets);
                                    MessageBox.Show("Pet editado com sucesso");

                                    txtNome.Clear();
                                    txtApto.Clear();
                                    txtBloco.Clear();;
                                    txtTutor.Clear();
                                    cbbEspecie.SelectedIndex = -1;
                                    txtBusca.Clear();
                                    panel1.Enabled     = false;
                                    btnAlterar.Enabled = false;
                                    btnExcluir.Enabled = false;
                                    lblCodPet.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");
            }
        }
Пример #5
0
        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");
                    txtBloco.Clear();
                    txtApto.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 obras
                                Obras   obras   = new Obras();
                                ObrasBO obrasBO = new ObrasBO();


                                obras.Moradores.CodMorador = Convert.ToInt16(lblMoradorCod.Text);
                                obras.BA.Ba_Cod            = Convert.ToInt16(lblBACod.Text);
                                obras.DataHora             = Convert.ToDateTime(mskData.Text);


                                obrasBO.Gravar(obras);
                                MessageBox.Show("Obra cadastrada com sucesso");

                                txtProprietario.Clear();
                                txtApto.Clear();
                                txtBloco.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");
            }
        }
Пример #6
0
        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);
                    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 veiculos
                                Veiculos   veiculos   = new Veiculos();
                                VeiculosBO veiculosBO = new VeiculosBO();
                                veiculos.Modelo = txtModelo.Text;
                                veiculos.Placa  = mskPlaca.Text.ToUpper();;

                                if ((veiculos.Modelo == "") || (veiculos.Modelo == null) || (veiculos.Placa == "   -"))
                                {
                                    MessageBox.Show("Preencha todos os campos");
                                }

                                else
                                {
                                    veiculos.Placa = mskPlaca.Text.ToUpper();;
                                    veiculos.Moradores.CodMorador = Convert.ToInt16(lblMoradorCod.Text);
                                    veiculos.BA.Ba_Cod            = Convert.ToInt16(lblBACod.Text);
                                    veiculos.Modelo = txtModelo.Text.ToUpper();
                                    veiculos.Cor    = cbbCor.SelectedItem.ToString();


                                    veiculosBO.Gravar(veiculos);
                                    MessageBox.Show("Veículo cadastrado com sucesso");

                                    txtProprietario.Clear();
                                    txtApto.Clear();
                                    txtBloco.Clear();
                                    txtModelo.Clear();
                                    cbbCor.SelectedIndex = -1;
                                    mskPlaca.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");
            }
        }
Пример #7
0
        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");
            }
        }
Пример #8
0
        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");
            }
        }
Пример #9
0
        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");
            }
        }
Пример #10
0
        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");
            }
        }
Пример #11
0
        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");
            }
        }
Пример #12
0
        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");
            }
        }