Skip to content

Instantly share code, notes, and snippets.

@yemrekeskin
Created May 9, 2013 06:29
Show Gist options
  • Save yemrekeskin/5545919 to your computer and use it in GitHub Desktop.
Save yemrekeskin/5545919 to your computer and use it in GitHub Desktop.
public class BaseMessage
{
Guid moduleReference;
public Guid ModuleReference
{
get { return moduleReference; }
set { moduleReference = value; }
}
int processReference;
public int ProcessReference
{
get { return processReference; }
set { processReference = value; }
}
string screenCode;
public string ScreenCode
{
get { return screenCode; }
set { screenCode = value; }
}
char recordStatus;
public char RecordStatus
{
get { return recordStatus; }
set { recordStatus = value; }
}
bool isActive;
public bool IsActive
{
get { return isActive; }
set { isActive = value; }
}
DateTime createdDate;
public DateTime CreatedDate
{
get { return createdDate; }
set { createdDate = value; }
}
DateTime lastUpdatedDate;
public DateTime LastUpdatedDate
{
get { return lastUpdatedDate; }
set { lastUpdatedDate = value; }
}
string lastUpdatedUsercode;
public string LastUpdatedUsercode
{
get { return lastUpdatedUsercode; }
set { lastUpdatedUsercode = value; }
}
#region "Casting to sub classes"
/// <summary>
/// Converting BaseMessage to DomesticPaymentMessage
/// </summary>
/// <returns></returns>
public virtual DomesticPaymentMessage ToDomesticPaymentMessage()
{
DomesticPaymentMessage msg = new DomesticPaymentMessage();
FillField(msg);
return msg;
}
public virtual DomesticPaymentMessage ToDomesticPaymentMessage(DomesticPaymentMessage msg)
{
FillField(msg);
return msg;
}
/// <summary>
/// Converting BaseMessage to ForeignPaymentMessage
/// </summary>
/// <returns></returns>
public virtual ForeignPaymentMessage ToForeignPaymentMessage()
{
ForeignPaymentMessage msg = new ForeignPaymentMessage();
FillField(msg);
return msg;
}
public virtual ForeignPaymentMessage ToForeignPaymentMessage(ForeignPaymentMessage msg)
{
FillField(msg);
return msg;
}
private void FillField(BaseMessage msg)
{
msg.ModuleReference = this.ModuleReference;
msg.ProcessReference = this.ProcessReference;
msg.ScreenCode = String.IsNullOrEmpty(this.ScreenCode) ? "" : this.ScreenCode;
msg.RecordStatus = this.RecordStatus;
msg.IsActive = this.IsActive;
msg.RecordStatus = this.RecordStatus;
msg.LastUpdatedUsercode = this.lastUpdatedUsercode;
msg.LastUpdatedDate = this.LastUpdatedDate;
msg.CreatedDate = this.CreatedDate;
}
#endregion
}
public class DomesticPaymentMessage
:BaseMessage
{
}
public class ForeignPaymentMessage
:BaseMessage
{
int accountType;
public int AccountType
{
get { return accountType; }
set { accountType = value; }
}
int accountBranchCode;
public int AccountBranchCode
{
get { return accountBranchCode; }
set { accountBranchCode = value; }
}
int accountNumber;
public int AccountNumber
{
get { return accountNumber; }
set { accountNumber = value; }
}
int accountSuffix;
public int AccountSuffix
{
get { return accountSuffix; }
set { accountSuffix = value; }
}
public override ForeignPaymentMessage ToForeignPaymentMessage()
{
return base.ToForeignPaymentMessage(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment