List<clsPatientModel> searchResult = new List<clsPatientModel>();
searchResult = searchResult
.Concat(
from patient in patients
where patient.DateEntry.EntryDate.Date == Convert.ToDateTime(dptEntryDate.Value.Date)
select patient)
.ToList();
searchResult = searchResult
.Concat(
from patient in patients
where patient.PatientDetails.DOB.Date == Convert.ToDateTime(dpDOB.Value.Date)
select patient)
.ToList();
if (!string.IsNullOrWhiteSpace(txtSurname.Text))
{
searchResult = searchResult
.Concat(
from patient in patients
where patient.PatientDetails.Surname.ToLowerInvariant().Contains(txtSurname.Text.ToLowerInvariant().Trim())
select patient)
.ToList();
}
if (!string.IsNullOrWhiteSpace(txtName.Text))
{
searchResult = searchResult
.Concat(
from patient in patients
where patient.PatientDetails.Name.ToLowerInvariant().Contains(txtName.Text.ToLowerInvariant().Trim())
select patient)
.ToList();
}