Exemplo n.º 1
0
 private void timer2_Tick(object sender, EventArgs e)
 {
     LbInfo.Text    = "";
     LbAlert.Text   = "";
     LbReturn.Text  = "";
     lblReturn.Text = "";
     pbMain.Hide();
     TbReturnValue.Clear();
     timer2.Enabled = false;
 }
Exemplo n.º 2
0
        private void TbReturnValue_TextChanged(object sender, EventArgs e)
        {
            if (TbReturnValue.TextLength == 12)
            {
                string sqlCmd = "SELECT COUNT(*) FROM customer WHERE Barcode = '" + TbReturnValue.Text + "'";
                try
                {
                    connection.Open();
                    MySqlCommand CommandCheck = new MySqlCommand(sqlCmd, connection);
                    int          Exist        = Convert.ToInt32(CommandCheck.ExecuteScalar());
                    if (Exist > 0)
                    {
                        LbReturn.Text     = TbReturnValue.Text;
                        LbAlert.ForeColor = Color.Green;
                        LbAlert.Text      = "Scan a new RFID.";
                        pbMain.Image      = Properties.Resources.Check;
                        pbMain.Show();
                    }
                    else
                    {
                        LbAlert.ForeColor = Color.Red;
                        LbAlert.Text      = "Ticket does not exist.";
                        TbReturnValue.Clear();
                        playaudiofail();
                        pbMain.Image = Properties.Resources.Error;
                        pbMain.Show();
                        timer1.Enabled = true;
                    }
                }

                catch (MySqlException)
                {
                    MessageBox.Show("Unable to reach the database. Check your connection.");
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close(); connection.Close();
                    }
                }
            }
        }