예제 #1
0
        public void OpenNewAccount(string accountNo)
        {
            IAccountData objAccountData = null;

            try
            {
                objAccountData = Builder.AccountData();

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew))
                {
                    if (objAccountData.CheckAccount(accountNo))
                    {
                        throw new Exception("Already account.");
                    }
                    if (!objAccountData.AddAccount(accountNo, 0))
                    {
                        throw new Exception("Error: Can not add data");
                    }
                    scope.Complete();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                if (objAccountData != null)
                {
                    objAccountData.Dispose();
                }
            }
        }
예제 #2
0
        public void CloseAccount(string accountNo)
        {
            IAccountData objAccountData = null;

            try
            {
                objAccountData = Builder.AccountData();
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    if (!objAccountData.CheckAccount(accountNo))
                    {
                        throw new Exception("Account not found.");
                    }
                    if (!objAccountData.DeleteAccount(accountNo))
                    {
                        throw new Exception("Error: Can not delete data.");
                    }
                    scope.Complete();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                if (objAccountData != null)
                {
                    objAccountData.Dispose();
                }
            }
        }
예제 #3
0
 public bool CheckAccount(string accountNo)
 {
     try
     {
         using (IAccountData accountData = Builder.AccountData())
         {
             return(accountData.CheckAccount(accountNo));
         }
     }
     catch (Exception ex)
     {
         throw new BSLException("CheckAccount event occurs an error.[" + ex.Message + "]", ex, true);
     }
 }