示例#1
0
        private void btnComprarIngresso_Click(object sender, EventArgs e)
        {
            if (txtConfirmaEmail.Text != txtEmail.Text)
            {
                MessageBox.Show("O e-mail confirmado está diferente do informado.", "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if ((Int32.Parse(cbQtdIngressos.Text)) == 0)
            {
                MessageBox.Show("O campo Quantidade de Ingressos não pode ser 0", "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if ((cbFormaPagamento.Text == "Crédito" && txtNumCartao.Text == "") || (cbFormaPagamento.Text == "Crédito" && txtCvv.Text == ""))
            {
                MessageBox.Show("Por favor, preencha todos os campos referentes ao cartão de crédito!");
            }

            if (txtConfirmaEmail.Text == "" || txtEmail.Text == "" || txtNome.Text == "" || txtSobrenome.Text == "" || txtCvv.Text == "" || txtNumCartao.Text == "")
            {
                MessageBox.Show("Por favor, preencha todos os campos!", "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Ingresso ingresso = new Ingresso();

            ingresso.idEvento       = evento.id;
            ingresso.cpfPessoa      = View.frmLogin.pessoa.cpf;
            ingresso.valor          = (evento.valorTaxas + evento.valorIngresso) * Int32.Parse(cbQtdIngressos.Text);
            ingresso.quantidade     = Int32.Parse(cbQtdIngressos.Text);
            ingresso.formaPagamento = cbFormaPagamento.Text;

            IngressoDAO dao = new IngressoDAO();

            dao.insert(ingresso);


            MessageBox.Show("Ingresso comprado com sucesso", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information);

            this.Hide();
        }
示例#2
0
        private void carregarIngressos()
        {
            IngressoDAO dao = new IngressoDAO();

            ingressos = dao.getMeusIngressos(View.frmLogin.pessoa.cpf);

            LastPosition lastPosition = new LastPosition(80, 25, 3, 169, 3, 138, -7, 4, -7, 210);

            foreach (Ingresso ingresso in ingressos)
            {
                Panel panel = new Panel();
                panel.BackColor   = System.Drawing.SystemColors.ButtonHighlight;
                panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                panel.Location    = new System.Drawing.Point(lastPosition.panelPositionHor, lastPosition.panelPositionVer);
                panel.Name        = "panelIngresso " + ingresso.id;
                panel.Size        = new System.Drawing.Size(270, 245);
                panel.TabIndex    = 10;
                panel.Click      += new EventHandler(panel_Click);
                this.Controls.Add(panel);

                Label lblNomeEvento = new Label();
                lblNomeEvento.Font      = new System.Drawing.Font("Gadugi", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                lblNomeEvento.ForeColor = System.Drawing.Color.Black;
                lblNomeEvento.Location  = new System.Drawing.Point(lastPosition.lblNomeEventoPositionHor, lastPosition.lblNomeEventoPositionVer);
                lblNomeEvento.Name      = "lblNomeEvento " + ingresso.id;
                lblNomeEvento.Size      = new System.Drawing.Size(262, 31);
                lblNomeEvento.TabIndex  = 1;
                lblNomeEvento.Text      = ingresso.nomeEvento;
                lblNomeEvento.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                lblNomeEvento.Click    += new EventHandler(panel_Click);
                panel.Controls.Add(lblNomeEvento);

                Label lblDataEvento = new Label();
                lblDataEvento.Font       = new System.Drawing.Font("Gadugi", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                lblDataEvento.ForeColor  = System.Drawing.Color.SandyBrown;
                lblDataEvento.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
                lblDataEvento.Location   = new System.Drawing.Point(lastPosition.lblDataEventoPositionHor, lastPosition.lblDataEventoPositionVer);
                lblDataEvento.Name       = "lblDataEvento " + ingresso.id;
                lblDataEvento.Size       = new System.Drawing.Size(144, 31);
                lblDataEvento.TabIndex   = 1;
                lblDataEvento.Text       = ingresso.dataHoraEvento.ToString();
                lblDataEvento.TextAlign  = System.Drawing.ContentAlignment.MiddleLeft;
                lblDataEvento.Click     += new EventHandler(panel_Click);
                panel.Controls.Add(lblDataEvento);

                Button btnShowEvento = new Button();
                btnShowEvento.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(112)))), ((int)(((byte)(86)))), ((int)(((byte)(247)))));
                btnShowEvento.FlatAppearance.BorderColor = System.Drawing.Color.White;
                btnShowEvento.FlatAppearance.BorderSize  = 0;
                btnShowEvento.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                btnShowEvento.Font      = new System.Drawing.Font("Century Gothic", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                btnShowEvento.ForeColor = System.Drawing.Color.White;
                btnShowEvento.Location  = new System.Drawing.Point(lastPosition.btnShowEventPositionHor, lastPosition.btnShowEventPositionVer);
                btnShowEvento.Name      = "btnShowEvento " + ingresso.id;
                btnShowEvento.Size      = new System.Drawing.Size(283, 35);
                btnShowEvento.TabIndex  = 6;
                btnShowEvento.Text      = "Detalhes";
                btnShowEvento.UseVisualStyleBackColor = false;
                btnShowEvento.Click += new EventHandler(panel_Click);
                panel.Controls.Add(btnShowEvento);

                PictureBox pictureEvento = new PictureBox();
                if (ingresso.imgEvent == null)
                {
                    pictureEvento.Image = Properties.Resources.apolloCadastroOficial;
                }
                else
                {
                    MemoryStream mstream = new MemoryStream(ingresso.imgEvent);
                    pictureEvento.Image = System.Drawing.Image.FromStream(mstream);
                }
                pictureEvento.Location = new System.Drawing.Point(lastPosition.pictureEventoPositionHor, lastPosition.pictureEventoPositionVer);
                pictureEvento.Name     = "pictureBoxEvento " + ingresso.id;
                pictureEvento.Size     = new System.Drawing.Size(283, 135);
                pictureEvento.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
                pictureEvento.TabIndex = 0;
                pictureEvento.TabStop  = false;
                pictureEvento.Click   += new EventHandler(panel_Click);
                panel.Controls.Add(pictureEvento);

                int newPanelPositionHor = 0;
                int newPanelPositionVer = 0;

                if (lastPosition.panelPositionHor > 380)
                {
                    newPanelPositionHor = 80;
                    newPanelPositionVer = lastPosition.panelPositionVer + 265;
                }
                else
                {
                    newPanelPositionHor = lastPosition.panelPositionHor + 300;
                    newPanelPositionVer = lastPosition.panelPositionVer;
                }

                lastPosition = new LastPosition(newPanelPositionHor, newPanelPositionVer,
                                                lastPosition.lblNomeEventoPositionHor, lastPosition.lblNomeEventoPositionVer,
                                                lastPosition.lblDataEventoPositionHor, lastPosition.lblDataEventoPositionVer,
                                                lastPosition.pictureEventoPositionHor, lastPosition.pictureEventoPositionVer,
                                                lastPosition.btnShowEventPositionHor, lastPosition.btnShowEventPositionVer);
            }
        }