public void updateJob(Job job) { }
public void loadXmlTree() { projects = new List<Project>(); sheets = new List<Sheet>(); FileStream fs = new FileStream(FileRepository.getInstance().appData+@"Project_task_d.xml", FileMode.Open, FileAccess.ReadWrite); XmlDocument tsfile = new XmlDocument(); tsfile.Load(fs); try { // XmlNodeList nodeList = tsfile.SelectNodes("/TimeSheets"); foreach (XmlElement project in tsfile.SelectNodes(@"TimeSheet/Project")) { String v_project_name = project.GetAttribute("name"); Decimal v_project_number; Decimal.TryParse(project.GetAttribute("number"), out v_project_number); Project v_project = new Project() { name = v_project_name, number = v_project_number }; List<Task> v_project_task = new List<Task>(); foreach (XmlElement task in project.ChildNodes) { //TODO: test if childNode is really a task String v_task_name = task.GetAttribute("name"); Decimal v_task_number; Decimal.TryParse(task.GetAttribute("number"), out v_task_number); Task v_task = new Task() { name = v_task_name, number = v_task_number, project = v_project }; List<Job> v_task_job = new List<Job>(); foreach (XmlElement job in task.ChildNodes) { //TODO: test if the childNode is really a job String v_job_name = job.GetAttribute("name"); Decimal v_job_number; Decimal.TryParse(job.GetAttribute("number"), out v_job_number); Job v_job = new Job() { name = v_job_name, number = v_job_number, task = v_task }; v_task_job.Add(v_job); } v_task.jobs = v_task_job; v_project_task.Add(v_task); } v_project.tasks = v_project_task; projects.Add(v_project); } } catch (Exception) { Console.WriteLine("error"); throw; } fs.Close(); this.loadTreeNode(); }