Ejemplo n.º 1
0
        /// <summary>
        /// Builds the registration event.
        /// </summary>
        /// <param name="xmlNode">The XML node.</param>
        /// <param name="namespaceManager">The namespace manager.</param>
        /// <returns>returns Event.</returns>
        private EventRecurrence BuildRecurrenceEvent(XmlNode xmlNode, XmlNamespaceManager namespaceManager)
        {
            EventRecurrence regEvent = new EventRecurrence();

            if (xmlNode.SelectSingleNode("ical:freq", namespaceManager) != null)
            {
                regEvent.Frequency = xmlNode.SelectSingleNode("ical:freq", namespaceManager).InnerText;
            }

            if (xmlNode.SelectSingleNode("ical:until/ical:date-time", namespaceManager) != null)
            {
                regEvent.Until = xmlNode.SelectSingleNode("ical:until/ical:date-time", namespaceManager).InnerText;
            }

            if (xmlNode.SelectSingleNode("ical:byday", namespaceManager) != null)
            {
                regEvent.ByDay = xmlNode.SelectSingleNode("ical:byday", namespaceManager).InnerText;
            }

            if (xmlNode.SelectSingleNode("ical:byminute", namespaceManager) != null)
            {
                regEvent.ByMinute = xmlNode.SelectSingleNode("ical:byminute", namespaceManager).InnerText;
            }

            if (xmlNode.SelectSingleNode("ical:byhour", namespaceManager) != null)
            {
                regEvent.ByHour = xmlNode.SelectSingleNode("ical:byhour", namespaceManager).InnerText;
            }

            if (xmlNode.SelectSingleNode("ical:count", namespaceManager) != null)
            {
                regEvent.Count = xmlNode.SelectSingleNode("ical:count", namespaceManager).InnerText.ToInt32();
            }

            if (xmlNode.SelectSingleNode("ical:interval", namespaceManager) != null)
            {
                regEvent.Interval = xmlNode.SelectSingleNode("ical:interval", namespaceManager).InnerText;
            }

            return(regEvent);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Builds the event recurrence.
        /// </summary>
        /// <param name="xmlNode">The XML node.</param>
        /// <param name="eventRgn">The event RGN.</param>
        /// <param name="namespaceManager">The namespace manager.</param>
        /// <param name="xpath">The xpath.</param>
        /// <returns>returns XmlNode.</returns>
        private static XmlNode BuildEventRecurrence(XmlNode xmlNode, EventRecurrence eventRgn, XmlNamespaceManager namespaceManager, string xpath)
        {
            // Adding recurrence information
            if (!string.IsNullOrEmpty(eventRgn.Frequency))
            {
                xmlNode.SelectSingleNode(xpath + "/ical:rrule/ical:recur/ical:freq", namespaceManager).InnerText = eventRgn.Frequency;
            }

            if (!string.IsNullOrEmpty(eventRgn.Until))
            {
                xmlNode.SelectSingleNode(xpath + "/ical:rrule/ical:recur/ical:until/ical:date-time", namespaceManager).InnerText = eventRgn.Until;
            }

            if (!string.IsNullOrEmpty(eventRgn.ByDay))
            {
                xmlNode.SelectSingleNode(xpath + "/ical:rrule/ical:recur/ical:byday", namespaceManager).InnerText = eventRgn.ByDay;
            }

            if (!string.IsNullOrEmpty(eventRgn.ByHour))
            {
                xmlNode.SelectSingleNode(xpath + "/ical:rrule/ical:recur/ical:byhour", namespaceManager).InnerText = eventRgn.ByHour;
            }

            if (!string.IsNullOrEmpty(eventRgn.ByMinute))
            {
                xmlNode.SelectSingleNode(xpath + "/ical:rrule/ical:recur/ical:byminute", namespaceManager).InnerText = eventRgn.ByMinute;
            }

            if (!string.IsNullOrEmpty(eventRgn.Interval))
            {
                xmlNode.SelectSingleNode(xpath + "/ical:rrule/ical:recur/ical:interval", namespaceManager).InnerText = eventRgn.Interval;
            }

            if (eventRgn.Count > 0)
            {
                xmlNode.SelectSingleNode(xpath + "/ical:rrule/ical:recur/ical:count", namespaceManager).InnerText = eventRgn.Count.ToString();
            }

            return(xmlNode);
        }