Example #1
0
        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);
        }
Example #2
0
        //for test main method
        public static void Main(string[] args)
        {
            /*
             * XMLProcessor x = new XMLProcessor();
             * x.Read();
             * foreach (FileNode node in x.fileList)
             * {
             *  Console.WriteLine(node.GetFileName());
             * }
             */
            // Uri.IsWellFormedOriginalString();

            LinkedList <MeetingNode> meetingList    = new LinkedList <MeetingNode>();
            LinkedList <FileNode>    attachmentList = new LinkedList <FileNode>();
            MeetingNode m1 = new MeetingNode();

            m1.SetMeetingID("12345");
            m1.SetMeetingTitle("ABC");
            m1.SetStartTime("2017/04/03 13:13:15");
            m1.SetEndTime("2017/04/04 13:13:15");
            MeetingNode m2 = new MeetingNode();

            m2.SetMeetingID("23456");
            m2.SetMeetingTitle("BCD");
            m2.SetStartTime("2017/04/07 13:13:15");
            m2.SetEndTime("2017/04/08 13:13:15");
            MeetingNode m3 = new MeetingNode();

            m3.SetMeetingID("34567");
            m3.SetMeetingTitle("CDE");
            m3.SetStartTime("2017/04/08 13:13:15");
            m3.SetEndTime("2017/04/09 13:13:15");
            meetingList.AddLast(m1);
            meetingList.AddLast(m2);
            meetingList.AddLast(m3);

            FileNode f1 = new FileNode();

            f1.SetFileName("f1a");
            f1.AddMeetings("12345");
            FileNode f2 = new FileNode();

            f2.SetFileName("f2a");
            f2.AddMeetings("34567");
            FileNode f3 = new FileNode();

            f3.SetFileName("f3a");
            f3.AddMeetings("34567");
            attachmentList.AddLast(f1);
            attachmentList.AddLast(f2);
            attachmentList.AddLast(f3);

            XMLProcessor x = new XMLProcessor();

            x.ProcessFileWithMeetingList(meetingList, attachmentList);
            x.Write();
        }
Example #3
0
        //test if the event is a meeting by exam its duration
        public static Boolean IsValidMeeting(MeetingNode m, TimeSpan minDuration)
        {
            TimeSpan duration = m.GetDuration();

            if (duration.CompareTo(minDuration) < 0)
            {
                return(false);
            }
            return(true);
        }
Example #4
0
        //-----------------------------------------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);
        }
Example #5
0
        //filter, checking the validity of the information



        #endregion
        //---------------------------------------------------------------------------------------------

        //-------------------------------File and Meeting Process ---------------------------------
        //Previous Condition: List of File information from recent file viewer, list of file information from google attachments, and meeting list from google calendar
        //Post Condition: List of New Files with sorted ID, List of Old Files with previous IDs, List of meetings. All filelist and meetinglist in nodes updated

        public void ProcessFileWithMeetingNode(MeetingNode mNode)
        {
            //check if the meeting node is valid or not first
            if (!Tools.IsValidMeeting(mNode, minDuration))
            {
                return;
            }

            String meetingID = mNode.GetMeetingID();

            if (meetingID == "")
            {
                Console.WriteLine("Meeting ID for Meeting " + mNode.GetMeetingTitle() + "is missing.");
                return;
            }
            LinkedList <FileNode> filteredFileList = new LinkedList <FileNode>();
            DateTime startTime = mNode.GetStartTime();
            DateTime endTime   = mNode.GetEndTime();

            foreach (FileNode item in fileList)
            {
                if (Tools.IsValidTimeRange(item.GetCreatedTime(), item.GetExecuteTime(), item.GetModifiedTime(), startTime, endTime) != -1)
                {
                    item.AddMeetings(meetingID);
                    filteredFileList.AddLast(item);
                }
            }
            foreach (FileNode Aitem in AttachmentList)
            {
                if (Aitem.GetMeetingListS() == mNode.GetMeetingID())
                {
                    filteredFileList.AddLast(Aitem);
                }
            }
            filteredFileList = AssignFileIDs(filteredFileList);
            foreach (FileNode node in filteredFileList)
            {
                fileFinalList.AddLast(node);
                mNode.AddFiles(node.GetFileID());
            }
            meetingList.AddLast(mNode);
        }
Example #6
0
        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);
        }