Example #1
0
        private void btnNewPatientRegister_Click(object sender, EventArgs e)
        {
            Client client = new Client();

            String bDate = txtNewPatientPersonalNumber.Text;

            int id = patientHandling.GetDentistIDForNewPatient(cbxNewPatientDentist);

            if (checkIfValid.checkPersonalNumber(bDate))
            {
                patientHandling.registerNewPatient(
                    client, txtNewPatientPersonalNumber, txtNewPatientFirstName, txtNewPatientLastName,
                    txtNewPatientAddress, txtNewPatientCity, txtNewPatientPostCode, txtNewPatientPhone,
                    txtNewPatientEmail, id);
                Boolean success = dbConn.InsertNewPatientToDB(client);

                if (success)
                {
                    MessageBox.Show("Patient registration was succesful");
                    ClearTextBoxes(this.Controls);
                }
                else
                {
                    MessageBox.Show("Patient registration failed");
                }
            }
            else
            {
                MessageBox.Show("Not a valid personal number");
            }
        }