bankbecomp.cs

来自「工作流的基本资料(文档资料」· CS 代码 · 共 43 行

CS
43
字号
using Castle.Services.Transaction;
using Castle.Facilities.NHibernateIntegration;
using NetBpm.Util.DB;

namespace NetBpm.Test.Bank.EComp.Impl
{
	[Transactional]
	public class BankBEComp : AbstractBank, IBankB
	{
		public BankBEComp(ISessionManager sessionManager) : base(sessionManager)
		{
		}

		override public string GetName()
		{
			return "BankB"; 
		}

		[Transaction(TransactionMode.Requires)]
		public void DeposidMoney(string name,float money)
		{
			DbSession dbSession = null;
			try
			{
				dbSession = OpenSession();
				instance.Deposid(GetName(),name,money,dbSession);
				// Ohhhh I forgot the rules ;-)
				if (money<0)
				{
					throw new AccountException("it is not allowed to transfer a negative amount of money!");
				}
			}
			finally
			{
				if (dbSession!=null)
				{
					dbSession.Close();
				}
			}
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?