public LinkedList <MeetingNode> FindMeetingsByMeetingTitleKeywords(String keyword) { XElement meetings = XElement.Load(mfile); IEnumerable <XElement> meetingNodes = meetings.Elements(); List <MeetingNode> list = new List <MeetingNode>(); foreach (var meeting in meetingNodes) { if (meeting.Element("Meeting_Title").Value.Contains(keyword)) { MeetingNode currentNode = new MeetingNode(); currentNode.SetMeetingID(meeting.Attribute("ID").Value); currentNode.SetMeetingTitle(meeting.Element("Meeting_Title").Value); currentNode.SetStartTime(meeting.Element("Start_Time").Value); currentNode.SetEndTime(meeting.Element("End_Time").Value); currentNode.SetAttendents(meeting.Element("Attendents").Value); currentNode.SetFiles(meeting.Element("Files").Value); list.Add(currentNode); } } list.Sort((x, y) => y.GetStartTime().CompareTo(x.GetStartTime())); LinkedList <MeetingNode> n = new LinkedList <MeetingNode>(); foreach (MeetingNode item in list) { n.AddLast(item); } return(n); }
//-----------------------------------------Search Algorithm ------------------------------------------------ //------------------Read information from XML and return linked list of desired data ---------------------------- //find corresponding meeting nodes with a string of meeting IDs //previous condition: no repetitive meeting ids in the string public LinkedList <MeetingNode> FindMeetingsByMeetingIDs(String meetingIDs) { if (meetingIDs == "") { return(new LinkedList <MeetingNode>()); } String[] idList = meetingIDs.Split(';'); XElement meetings = XElement.Load(mfile); IEnumerable <XElement> meetingNodes = meetings.Elements(); List <MeetingNode> list = new List <MeetingNode>(); foreach (var meeting in meetingNodes) { String currentID = meeting.Attribute("ID").Value; Boolean inList = false; for (int i = 0; i < idList.Length && (!inList); i++) { if (currentID == idList[i]) { inList = true; } } if (inList) { MeetingNode currentNode = new MeetingNode(); currentNode.SetMeetingID(currentID); currentNode.SetMeetingTitle(meeting.Element("Meeting_Title").Value); currentNode.SetStartTime(meeting.Element("Start_Time").Value); currentNode.SetEndTime(meeting.Element("End_Time").Value); currentNode.SetAttendents(meeting.Element("Attendents").Value); currentNode.SetFiles(meeting.Element("Files").Value); list.Add(currentNode); } } list.Sort((x, y) => y.GetStartTime().CompareTo(x.GetStartTime())); LinkedList <MeetingNode> n = new LinkedList <MeetingNode>(); foreach (MeetingNode item in list) { n.AddLast(item); } return(n); }
public LinkedList <MeetingNode> FindMeetingsByMeetingPID(String meetingPID) { XElement meetings = XElement.Load(mfile); IEnumerable <XElement> meetingNodes = meetings.Elements(); LinkedList <MeetingNode> list = new LinkedList <MeetingNode>(); foreach (var meeting in meetingNodes) { if ((meeting.Element("Parent_ID").Value == meetingPID) || (meeting.Attribute("ID").Value == meetingPID)) { MeetingNode currentNode = new MeetingNode(); currentNode.SetMeetingID(meeting.Attribute("ID").Value); currentNode.SetMeetingTitle(meeting.Element("Meeting_Title").Value); currentNode.SetStartTime(meeting.Element("Start_Time").Value); currentNode.SetEndTime(meeting.Element("End_Time").Value); currentNode.SetAttendents(meeting.Element("Attendents").Value); currentNode.SetFiles(meeting.Element("Files").Value); list.AddLast(currentNode); } } return(list); }