public void registerNewPatient() { DateTime now = DateTime.Now; _patient = new Patient(Name, Surname, Gender, DateOfBirth, Convert.ToInt32(MobileNumber), Email, now); _receptionist = new Receptionist(); try { _receptionist.registerNewPatient(_patient); _medicalCard = new MedicalCard(_patient.getPatientIDFromDb()); _receptionist.createMedicalCard(_medicalCard); _receptionist.updatePatientMedicalCard(_patient, _medicalCard); CloseAction.Invoke(); } catch (MySqlException ex) { ErrorMessage = "Problem with writing data(MySQLException)"; } }