context: using System;
  using System.Xml.Serialization;
  using System.Collections;
  using System.Text.RegularExpressions;
  
  namespace ActiveQLibrary.Serialization.ConfigTask
  {
  
  	#region class Task
  
  	/// <summary>
  	/// Information about a task.
  	/// </summary>
  	[System.Xml.Serialization.XmlTypeAttribute()]
  	public class Task
  	{
  
  		#region Variables
  
  		/// <summary>
  		/// Id of the task.
  		/// </summary>
  		private string _id	;
  
  		/// <summary>
  		/// Adress of the task to do.
  		/// </summary>
  		private string _address;
  
  		/// <summary>
  		/// Method, can be only 'post' or 'get'.
  		/// </summary>
  		private string _method;
  
  		/// <summary>
  		/// Date when the task start.
  		/// </summary>
  		private DateTime _dateStart;
  
  		/// <summary>
  		/// Date when the task end.
  		/// </summary>
  		private DateTime _dateEnd;
  		
  		/// <summary>
  		/// Recurrences of the task.
  		/// </summary>
  		private ArrayList _recurrences = new ArrayList();
  
  		/// <summary>
  		/// Regular expression for internet address.
  		/// </summary>
  		//private string _expressionInternetAddress = @"http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?";
  
  		#endregion
  
  		#region Constructor
  
  		/// <summary>
  		/// Constructor
  		/// </summary>
  		public Task()
  		{
  			_id = "";
  			_dateStart = DateTime.Now;
  			_dateEnd = DateTime.Now;
  			_method = "post";
  		}
  
  		/// <summary>
  		/// Constructors
  		/// </summary>
  		/// <param name="Id">Id</param>
  		/// <param name="Address">Address</param>
  		/// <param name="Method">Method</param>
  		public Task(string Id, string Address, string Method)
  		{
  			if (Id == null)
  				throw new ArgumentNullException("Id");
  
  			_id = Id;
  
  			if (Address == null)
  				throw new ArgumentNullException("Address");
  
  			/* TO DO if (Address.Trim() != "")
  				if (Regex.IsMatch(Address,_expressionInternetAddress) == false)
  					throw new ArgumentException("Invalid internet address format","Address");*/
  		
  			_address = Address;
  
  			if (Method == null)
  				throw new ArgumentNullException("Method");
  
  			if (Method.Trim() == "")
  				throw new ArgumentException("Cannot be blank","Method");
  
  			if (Method != "post" && Method != "get")
  				throw new ArgumentException("Only 'post' and 'get' are accepted as valid values","Method");
  
  			_method = Method;
  
  			_dateStart = DateTime.Now;
  			_dateEnd = DateTime.Now;
  
  		}
  
  		/// <summary>
  		/// Constructor.
  		/// </summary>
  		/// <param name="Id">Id</param>
  		/// <param name="Address">Address</param>
  		/// <param name="Method">Method</param>
  		/// <param name="DateStart">DateStart</param>
  		public Task(string Id, string Address, string Method, DateTime DateStart)
  		{
  			if (Id == null)
  				throw new ArgumentNullException("Id");
  
  			_id = Id;
  
  			if (Address == null)
  				throw new ArgumentNullException("Address");
  
  			/* TO DO if (Address.Trim() != "")
  				if (Regex.IsMatch(Address,_expressionInternetAddress) == false)
  					throw new ArgumentException("Invalid internet address format","Address"); */
  		
  			_address = Address;
  
  			if (Method == null)
  				throw new ArgumentNullException("Method");
  
  			if (Method.Trim() == "")
  				throw new ArgumentException("Cannot be blank","Method");
  
  			if (Method != "post" && Method != "get")
  				throw new ArgumentException("Only 'post' and 'get' are accepted as valid values","Method");
  
  			_method = Method;
  
  			_dateStart = DateStart; 
  			_dateEnd = DateEnd;
  
  		}
  
  		/// <summary>
  		/// Constructor/
  		/// </summary>
  		/// <param name="Id">Id</param>
  		/// <param name="Address">Address</param>
  		/// <param name="Method">Method</param>
  		/// <param name="DateStart">DateStart</param>
  		/// <param name="DateEnd">DateEnd</param>
  		public Task(string Id,string Address, string Method, DateTime DateStart, DateTime DateEnd)
  		{
  			if (Id == null)
  				throw new ArgumentNullException("Id");
  
  			_id = Id;
  
  			if (Address == null)
  				throw new ArgumentNullException("Address");
  
  			/* TO DO if (Address.Trim() != "")
  				if (Regex.IsMatch(Address,_expressionInternetAddress) == false)
  					throw new ArgumentException("Invalid internet address format","Address"); */
  		
  			_address = Address;
  
  			if (Method == null)
  				throw new ArgumentNullException("Method");
  
  			if (Method.Trim() == "")
  				throw new ArgumentException("Cannot be blank","Method");
  
  			if (Method != "post" && Method != "get")
  				throw new ArgumentException("Only 'post' and 'get' are accepted as valid values","Method");
  
  			_method = Method;
  
  			_dateStart = DateStart;
  
  			if (_dateEnd < DateTime.Now)
  				throw new ArgumentException("Cannot be less than the DateStart","DateEnd");
  
  			_dateEnd = DateEnd;
  
  		}
  
  		/// <summary>
  		/// Constructor.
  		/// </summary>
  		/// <param name="Id">Id</param>
  		/// <param name="Address">Address</param>
  		/// <param name="Method">Method</param>
  		/// <param name="DateStart">DateStart</param>
  		/// <param name="DateEnd">DateEnd</param>
  		/// <param name="Recurrences">Recurrences</param>
  		public Task(string Id,string Address, string Method, DateTime DateStart, DateTime DateEnd, ArrayList Recurrences)
  		{
  			if (Id == null)
  				throw new ArgumentNullException("Id");
  			_id = Id;
  
  			if (Address == null)
  				throw new ArgumentNullException("Address");
  
  			/* TO DO if (Address.Trim() != "")
  				if (Regex.IsMatch(Address,_expressionInternetAddress) == false)
  					throw new ArgumentException("Invalid internet address format","Address");*/
  		
  			_address = Address;
  
  			if (Method == null)
  				throw new ArgumentNullException("Method");
  
  
gt: 			if (Method.Trim() == "")