/// <summary>
        /// Provides information about all Acrobat Connect meetings for which the user is a host, invited
        /// participant, or registered guest. The meeting can be scheduled in the past, present, or future.
        /// </summary>
        /// <returns>
        /// <see cref="MeetingItem">Meeting list</see>
        /// *Note: all dates are GMT
        /// </returns>
        public MeetingItem[] GetMyMeetings()
        {
            //act: "report-my-meetings"
            //ret: "//meeting"

            StatusInfo iStatus;
            XmlDocument xDoc = _ProcessRequest("report-my-meetings", null, out iStatus);
            if (iStatus.Code != StatusCodes.ok || xDoc == null || !xDoc.HasChildNodes) return null;

            XmlNodeList meetingNodes = xDoc.SelectNodes("//my-meetings/meeting");
            if (meetingNodes == null || meetingNodes.Count < 1) return null;

            List<MeetingItem> miList = new List<MeetingItem>();
            foreach (XmlNode node in meetingNodes)
            {
                MeetingItem mi = new MeetingItem();

                try
                {
                    mi.sco_id = node.Attributes["sco-id"].Value;
                    if (!int.TryParse(node.Attributes["active-participants"].Value, NumberStyles.Number, NumberFormatInfo.InvariantInfo, out mi.active_participants))
                        mi.active_participants = -1;

                    mi.meeting_name = node.SelectSingleNode("name/text()").Value;
                    //mi.description = node.SelectSingleNode("description/text()").Value;
                    if (node.SelectSingleNode("description/text()") != null)
                        mi.meeting_description = node.SelectSingleNode("description/text()").Value;
                    mi.domain_name = node.SelectSingleNode("domain-name/text()").Value;
                    mi.url_path = node.SelectSingleNode("url-path/text()").Value;

                    mi.FullUrl = "http://" + mi.domain_name + mi.url_path;

                    if (!DateTime.TryParseExact(node.SelectSingleNode("date-begin/text()").Value, @"yyyy-MM-dd\THH:mm:ss.fffzzz", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AdjustToUniversal, out mi.date_begin))
                        mi.date_begin = default(DateTime);

                    if (!DateTime.TryParseExact(node.SelectSingleNode("date-end/text()").Value, @"yyyy-MM-dd\THH:mm:ss.fffzzz", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AdjustToUniversal, out mi.date_end))
                        mi.date_end = default(DateTime);

                    if (!bool.TryParse(node.SelectSingleNode("expired/text()").Value, out mi.expired))
                        mi.expired = false;

                    //mi.duration
                    //:parse exact or calc
                    mi.Duration = mi.date_end.Subtract(mi.date_begin);

                    //if mDetail.date_begin is not defined and duration is 0 => then this is the folder which should be ignored
                    if (mi.date_begin.Equals(default(DateTime)) && mi.Duration.TotalMinutes == 0) continue;

                }
                catch (Exception ex)
                {
                    TraceTool.TraceException(ex);
                }

                miList.Add(mi);
            }

            return miList.ToArray();
        }
        /// <summary>
        /// List all meetings on the server
        /// </summary>
        /// <returns>
        /// <see cref="MeetingItem">Meeting list</see>
        /// *Note: all dates are GMT
        /// </returns>
        public MeetingItem[] GetAllMeetings()
        {
            //act: "report-bulk-objects"

            StatusInfo iStatus;
            XmlDocument xDoc = _ProcessRequest("report-bulk-objects", "filter-type=meeting", out iStatus);
            if (iStatus.Code != StatusCodes.ok || xDoc == null || !xDoc.HasChildNodes) return null;

            XmlNodeList MeetingDetailNodes = xDoc.SelectNodes("//report-bulk-objects/row");
            if (MeetingDetailNodes == null || MeetingDetailNodes.Count < 1)
            {
                TraceTool.TraceMessage("Node 'report-bulk-objects' is empty: no data available");
                return null;
            }

            List<MeetingItem> lstDetails = new List<MeetingItem>();
            foreach (XmlNode node in MeetingDetailNodes)
            {
                try
                {
                    MeetingItem mDetail = new MeetingItem();
                    mDetail.sco_id = node.Attributes["sco-id"].Value;
                    mDetail.type = (SCOtype)ReflectEnum(typeof(SCOtype), node.Attributes["type"].Value);

                    if (node.SelectSingleNode("name/text()") != null)
                        mDetail.meeting_name = node.SelectSingleNode("name/text()").Value;

                    mDetail.url_path = node.SelectSingleNode("url/text()").Value;

                    if (!string.IsNullOrEmpty(mDetail.url_path))
                    {
                        Uri u = new Uri(m_serviceURL);
                        mDetail.FullUrl = "https://" + u.GetComponents(UriComponents.Host, UriFormat.SafeUnescaped) + mDetail.url_path;
                    }

                    //NOTE: if folder =>  date-begin is null
                    if (node.SelectSingleNode("date-begin/text()") != null)
                        if (!DateTime.TryParseExact(node.SelectSingleNode("date-begin/text()").Value, @"yyyy-MM-dd\THH:mm:ss.fffzzz", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AdjustToUniversal, out mDetail.date_begin))
                            mDetail.date_begin = default(DateTime);

                    if (!DateTime.TryParseExact(node.SelectSingleNode("date-modified/text()").Value, @"yyyy-MM-dd\THH:mm:ss.fffzzz", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AdjustToUniversal, out mDetail.date_modified))
                        mDetail.date_modified = default(DateTime);

                    if (node.SelectSingleNode("date-end/text()") != null)
                        if (!DateTime.TryParseExact(node.SelectSingleNode("date-end/text()").Value, @"yyyy-MM-dd\THH:mm:ss.fffzzz", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AdjustToUniversal, out mDetail.date_end))
                            mDetail.date_end = default(DateTime);

                    mDetail.Duration = mDetail.date_end.Subtract(mDetail.date_begin);

                    //if mDetail.date_begin is not defined and duration is 0 => then this is the folder which should be ignored
                    if (mDetail.date_begin.Equals(default(DateTime)) && mDetail.Duration.TotalMinutes == 0) continue;

                    lstDetails.Add(mDetail);

                }
                catch (Exception ex)
                {
                    TraceTool.TraceException(ex);
                }
            }

            return lstDetails.ToArray();
        }
        /// <summary>
        /// Returns a list of SCOs within another SCO. The enclosing SCO can be a folder, meeting, or
        /// curriculum.
        /// In general, the contained SCOs can be of any type—meetings, courses, curriculums, content,
        /// events, folders, trees, or links (see the list in type). However, the type of the contained SCO
        /// needs to be valid for the enclosing SCO. For example, courses are contained within
        /// curriculums, and meeting content is contained within meetings.
        /// Because folders are SCOs, the returned list includes SCOs and subfolders at the next
        /// hierarchical level, but not the contents of the subfolders. To include the subfolder contents,
        /// call sco-expanded-contents.
        /// </summary>
        /// <param name="sco_id">Room/Folder ID</param>
        /// <param name="iStatus">status response object returned</param>
        /// <returns><see cref="MeetingItem">MeetingItem</see> array</returns>
        public MeetingItem[] GetMeetingsInRoom(string sco_id, out StatusInfo iStatus)
        {
            //act: "sco-contents"

            iStatus = new StatusInfo();
            XmlDocument xDoc = _ProcessRequest("sco-contents", string.Format("sco-id={0}", sco_id), out iStatus);
            if (iStatus.Code != StatusCodes.ok || xDoc == null || !xDoc.HasChildNodes) return null;

            XmlNodeList MeetingDetailNodes = xDoc.SelectNodes("//sco");
            if (MeetingDetailNodes == null || MeetingDetailNodes.Count < 1)
            {
                //iStatus = ReportStatus(StatusCodes.no_data, StatusSubCodes.not_set, new ArgumentNullException("Node 'sco' is empty"));
                TraceTool.TraceMessage("Node 'sco' is empty: no data available for sco-id=" + sco_id);
                return null;
            }

            List<MeetingItem> lstDetails = new List<MeetingItem>();
            foreach (XmlNode node in MeetingDetailNodes)
            {
                try
                {
                    MeetingItem mDetail = new MeetingItem();
                    mDetail.sco_id = node.Attributes["sco-id"].Value;
                    mDetail.folder_id = node.Attributes["folder-id"].Value;
                    if (!bool.TryParse(node.Attributes["is-folder"].Value, out mDetail.is_folder))
                        mDetail.is_folder = false;
                    if (node.Attributes["byte-count"] != null)
                        if (!long.TryParse(node.Attributes["byte-count"].Value, NumberStyles.Number, NumberFormatInfo.InvariantInfo, out mDetail.byte_count))
                            mDetail.byte_count = -1;
                    if (node.Attributes["lang"] != null)
                        mDetail.language = node.Attributes["lang"].Value;
                    if (node.Attributes["type"] != null)
                        mDetail.type = (SCOtype)ReflectEnum(typeof(SCOtype), node.Attributes["type"].Value);

                    if (node.SelectSingleNode("name/text()") != null)
                        mDetail.meeting_name = node.SelectSingleNode("name/text()").Value;
                    if (node.SelectSingleNode("description/text()") != null)
                        mDetail.meeting_description = node.SelectSingleNode("description/text()").Value;

                    if (node.SelectSingleNode("sco-tag/text()") != null)
                        mDetail.sco_tag = node.SelectSingleNode("sco-tag/text()").Value;

                    mDetail.url_path = node.SelectSingleNode("url-path/text()").Value;
                    //
                    if (!string.IsNullOrEmpty(mDetail.url_path))
                    {
                        Uri u = new Uri(m_serviceURL);
                        mDetail.FullUrl = "https://" + u.GetComponents(UriComponents.Host, UriFormat.SafeUnescaped) + mDetail.url_path;
                    }

                    //NOTE: if folder =>  date-begin is null
                    if (node.SelectSingleNode("date-begin/text()") != null)
                        if (!DateTime.TryParseExact(node.SelectSingleNode("date-begin/text()").Value, @"yyyy-MM-dd\THH:mm:ss.fffzzz", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AdjustToUniversal, out mDetail.date_begin))
                            mDetail.date_begin = default(DateTime);

                    if (!DateTime.TryParseExact(node.SelectSingleNode("date-modified/text()").Value, @"yyyy-MM-dd\THH:mm:ss.fffzzz", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AdjustToUniversal, out mDetail.date_modified))
                        mDetail.date_modified = default(DateTime);

                    if (node.SelectSingleNode("date-end/text()") != null)
                        if (!DateTime.TryParseExact(node.SelectSingleNode("date-end/text()").Value, @"yyyy-MM-dd\THH:mm:ss.fffzzz", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AdjustToUniversal, out mDetail.date_end))
                            mDetail.date_end = default(DateTime);

                    mDetail.Duration = mDetail.date_end.Subtract(mDetail.date_begin);

                    //if mDetail.date_begin is not defined and duration is 0 => then this is the folder which should be ignored
                    if (mDetail.date_begin.Equals(default(DateTime)) && mDetail.Duration.TotalMinutes == 0) continue;

                    lstDetails.Add(mDetail);

                }
                catch (Exception ex)
                {
                    TraceTool.TraceException(ex);
                }

            }

            return lstDetails.ToArray();
        }
示例#4
0
 public UserSession(MeetingItem[] MeetingItems, UserInfo UserInfo)
 {
     this.FullName = UserInfo.name;
     this.MyMeetings = MeetingItems;
     this.Id = int.Parse(UserInfo.user_id);
 }