private void btnRegister_Click(object sender, EventArgs e)
        {
            if (checkFields() == false)  // Check if any field is empty
            {
                //display error message
                MessageBox.Show("Please complete all of the fields", "Empty Fields", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtICPassport.Focus();
            }
            else if (NumberCheck(txtContactNumber.Text) == false) //Check if ContactNumber text box is filled with only numbers
            {
                //display error message
                MessageBox.Show("Incorrect entered contact number. Please try again", "Invalid Contact Number", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtContactNumber.Focus();
            }
            else if (EmailCheck(txtEmail.Text) == false) //Check if the entered email is correct or not
            {
                //display error message
                MessageBox.Show("Incorrect email entered. Please try again", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEmail.Focus();
            }
            else
            {                                                           // Define a new connection to the database
                DBConnect db    = new DBConnect();                      //calling the data connectin class
                bool      found = db.CheckCustomer(txtICPassport.Text); //checking the Customer ID
                if (found == true)
                {                                                       // Deisplay an error message if the customer has registerd before
                    MessageBox.Show("This customer had already registered before", "Existing Entry", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtICPassport.Focus();
                }
                else
                {                                                                                                                                           //Register a new customer
                    bool success = db.RegisterCustomer(txtICPassport.Text, txtName.Text, txtAddress.Text, int.Parse(txtContactNumber.Text), txtEmail.Text); // if the customer had not registered before will call the register method

                    if (success == true)                                                                                                                    //if the connection is happened
                    {                                                                                                                                       //Display a message when the registeration is done successfully
                        DialogResult stay = new DialogResult();
                        stay = MessageBox.Show("Customer has registered sucessfully. Do you want to continue on registration form? ", "Successful Registeration", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                        if (stay == DialogResult.No) //check if the user wants to leave registeration form
                        {
                            this.Close();            //Close the form
                        }
                        else
                        {
                            ClearAll();   //clear all the form's feilds
                        }
                    }

                    else //if the connection is faild display the message
                    {
                        MessageBox.Show("The connection to the database is being faild", "Faild Connection", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
        bool CustChecking(string ID)
        { //Check if the customer ID is exist in customers list
            bool      Cust     = true;
            DBConnect CusCheck = new DBConnect();
            bool      success  = CusCheck.CheckCustomer(ID);

            if (success == false)
            {
                Cust = false;
                DialogResult Cont;
                Cont = MessageBox.Show("This customer has not registered before. Do you Want to continue on this window", "Invalid Customer's ID", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Cont == DialogResult.No)
                {
                    this.Close();
                }
            }
            return(Cust);
        }
        bool CustChecking(string ID)
        {// check if the customer ID exist in the customers list
            bool      Cust     = true;
            DBConnect CusCheck = new DBConnect();
            bool      success  = CusCheck.CheckCustomer(ID);

            if (success == false)
            {
                Cust = false;
                DialogResult Cont;
                Cont = MessageBox.Show("This customer has not been registered before. Do you want to register a new customer?", "Invalid Customer's ID", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Cont == DialogResult.Yes)
                {
                    RegisterCustomer Register = new RegisterCustomer();
                    Register.Show();
                }
            }
            return(Cust);
        }