Click here to Skip to main content
15,893,401 members
Articles / Programming Languages / XML

SharePoint Reservations

Rate me:
Please Sign up or sign in to vote.
4.93/5 (15 votes)
29 Mar 2009CPOL8 min read 422.5K   4K   47  
A SharePoint calendar extension that prohibits overlapping appointments
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace RecurringClasses
{
    /// <summary>
    /// Concrete class to handle repeat a specified number of times
    /// J. Finn Sep 2008
    /// james.finn@gmail.com
    /// </summary>
    class RecurCompletionCount : absCompletion
    {
        int eventCount = -1; // current event counter
        int maxEvents = 0; // stop processing when this counter is reached
        /// <summary>
        /// constructor sets up variables necessary to respond to ProcecessedAll
        /// </summary>
        /// <param name="StartDate">Start Date</param>
        /// <param name="EndDate">End Date</param>
        /// <param name="ReccurNode">XML Node containing completion data</param>
        public RecurCompletionCount(ref DateTime StartDate, ref DateTime EndDate, XmlNode ReccurNode)
            : base(StartDate, EndDate)
        {
            XmlNode recurValueNode = ReccurNode.FirstChild;
            string recurValue = recurValueNode.Value;
            if (!Int32.TryParse(recurValue, out maxEvents))
            {
                throw new Exception("Recurring Value In Incorrect Format: " + recurValue);
            }
        }

        /// <summary>
        /// Have all events been processed?
        /// </summary>
        /// <param name="StartDate">Start Date</param>
        /// <param name="EndDate">End Date</param>
        /// <returns>true if all events are processed</returns>
        public override bool ProcessedAll(DateTime StartDate, DateTime EndDate)
        {
            eventCount++;
            return ((eventCount < maxEvents));
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions