Exemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            BarcodeReader Reader = new BarcodeReader();
            Result        result = Reader.Decode((Bitmap)cameraPreview.Image);


            try
            {
                decoded = result.ToString().Trim();

                if ((dataLib.isQRCodeExists(DBConnection.connect(), decoded) == false) || (dataLib.isPastEvent(DBConnection.connect(), dataLib.schedIDFromQR(DBConnection.connect(), decoded))) == true)
                {
                    timer1.Stop();
                    MetroFramework.MetroMessageBox.Show(this, "QR Code doesn't exists", "e-Ventory", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    checkBtn.Enabled = true;
                }
                else
                {
                    timer1.Stop();
                    if (dataLib.isAlreadyPaid(DBConnection.connect(), decoded) == true)
                    {
                        MetroFramework.MetroMessageBox.Show(this, "Participant already paid", "e-Ventory", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        checkBtn.Enabled = true;
                    }
                    else
                    {
                        if (dataLib.isFullEvent(DBConnection.connect(), dataLib.schedIDFromQR(DBConnection.connect(), decoded)) == true)
                        {
                            MetroFramework.MetroMessageBox.Show(this, "Event already full", "e-Ventory", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            checkBtn.Enabled = true;
                        }
                        else
                        {
                            participantIDLbl.Text = dataLib.participantID(DBConnection.connect(), decoded).ToString();
                            partNameLbl.Text      = dataLib.participantName(DBConnection.connect(), dataLib.participantID(DBConnection.connect(), decoded));
                            eventNameLbl.Text     = dataLib.eventName(DBConnection.connect(), dataLib.schedIDFromQR(DBConnection.connect(), decoded));
                            ticketAmountLbl.Text  = dataLib.ticketAmount(DBConnection.connect(), dataLib.schedIDFromQR(DBConnection.connect(), decoded)).ToString();
                            age          = dataLib.age(DBConnection.connect(), Convert.ToInt32(participantIDLbl.Text)).ToString();
                            contactNo    = dataLib.contactNum(DBConnection.connect(), Convert.ToInt32(participantIDLbl.Text));
                            venue        = dataLib.venue(DBConnection.connect(), dataLib.schedIDFromQR(DBConnection.connect(), decoded));
                            dateStart    = dataLib.dateStart(DBConnection.connect(), dataLib.schedIDFromQR(DBConnection.connect(), decoded));
                            dateEnd      = dataLib.dateEnd(DBConnection.connect(), dataLib.schedIDFromQR(DBConnection.connect(), decoded));
                            timeStart    = dataLib.timeStart(DBConnection.connect(), dataLib.schedIDFromQR(DBConnection.connect(), decoded));
                            timeEnd      = dataLib.timeEnd(DBConnection.connect(), dataLib.schedIDFromQR(DBConnection.connect(), decoded));
                            venue        = dataLib.venue(DBConnection.connect(), dataLib.schedIDFromQR(DBConnection.connect(), decoded));
                            fbGroupID    = dataLib.fbGroupID(DBConnection.connect(), dataLib.schedIDFromQR(DBConnection.connect(), decoded));
                            ticketAmount = ticketAmountLbl.Text;
                            amountTenderedTxt.Enabled = true;
                            checkBtn.Enabled          = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                timer1.Stop();
                MetroFramework.MetroMessageBox.Show(this, "No QR code detected", "e-Ventory", MessageBoxButtons.OK, MessageBoxIcon.Error);
                checkBtn.Enabled = true;
            }
        }
Exemplo n.º 2
0
        private void proceedBtn_Click_1(object sender, EventArgs e)
        {
            if (amountTenderedTxt.Text == "")
            {
                MetroFramework.MetroMessageBox.Show(this, "Kindly input tendered amount", "e-Ventory", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                string        newQrCode = participantIDLbl.Text + dataLib.schedIDFromQR(DBConnection.connect(), decoded) + "PAID";
                QRCodeEncoder encoder   = new QRCodeEncoder();
                encoder.QRCodeScale = 15;
                Bitmap qr = encoder.Encode(newQrCode);
                qr = new Bitmap(qr, new Size(197, 175));
                qrCodePic.Image = qr;

                updateStatement.updateTicketBought(DBConnection.connect(), (dataLib.ticketBoughtCount(DBConnection.connect(), dataLib.schedIDFromQR(DBConnection.connect(), decoded))) + 1, dataLib.schedIDFromQR(DBConnection.connect(), decoded));
                updateStatement.updateQRCode(DBConnection.connect(), newQrCode, Convert.ToInt32(participantIDLbl.Text));
                updateStatement.updatePaymentStatus(DBConnection.connect(), Convert.ToInt32(participantIDLbl.Text));
                insertStatements.insertSystemLog(DBConnection.connect(), "'" + partNameLbl.Text.Trim() + "'" + " paid for event '" + eventNameLbl.Text.Trim() + "'", dataLib.loggedAdminName(DBConnection.connect(), dataLib.getLoggedAdminID(DBConnection.connect())), dataLib.currentDateAndTime());
                amountTenderedTxt.Enabled = false;
                checkBtn.Enabled          = false;
            }
        }