Beispiel #1
0
        /*
         * Tabel name queus_table_list 11columns
         */
        //REGISTER
        private void btnRegister_Click(object sender, EventArgs e)
        {
            /*
             * validate method, to ensure that there is data inputed
             */
            validate();

            /*
             * To get the value from the radiobuttons
             */
            string genderVal = "";

            if (rbMale.Checked == true)
            {
                genderVal = rbMale.Text;
            }
            else if (rbFemale.Checked == true)
            {
                genderVal = rbFemale.Text;
            }

            /*
             * SQL Command, to insert the data into the database Don't Change anything hahahha
             */
            string insertQuery = "INSERT INTO queus_table_list(lastName,firstName,middleName,birthMonth,birthDay,birthYear,gender, address, email,phoneNumber)" +
                                 " VALUES('" + txtLastname.Text + "','" + txtFirstname.Text + "','" + txtMiddlename.Text + "','" + cbMonth.Text + "'," + cbDate.Text + "," + cbYear.Text +
                                 ",'" + genderVal + "', '" + txtAddress.Text + "', '" + txtEmail.Text + "', '" + txtPhonenumber.Text + "')";

            MySqlCommand command = new MySqlCommand(insertQuery, connection);

            try
            {
                /*
                 * Opens the database
                 */
                connection.Open();
                if (command.ExecuteNonQuery() == 1)
                {
                    /*
                     * Success
                     */
                    //MessageBox.Show("Data Inserted");
                    NameQueu = txtLastname.Text + " " + txtFirstname.Text + " " + txtMiddlename.Text; // To pass the data to the success form
                    LastName = txtLastname.Text;                                                      // To pass the data to the success form
                    Success success = new Success();
                    success.Show();                                                                   // To show the success form
                    clearFields();                                                                    // Clearing the fields when done
                }
                else
                {
                    MessageBox.Show("Something went wrong! 🙁");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "🙁"); //Error
            }

            /*
             * Closes the database
             */
            connection.Close();
        }
Beispiel #2
0
        /*
         * To close the form
         */
        private void closeOnDone_Click(object sender, EventArgs e)
        {
            Success success = this;

            success.Close();
        }