public TimetableDTO Get(int id) { TimetableFactory timetableFactory = new TimetableFactory(); TimetableTable <Timetable> instanceTimetable = (TimetableTable <Timetable>)timetableFactory.GetTimetableInstance(); return(new TimetableDTO(instanceTimetable.Select(id))); }
public Collection <T> Select() { TimetableFactory timetableFactory = new TimetableFactory(); TimetableTable <Timetable> instanceTimetable = (TimetableTable <Timetable>)timetableFactory.GetTimetableInstance(); XDocument xDoc = XDocument.Load(Configuration.XMLFILEPATH); Collection <T> failures = new Collection <T>(); List <XElement> elements = xDoc.Descendants("Failures").Descendants("Failure").ToList(); foreach (var element in elements) { Failure failure = new Failure(); failure.id = int.Parse(element.Attribute("id").Value); failure.created = DateTime.Parse(element.Attribute("created").Value); failure.type = (FailureType)int.Parse(element.Attribute("type").Value); failure.place = element.Attribute("place").Value; failure.severity = int.Parse(element.Attribute("severity").Value); failure.message = element.Attribute("message").Value; failure.resolved = failure.created = DateTime.Parse(element.Attribute("resolved").Value); failure.timetable = instanceTimetable.Select(int.Parse(element.Attribute("timetableId").Value)); failures.Add((T)failure); } return(failures); }
public IEnumerable <TimetableDTO> Get() { TimetableFactory timetableFactory = new TimetableFactory(); TimetableTable <Timetable> instanceTimetable = (TimetableTable <Timetable>)timetableFactory.GetTimetableInstance(); var listDTO = new List <TimetableDTO>(); var list = instanceTimetable.Select(); foreach (var item in list) { listDTO.Add(new TimetableDTO(item)); } return(listDTO); }