Click here to Skip to main content
15,895,777 members
Articles / Web Development / ASP.NET

Developing Next Generation Smart Clients using .NET 2.0 working with Existing .NET 1.1 SOA-based XML Web Services

Rate me:
Please Sign up or sign in to vote.
4.96/5 (134 votes)
16 Aug 200540 min read 1.2M   3.9K   462  
Comprehensive guide to development of .NET 2.0 Smart Clients working with existing Service Oriented Architecture based XML web services, fully utilizing the Enterprise Library
// =====================================================================================
// Copyright © 2005 by . All rights are reserved.
// 
// If you like this code then feel free to go ahead and use it.
// The only thing I ask is that you don't remove or alter my copyright notice.
//
// Your use of this software is entirely at your own risk. I make no claims or
// warrantees about the reliability or fitness of this code for any particular purpose.
// If you make changes or additions to this code please mark your code as being yours.
// 
// website , email OmarALZabir@gmail.com, msn oazabir@hotmail.com
// =====================================================================================


	
/*
	Code Generated by a tool.
	Wednesday, July 27, 2005
	Do not modify, edit the file Course.cs instead.
*/
using System;
using System.ComponentModel;
using System.Collections;
using System.Xml.Serialization;

namespace SmartInstitute
{
	#region CourseEventArgs class
	///<summary>
	/// Provides data for the BeforeChanged and AfterChanged events.
	///</summary>
	///<remarks>The BeforeChanged and AfterChanged events occur when a change is made to the value of a property of a <see cref="Course"/> object.</remarks>
	public class CourseEventArgs : System.EventArgs
	{
		private CourseColumns column;
		
		
		///<summary>
		/// Initalizes a new Instance of the CourseEventArgs class.
		///</summary>
		public CourseEventArgs(CourseColumns column)
		{
			this.column = column;
		}
		
		
		///<summary>
		/// The CourseColumns that was modified, which has raised the event.
		///</summary>
		///<value cref="CourseColumns" />
		public CourseColumns Column
		{
			get {return this.column;}
		}
	}
	#endregion
	
	
	///<summary>
	/// Define a delegate for all Course related events.
	///</summary>
	public delegate void CourseEventHandler(object sender, CourseEventArgs e);
		
	
	///<summary>
	/// An object representation of the 'Course' table.
	///</summary>
	/// <remarks>
	/// This class is generated by a tool and should never be modified.
    /// All custom implementations should be done in the <see cref="Course"/> class.
    /// </remarks>
	[Serializable]
	public class CourseBase : System.IComparable, System.ICloneable, IEntity
	{
		
		#region "Variable Declarations"
		
		/// <summary>
		/// ID : 
		/// </summary>
		protected System.Int32		  _ID = (int)0;
		
		/// <summary>
		/// CourseCode : 
		/// </summary>
		protected System.String		  _CourseCode = string.Empty;
		
		/// <summary>
		/// Title : 
		/// </summary>
		protected System.String		  _Title = string.Empty;
		
		/// <summary>
		/// SciCredit : 
		/// </summary>
		protected System.Int32		  _SciCredit = (int)0;
		
		/// <summary>
		/// CompCredit : 
		/// </summary>
		protected System.Int32		  _CompCredit = (int)0;
		
		/// <summary>
		/// LecCredit : 
		/// </summary>
		protected System.Int32		  _LecCredit = (int)0;
		
		/// <summary>
		/// ChangeStamp : 
		/// </summary>
		protected System.DateTime		  _ChangeStamp = DateTime.MinValue;
		
		
		/// <summary>
		/// Occurs before the object is changed.
		/// </summary>	
		public event CourseEventHandler BeforeChanged;
		
		
		/// <summary>
		/// Occurs after the object is changed.
		/// </summary>
		public event CourseEventHandler AfterChanged;		
		#endregion "Variable Declarations"
		
		
		#region "Constructors"
		///<summary>
		/// Creates a new <see cref="CourseBase"/> instance.
		///</summary>
		public CourseBase()
		{
		}		
		
		///<summary>
		/// Creates a new <see cref="CourseBase"/> instance.
		///</summary>
		///<param name="ID"></param>
		///<param name="CourseCode"></param>
		///<param name="Title"></param>
		///<param name="SciCredit"></param>
		///<param name="CompCredit"></param>
		///<param name="LecCredit"></param>
		///<param name="ChangeStamp"></param>
		public CourseBase(System.Int32 ID, System.String CourseCode, System.String Title, System.Int32 SciCredit, System.Int32 CompCredit, System.Int32 LecCredit, System.DateTime ChangeStamp)
		{
			_ID = ID;
			_CourseCode = CourseCode;
			_Title = Title;
			_SciCredit = SciCredit;
			_CompCredit = CompCredit;
			_LecCredit = LecCredit;
			_ChangeStamp = ChangeStamp;
		}
				
		#endregion "Constructors"
		
		
		#region Events trigger
		/// <summary>
		/// Raises the <see cref="BeforeChanged" /> event.
		/// </summary>
		/// <param name="column">The <see cref="CourseColumns"/> which has fired the event.</param>
		public void OnBeforeChanged(CourseColumns column)
		{
			if(BeforeChanged != null)
			{
				BeforeChanged(this, new CourseEventArgs(column));
			}
	
		}
		
		
		/// <summary>
		/// Raises the <see cref="AfterChanged" /> event.
		/// </summary>
		/// <param name="column">The <see cref="CourseColumns"/> which has fired the event.</param>
		public void OnAfterChanged(CourseColumns column)
		{
			if(AfterChanged != null)
			{
				AfterChanged(this, new CourseEventArgs(column));
			}
	
		} 
		#endregion
		
		
		#region Properties	
		/// <summary>
		/// 	Gets or Sets the ID property. 
		///		
		/// </summary>
		/// <value>This type is int</value>
		[DescriptionAttribute("")]
		public System.Int32 ID
		{
			get { return _ID; }
			set
			{
				if (_ID == value)
					return;
					
				OnBeforeChanged(CourseColumns.ID);
				_ID = value;
				_isdirty = true;
				OnAfterChanged(CourseColumns.ID);
			}
		}
	
		/// <summary>
		/// 	Gets or Sets the CourseCode property. 
		///		
		/// </summary>
		/// <value>This type is varchar</value>
		[DescriptionAttribute("")]
		public System.String CourseCode
		{
			get { return _CourseCode; }
			set
			{
				if (_CourseCode == value)
					return;
					
				OnBeforeChanged(CourseColumns.CourseCode);
				_CourseCode = value;
				_isdirty = true;
				OnAfterChanged(CourseColumns.CourseCode);
			}
		}
	
		/// <summary>
		/// 	Gets or Sets the Title property. 
		///		
		/// </summary>
		/// <value>This type is varchar</value>
		[DescriptionAttribute("")]
		public System.String Title
		{
			get { return _Title; }
			set
			{
				if (_Title == value)
					return;
					
				OnBeforeChanged(CourseColumns.Title);
				_Title = value;
				_isdirty = true;
				OnAfterChanged(CourseColumns.Title);
			}
		}
	
		/// <summary>
		/// 	Gets or Sets the SciCredit property. 
		///		
		/// </summary>
		/// <value>This type is int</value>
		[DescriptionAttribute("")]
		public System.Int32 SciCredit
		{
			get { return _SciCredit; }
			set
			{
				if (_SciCredit == value)
					return;
					
				OnBeforeChanged(CourseColumns.SciCredit);
				_SciCredit = value;
				_isdirty = true;
				OnAfterChanged(CourseColumns.SciCredit);
			}
		}
	
		/// <summary>
		/// 	Gets or Sets the CompCredit property. 
		///		
		/// </summary>
		/// <value>This type is int</value>
		[DescriptionAttribute("")]
		public System.Int32 CompCredit
		{
			get { return _CompCredit; }
			set
			{
				if (_CompCredit == value)
					return;
					
				OnBeforeChanged(CourseColumns.CompCredit);
				_CompCredit = value;
				_isdirty = true;
				OnAfterChanged(CourseColumns.CompCredit);
			}
		}
	
		/// <summary>
		/// 	Gets or Sets the LecCredit property. 
		///		
		/// </summary>
		/// <value>This type is int</value>
		[DescriptionAttribute("")]
		public System.Int32 LecCredit
		{
			get { return _LecCredit; }
			set
			{
				if (_LecCredit == value)
					return;
					
				OnBeforeChanged(CourseColumns.LecCredit);
				_LecCredit = value;
				_isdirty = true;
				OnAfterChanged(CourseColumns.LecCredit);
			}
		}
	
		/// <summary>
		/// 	Gets or Sets the ChangeStamp property. 
		///		
		/// </summary>
		/// <value>This type is smalldatetime</value>
		[DescriptionAttribute("")]
		public System.DateTime ChangeStamp
		{
			get { return _ChangeStamp; }
			set
			{
				if (_ChangeStamp == value)
					return;
					
				OnBeforeChanged(CourseColumns.ChangeStamp);
				_ChangeStamp = value;
				_isdirty = true;
				OnAfterChanged(CourseColumns.ChangeStamp);
			}
		}
	
	

		private bool _isdeleted = false;
		/// <summary>
		/// 	True if object has been <see cref="MarkToDelete"/>. ReadOnly.
		/// </summary>
		[BrowsableAttribute(false)]
		public bool IsDeleted
		{
			get { return _isdeleted; }
			set { _isdeleted = value; }
		}


		private bool _isdirty = false;
		/// <summary>
		///		Indicates if the object has been modified from its original state.
		/// </summary>
		///<value>True if object has been modified from its original state; otherwise False;</value>
		[BrowsableAttribute(false)]
		public bool IsDirty
		{
			get { return _isdirty; }
			set { _isdirty = value; }
		}
		

		private bool _isnew = false;
		/// <summary>
		///		Indicates if the object is new.
		/// </summary>
		///<value>True if objectis new; otherwise False;</value>
		[BrowsableAttribute(false)]
		public bool IsNew
		{
			get { return _isnew; }
			set { _isnew = value; }
		}

		/// <summary>
		///		The name of the underlying database table.
		/// </summary>
		[BrowsableAttribute(false)]
		public string TableName
		{
			get { return "Course"; }
		}

private CourseTakenByStudentCollection _CourseTakenByStudentCollection = new CourseTakenByStudentCollection();
	
/// <summary>
///	Holds a collection of CourseTakenByStudent objects
///	which are related to this object through the relation FK_CourseTakenByStudent_Course
/// </summary>	
public CourseTakenByStudentCollection CourseTakenByStudentCollection
{
	get { return _CourseTakenByStudentCollection; }
	set { _CourseTakenByStudentCollection = value; }	
}

private CourseSectionCollection _CourseSectionCollection = new CourseSectionCollection();
	
/// <summary>
///	Holds a collection of CourseSection objects
///	which are related to this object through the relation FK_CourseSection_Course
/// </summary>	
public CourseSectionCollection CourseSectionCollection
{
	get { return _CourseSectionCollection; }
	set { _CourseSectionCollection = value; }	
}
		
		#endregion
		
		#region Methods	
		
		/// <summary>
		/// Accepts the changes made to this object by setting each flags to false.
		/// </summary>
		public void AcceptChanges()
		{
			_isdeleted = false;
			_isdirty = false;
			_isnew = false;
		}
		
		
		///<summary>
		///  TODO: Revert all changes and restore original values.
		///  Currently not supported.
		///</summary>
		public virtual void CancelChanges(){
			throw new NotSupportedException("Method currently not Supported.");
		}
		
		///<summary>
		///   Marks entity to be deleted.
		///</summary>
		public void MarkToDelete()
		{
			_isdeleted = true;
		}
		
		#region ICloneable Members
		///<summary>
		///  Returns a Typed CourseBase Entity 
		///</summary>
		public virtual CourseBase Copy()
		{
			//shallow copy entity
			Course copy = new Course();
			copy.ID = this._ID;
			copy.CourseCode = this._CourseCode;
			copy.Title = this._Title;
			copy.SciCredit = this._SciCredit;
			copy.CompCredit = this._CompCredit;
			copy.LecCredit = this._LecCredit;
			copy.ChangeStamp = this._ChangeStamp;
					
			copy.AcceptChanges();
			return (Course)copy;
		}
		
		///<summary>
		/// ICloneable.Clone() Member, returns the Deep Copy of this entity.
		///</summary>
		public object Clone(){
			return this.Copy();
		}
		
		///<summary>
		/// Returns a deep copy of the child collection object passed in.
		///</summary>
		public static object MakeCopyOf(object x)
		{
			if (x is ICloneable)
			{
				// Return a deep copy of the object
				return ((ICloneable)x).Clone();
			}
			else
				throw new System.NotSupportedException("Object Does Not Implement the ICloneable Interface.");
		}
		#endregion
		
		
		///<summary>
		/// Returns a value indicating whether this instance is equal to a specified object.
		///</summary>
		///<param name="toObject">An object to compare to this instance.</param>
		///<returns>true if toObject is a <see cref="CourseBase"/> and has the same value as this instance; otherwise, false.</returns>
		public bool Equals(CourseBase toObject)
		{
			return Equals(this, toObject);
		}
		
		
		///<summary>
		/// Determines whether the specified <see cref="CourseBase"/> instances are considered equal.
		///</summary>
		///<param name="Object1">The first <see cref="CourseBase"/> to compare.</param>
		///<param name="Object2">The second <see cref="CourseBase"/> to compare. </param>
		///<returns>true if Object1 is the same instance as Object2 or if both are null references or if objA.Equals(objB) returns true; otherwise, false.</returns>
		public static bool Equals(CourseBase Object1, CourseBase Object2)
		{
			bool equal = true;
			if (Object1.ID != Object2.ID)
				equal = false;
			if (Object1.CourseCode != Object2.CourseCode)
				equal = false;
			if (Object1.Title != Object2.Title)
				equal = false;
			if (Object1.SciCredit != Object2.SciCredit)
				equal = false;
			if (Object1.CompCredit != Object2.CompCredit)
				equal = false;
			if (Object1.LecCredit != Object2.LecCredit)
				equal = false;
			if (Object1.ChangeStamp != Object2.ChangeStamp)
				equal = false;
			return equal;
		}
		
		#endregion
		
		#region IComparable Members
		///<summary>
		/// Compares this instance to a specified object and returns an indication of their relative values.
		///<param name="obj">An object to compare to this instance, or a null reference (Nothing in Visual Basic).</param>
		///</summary>
		///<returns>A signed integer that indicates the relative order of this instance and obj.</returns>
		public int CompareTo(object obj)
		{
			return this.ID.CompareTo(((CourseBase)obj).ID);
		}
	
		#endregion
		
			
		#region "IsColumnNull"
		#endregion "IsColumnNull"
		
		///<summary>
		/// Returns a String that represents the current object.
		///</summary>
		public override string ToString()
		{
			return string.Format("{8}{7}- ID: {0}{7}- CourseCode: {1}{7}- Title: {2}{7}- SciCredit: {3}{7}- CompCredit: {4}{7}- LecCredit: {5}{7}- ChangeStamp: {6}{7}", ID, CourseCode, Title, SciCredit, CompCredit, LecCredit, ChangeStamp, Environment.NewLine, this.GetType());
		}
	
	}//End Class
	
	
	/// <summary>
	/// Enumerate the Course columns.
	/// </summary>
	public enum CourseColumns
	{
		/// <summary>
		/// ID : 
		/// </summary>
		ID,
		/// <summary>
		/// CourseCode : 
		/// </summary>
		CourseCode,
		/// <summary>
		/// Title : 
		/// </summary>
		Title,
		/// <summary>
		/// SciCredit : 
		/// </summary>
		SciCredit,
		/// <summary>
		/// CompCredit : 
		/// </summary>
		CompCredit,
		/// <summary>
		/// LecCredit : 
		/// </summary>
		LecCredit,
		/// <summary>
		/// ChangeStamp : 
		/// </summary>
		ChangeStamp
	}//End enum

} // end namespace

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Architect BT, UK (ex British Telecom)
United Kingdom United Kingdom

Comments and Discussions