void IDL.updateTester(int id, Tester updatedTester, bool[,] updatedSchedule) { XElement testerElement = (from item in TesterRoot.Elements() where int.Parse(item.Element("ID").Value) == id select item).FirstOrDefault(); if (testerElement == null) { throw new TestersIdNotFoundException(id); } testerElement.Remove(); TesterRoot.Add(updatedTester.ToXmlTester()); TesterRoot.Save(TesterPath); XElement scheduleXelement = ScheduleRoot.Elements() .Where(item => item.Element("ID").Value == id.ToString()) .FirstOrDefault(); if (scheduleXelement != null) { scheduleXelement.Remove(); } XElement testersId = new XElement("ID", id.ToString()); ScheduleRoot.Add(new XElement("TesterSchedule", testersId, updatedSchedule.ToXmlSchedule())); ScheduleRoot.Save(SchedulePath); }
bool[,] IDL.getSchedule(int testerID) { //if (!ScheduleRoot.Element("schedules").HasElements) // throw new Exception("No Schedule in the dataSource"); XElement schedule = ScheduleRoot.Elements() .Where(item => item.Element("ID").Value == testerID.ToString()) .FirstOrDefault(); if (schedule == null) { throw new ScheduleWasNotInsertedException("the tester's schedule was not inserted yet"); } return(schedule.Element("Schedule").XmlToDOSchedule()); }