Exemple #1
0
        private void cmdGerarTicket_Click(object sender, EventArgs e)
        {
            //FAZER NÉTODO GERAR CODIGO DO TICKET

            TicketDAO novo = new TicketDAO();
            try {
                novo.Inserir();
                MessageBox.Show("Seja bem vindo!");
            }
            catch(Exception exx)
            {
                MessageBox.Show(exx.Message);
                MessageBox.Show("problema ao gerar ticket");
            }
        }
Exemple #2
0
        private void cmdValidar_Click(object sender, EventArgs e)
        {
            TicketDAO chama = new TicketDAO();
            Ticket altera = null;

            char cartaoValidado = 'S';

            altera = new Ticket(chama.Buscar(txtCodigo.Text).CodTicket, chama.Buscar(txtCodigo.Text).DataHoraEntrada, cartaoValidado, DateTime.Parse(txtTolerancia.Text), 1, chama.Buscar(txtCodigo.Text).CodEstacionamento);

            try {
                chama.Atualizar(altera);
                MessageBox.Show("Ticket validado com sucesso");
                CarregarGridView();

                //FATURAMENTO DE TICKET PAGO

                Faturamento pago = null;

                if (altera.CartaoValidado == 'M')
                {

                    pago = new Faturamento(0, DateTime.Now, float.Parse(txtMulta.Text), 1, 1, int.Parse(txtCodigo.Text), 0);
                }
                else
                {

                    pago = new Faturamento(0, DateTime.Now, float.Parse(txtTotal.Text), 1, 1, int.Parse(txtCodigo.Text), 0);

                }
                    FaturamentoDAO gerar = new FaturamentoDAO();
                    try {
                        gerar.GerarFaturamento(pago);
                        MessageBox.Show("Faturamento gerado");
                        LimparCampos();
                    }
                    catch (Exception ww)
                    {
                        MessageBox.Show(ww.Message);
                    }

                }
            catch (Exception ee)
            {
                MessageBox.Show("Não foi possível validar o ticket", ee.Message);
            }
        }