private void patientRegistrationToolStripMenuItem_Click(object sender, EventArgs e) { var view = new View.Registration(); var repository = new Repositories.PatientRepository(); var Presenter = new DentalPractice.Presenter.PatientPresenter(view, repository); view.ShowDialog(); }
public bool Validate() { String[] validTypes = { ".pdf", ".txt", ".rtf", ".doc", ".docx" }; if (string.IsNullOrEmpty(parent.FirstName) || string.IsNullOrEmpty(parent.LastName)) { return(false); } if (parent.DateOfBirth != null) { if (parent.DateOfBirth > DateTime.Now) { return(false); } } if (parent.InsurancePrimaryCardholderDOB != null) { if (parent.InsurancePrimaryCardholderDOB > DateTime.Now) { return(false); } } if (parent.PrescriptionFile.Count() > 0) { string fileName = parent.PrescriptionFile.First().FileName; if (fileName != "") { string extension = fileName.Substring(fileName.LastIndexOf('.')); if (!validTypes.Contains(extension)) { parent.PrescriptionFile.First().IsValid = false; return(false); } } } var repo = new Repositories.PatientRepository(); if (!parent.ID.HasValue) { if (repo.DuplicateExists(parent.FirstName, parent.LastName, parent.DateOfBirth.Value)) { ReturnErrorMessage = "A patient already exists with this name and date of birth."; HasValidationErrors = true; return(false); } } return(true); }