|
using ChainOfCommandExample.Data;
using HarpyEagle.Chain;
/***************************************************************************************
* Author: Curt C.
* Email : harpyeaglecp@aol.com
*
* This software is released under the Code Project Open License (CPOL)
* See official license description at: http://www.codeproject.com/info/cpol10.aspx
*
* This software is provided AS-IS without any warranty of any kind.
*
* Modification History:
* 08/10/2009 curtc Creation of class for www.codeproject.com example.
***************************************************************************************/
namespace ChainOfCommandExample.BankDataValidationHandlers.TransactionHandlers
{
/// <summary>
/// Chain handler that checks to see if the supplied account number is a
/// valid account number in the data store.
/// </summary>
public class TransactionAccountNumberValidationHandler : IChainHandler<AccountTransactionData>
{
/// <summary>
/// Method to process the supplied requestData.
/// </summary>
/// <param name="requestData">AccountTransactionData object</param>
/// <returns>
/// HandlerResult.CHAIN_DATA_NOT_HANDLED (since account transaction handlers ALL receive the data)
/// </returns>
/// <exception cref="ChainHandler.ChainHandlerException">
/// Thrown if the account number is invalid (not found in the data store).
/// </exception>
public HandlerResult ProcessRequest(AccountTransactionData requestData)
{
if (DataStore.IsAccountNumberValid(requestData.AccountNumber) == false)
throw new ChainHandlerException("(TransactionAccountNumberValidationHandler) Invalid transaction account number:"+requestData.AccountNumber);
return HandlerResult.CHAIN_DATA_NOT_HANDLED;
}
}
}
|
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.
Senior Software Developer with background history in developing software for both Unix and Windows based systems using a variety of languages and technologies, including: C#, C++, C, and Java.