|
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.