public VacationAnalyze(string fileName) { string[] records = File.ReadAllLines(fileName); foreach (string record in records) { string[] recordData = record.Split(','); VacationData vacationData = new VacationData(recordData); if (IsValidateVacationRecord(vacationData)) { VacationDataRecords.Add(vacationData); } } }
private bool IsValidateVacationRecord(VacationData vacationData) { bool check = true; foreach (VacationData record in VacationDataRecords) { if (record.Name == vacationData.Name) { check = check && (record.EndDate < vacationData.StartDate || vacationData.EndDate < record.StartDate); } } return(check); }