private void btnLocao_Click(object sender, EventArgs e)
        {
            if (txtbDataLocacao.Text == "" || txtbHoraLocacao.Text == "" || cmbBicicleta.Text == "" || cmbPessoa.Text == "")
            {
                MessageBox.Show("Preencha Todos os Campos !", "Atenção !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            else
            {
                BicicletasDAO bDAO = new BicicletasDAO();
                FisicaDAO     fDAO = new FisicaDAO();
                string where;
                string where2;
                string DATALOCACAO = txtbDataLocacao.Text;
                string HORALOCACAO = txtbHoraLocacao.Text;

                where  = " and modelo like " + "'%" + cmbBicicleta.Text + "%'";
                where2 = " and nome like " + "'%" + cmbPessoa.Text + "%'";

                Bicicletas BIKE = bDAO.SelecionaBicicletaModelo(where)[0];
                Console.WriteLine(BIKE.Modelo);
                Fisica PESSOA = fDAO.SelecionaFisicaNome(where2)[0];
                Console.WriteLine(PESSOA.Nome);


                Ciclista_Locacao    cl    = new Ciclista_Locacao(DATALOCACAO, HORALOCACAO, PESSOA, BIKE);
                Ciclista_locacaoDAO clDAO = new Ciclista_locacaoDAO();
                clDAO.Inserir(cl);
            }
        }
Example #2
0
        private void btnPesquisarPessoa_Click(object sender, EventArgs e)
        {
            FisicaDAO     f = new FisicaDAO();
            List <Fisica> ListaCL;

            string where = "";
            if (txtbPesquisaPessoa.Text != "")
            {
                where = "and p.nome like " + "'%" + txtbPesquisaPessoa.Text + "%'";
            }

            ListaCL = f.SelecionaFisicaNome(where);
            dtgLocacoes.DataSource = ListaCL;
        }