// =====================================================================================
// 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 Account.cs instead.
*/
using System;
using System.ComponentModel;
using System.Collections;
using System.Xml.Serialization;
namespace SmartInstitute
{
#region AccountEventArgs 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="Account"/> object.</remarks>
public class AccountEventArgs : System.EventArgs
{
private AccountColumns column;
///<summary>
/// Initalizes a new Instance of the AccountEventArgs class.
///</summary>
public AccountEventArgs(AccountColumns column)
{
this.column = column;
}
///<summary>
/// The AccountColumns that was modified, which has raised the event.
///</summary>
///<value cref="AccountColumns" />
public AccountColumns Column
{
get {return this.column;}
}
}
#endregion
///<summary>
/// Define a delegate for all Account related events.
///</summary>
public delegate void AccountEventHandler(object sender, AccountEventArgs e);
///<summary>
/// An object representation of the 'Account' 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="Account"/> class.
/// </remarks>
[Serializable]
public class AccountBase : System.IComparable, System.ICloneable, IEntity
{
#region "Variable Declarations"
/// <summary>
/// ID :
/// </summary>
protected System.Int32 _ID = (int)0;
/// <summary>
/// StudentID :
/// </summary>
protected System.Int32 _StudentID = (int)0;
/// <summary>
/// TransactionDescription :
/// </summary>
protected System.String _TransactionDescription = string.Empty;
/// <summary>
/// TransactionDate :
/// </summary>
protected System.DateTime _TransactionDate = DateTime.MinValue;
/// <summary>
/// DebitAmount :
/// </summary>
protected System.Decimal _DebitAmount = 0;
/// <summary>
/// CreditAmount :
/// </summary>
protected System.Decimal _CreditAmount = 0;
/// <summary>
/// Balance :
/// </summary>
protected System.Decimal _Balance = 0;
/// <summary>
/// ChangeStamp :
/// </summary>
protected System.DateTime _ChangeStamp = DateTime.MinValue;
/// <summary>
/// Type :
/// </summary>
protected System.Int32 _Type = (int)0;
/// <summary>
/// BankName :
/// </summary>
protected System.String _BankName = string.Empty;
/// <summary>
/// CheckNumber :
/// </summary>
protected System.String _CheckNumber = string.Empty;
/// <summary>
/// ORNumber :
/// </summary>
protected System.String _ORNumber = string.Empty;
/// <summary>
/// Occurs before the object is changed.
/// </summary>
public event AccountEventHandler BeforeChanged;
/// <summary>
/// Occurs after the object is changed.
/// </summary>
public event AccountEventHandler AfterChanged;
#endregion "Variable Declarations"
#region "Constructors"
///<summary>
/// Creates a new <see cref="AccountBase"/> instance.
///</summary>
public AccountBase()
{
}
///<summary>
/// Creates a new <see cref="AccountBase"/> instance.
///</summary>
///<param name="ID"></param>
///<param name="StudentID"></param>
///<param name="TransactionDescription"></param>
///<param name="TransactionDate"></param>
///<param name="DebitAmount"></param>
///<param name="CreditAmount"></param>
///<param name="Balance"></param>
///<param name="ChangeStamp"></param>
///<param name="Type"></param>
///<param name="BankName"></param>
///<param name="CheckNumber"></param>
///<param name="ORNumber"></param>
public AccountBase(System.Int32 ID, System.Int32 StudentID, System.String TransactionDescription, System.DateTime TransactionDate, System.Decimal DebitAmount, System.Decimal CreditAmount, System.Decimal Balance, System.DateTime ChangeStamp, System.Int32 Type, System.String BankName, System.String CheckNumber, System.String ORNumber)
{
_ID = ID;
_StudentID = StudentID;
_TransactionDescription = TransactionDescription;
_TransactionDate = TransactionDate;
_DebitAmount = DebitAmount;
_CreditAmount = CreditAmount;
_Balance = Balance;
_ChangeStamp = ChangeStamp;
_Type = Type;
_BankName = BankName;
_CheckNumber = CheckNumber;
_ORNumber = ORNumber;
}
#endregion "Constructors"
#region Events trigger
/// <summary>
/// Raises the <see cref="BeforeChanged" /> event.
/// </summary>
/// <param name="column">The <see cref="AccountColumns"/> which has fired the event.</param>
public void OnBeforeChanged(AccountColumns column)
{
if(BeforeChanged != null)
{
BeforeChanged(this, new AccountEventArgs(column));
}
}
/// <summary>
/// Raises the <see cref="AfterChanged" /> event.
/// </summary>
/// <param name="column">The <see cref="AccountColumns"/> which has fired the event.</param>
public void OnAfterChanged(AccountColumns column)
{
if(AfterChanged != null)
{
AfterChanged(this, new AccountEventArgs(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(AccountColumns.ID);
_ID = value;
_isdirty = true;
OnAfterChanged(AccountColumns.ID);
}
}
/// <summary>
/// Gets or Sets the StudentID property.
///
/// </summary>
/// <value>This type is int</value>
[DescriptionAttribute("")]
public System.Int32 StudentID
{
get { return _StudentID; }
set
{
if (_StudentID == value)
return;
OnBeforeChanged(AccountColumns.StudentID);
_StudentID = value;
_isdirty = true;
OnAfterChanged(AccountColumns.StudentID);
}
}
/// <summary>
/// Gets or Sets the TransactionDescription property.
///
/// </summary>
/// <value>This type is varchar</value>
[DescriptionAttribute("")]
public System.String TransactionDescription
{
get { return _TransactionDescription; }
set
{
if (_TransactionDescription == value)
return;
OnBeforeChanged(AccountColumns.TransactionDescription);
_TransactionDescription = value;
_isdirty = true;
OnAfterChanged(AccountColumns.TransactionDescription);
}
}
/// <summary>
/// Gets or Sets the TransactionDate property.
///
/// </summary>
/// <value>This type is datetime</value>
[DescriptionAttribute("")]
public System.DateTime TransactionDate
{
get { return _TransactionDate; }
set
{
if (_TransactionDate == value)
return;
OnBeforeChanged(AccountColumns.TransactionDate);
_TransactionDate = value;
_isdirty = true;
OnAfterChanged(AccountColumns.TransactionDate);
}
}
/// <summary>
/// Gets or Sets the DebitAmount property.
///
/// </summary>
/// <value>This type is money</value>
[DescriptionAttribute("")]
public System.Decimal DebitAmount
{
get { return _DebitAmount; }
set
{
if (_DebitAmount == value)
return;
OnBeforeChanged(AccountColumns.DebitAmount);
_DebitAmount = value;
_isdirty = true;
OnAfterChanged(AccountColumns.DebitAmount);
}
}
/// <summary>
/// Gets or Sets the CreditAmount property.
///
/// </summary>
/// <value>This type is money</value>
[DescriptionAttribute("")]
public System.Decimal CreditAmount
{
get { return _CreditAmount; }
set
{
if (_CreditAmount == value)
return;
OnBeforeChanged(AccountColumns.CreditAmount);
_CreditAmount = value;
_isdirty = true;
OnAfterChanged(AccountColumns.CreditAmount);
}
}
/// <summary>
/// Gets or Sets the Balance property.
///
/// </summary>
/// <value>This type is money</value>
[DescriptionAttribute("")]
public System.Decimal Balance
{
get { return _Balance; }
set
{
if (_Balance == value)
return;
OnBeforeChanged(AccountColumns.Balance);
_Balance = value;
_isdirty = true;
OnAfterChanged(AccountColumns.Balance);
}
}
/// <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(AccountColumns.ChangeStamp);
_ChangeStamp = value;
_isdirty = true;
OnAfterChanged(AccountColumns.ChangeStamp);
}
}
/// <summary>
/// Gets or Sets the Type property.
///
/// </summary>
/// <value>This type is int</value>
[DescriptionAttribute("")]
public System.Int32 Type
{
get { return _Type; }
set
{
if (_Type == value)
return;
OnBeforeChanged(AccountColumns.Type);
_Type = value;
_isdirty = true;
OnAfterChanged(AccountColumns.Type);
}
}
/// <summary>
/// Gets or Sets the BankName property.
///
/// </summary>
/// <value>This type is varchar</value>
[DescriptionAttribute("")]
public System.String BankName
{
get { return _BankName; }
set
{
if (_BankName == value)
return;
OnBeforeChanged(AccountColumns.BankName);
_BankName = value;
_isdirty = true;
OnAfterChanged(AccountColumns.BankName);
}
}
/// <summary>
/// Gets or Sets the CheckNumber property.
///
/// </summary>
/// <value>This type is varchar</value>
[DescriptionAttribute("")]
public System.String CheckNumber
{
get { return _CheckNumber; }
set
{
if (_CheckNumber == value)
return;
OnBeforeChanged(AccountColumns.CheckNumber);
_CheckNumber = value;
_isdirty = true;
OnAfterChanged(AccountColumns.CheckNumber);
}
}
/// <summary>
/// Gets or Sets the ORNumber property.
///
/// </summary>
/// <value>This type is varchar</value>
[DescriptionAttribute("")]
public System.String ORNumber
{
get { return _ORNumber; }
set
{
if (_ORNumber == value)
return;
OnBeforeChanged(AccountColumns.ORNumber);
_ORNumber = value;
_isdirty = true;
OnAfterChanged(AccountColumns.ORNumber);
}
}
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 "Account"; }
}
#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 AccountBase Entity
///</summary>
public virtual AccountBase Copy()
{
//shallow copy entity
Account copy = new Account();
copy.ID = this._ID;
copy.StudentID = this._StudentID;
copy.TransactionDescription = this._TransactionDescription;
copy.TransactionDate = this._TransactionDate;
copy.DebitAmount = this._DebitAmount;
copy.CreditAmount = this._CreditAmount;
copy.Balance = this._Balance;
copy.ChangeStamp = this._ChangeStamp;
copy.Type = this._Type;
copy.BankName = this._BankName;
copy.CheckNumber = this._CheckNumber;
copy.ORNumber = this._ORNumber;
copy.AcceptChanges();
return (Account)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="AccountBase"/> and has the same value as this instance; otherwise, false.</returns>
public bool Equals(AccountBase toObject)
{
return Equals(this, toObject);
}
///<summary>
/// Determines whether the specified <see cref="AccountBase"/> instances are considered equal.
///</summary>
///<param name="Object1">The first <see cref="AccountBase"/> to compare.</param>
///<param name="Object2">The second <see cref="AccountBase"/> 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(AccountBase Object1, AccountBase Object2)
{
bool equal = true;
if (Object1.ID != Object2.ID)
equal = false;
if (Object1.StudentID != Object2.StudentID)
equal = false;
if (Object1.TransactionDescription != Object2.TransactionDescription)
equal = false;
if (Object1.TransactionDate != Object2.TransactionDate)
equal = false;
if (Object1.DebitAmount != Object2.DebitAmount)
equal = false;
if (Object1.CreditAmount != Object2.CreditAmount)
equal = false;
if (Object1.Balance != Object2.Balance)
equal = false;
if (Object1.ChangeStamp != Object2.ChangeStamp)
equal = false;
if (Object1.Type != Object2.Type)
equal = false;
if (Object1.BankName != Object2.BankName)
equal = false;
if (Object1.CheckNumber != Object2.CheckNumber)
equal = false;
if (Object1.ORNumber != Object2.ORNumber)
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(((AccountBase)obj).ID);
}
#endregion
#region "IsColumnNull"
#endregion "IsColumnNull"
///<summary>
/// Returns a String that represents the current object.
///</summary>
public override string ToString()
{
return string.Format("{13}{12}- ID: {0}{12}- StudentID: {1}{12}- TransactionDescription: {2}{12}- TransactionDate: {3}{12}- DebitAmount: {4}{12}- CreditAmount: {5}{12}- Balance: {6}{12}- ChangeStamp: {7}{12}- Type: {8}{12}- BankName: {9}{12}- CheckNumber: {10}{12}- ORNumber: {11}{12}", ID, StudentID, TransactionDescription, TransactionDate, DebitAmount, CreditAmount, Balance, ChangeStamp, Type, BankName, CheckNumber, ORNumber, Environment.NewLine, this.GetType());
}
}//End Class
/// <summary>
/// Enumerate the Account columns.
/// </summary>
public enum AccountColumns
{
/// <summary>
/// ID :
/// </summary>
ID,
/// <summary>
/// StudentID :
/// </summary>
StudentID,
/// <summary>
/// TransactionDescription :
/// </summary>
TransactionDescription,
/// <summary>
/// TransactionDate :
/// </summary>
TransactionDate,
/// <summary>
/// DebitAmount :
/// </summary>
DebitAmount,
/// <summary>
/// CreditAmount :
/// </summary>
CreditAmount,
/// <summary>
/// Balance :
/// </summary>
Balance,
/// <summary>
/// ChangeStamp :
/// </summary>
ChangeStamp,
/// <summary>
/// Type :
/// </summary>
Type,
/// <summary>
/// BankName :
/// </summary>
BankName,
/// <summary>
/// CheckNumber :
/// </summary>
CheckNumber,
/// <summary>
/// ORNumber :
/// </summary>
ORNumber
}//End enum
} // end namespace