/// <summary> /// Apply business method. /// </summary> /// <param name="Account">A Account value.</param> /// <returns>Returns a Account object.</returns> public Account Apply(Account Account) { Account.Status = AccountStatuses.Pending; Account.DateSubmitted = DateTime.Now; Account.IsCompleted = false; AccountStatusLog log = CreateLog(Account); // Data access component declarations. var AccountDAC = new AccountDAL(); var AccountStatusLogDAC = new AccountStatusLogDAL(); // Check for overlapping Accounts. if (AccountDAC.IsOverlap(Account)) { throw new ApplicationException("Date range is overlapping with another Account."); } using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { // Step 1 - Calling Create on AccountDAC. AccountDAC.Create(Account); // Step 2 - Calling Create on AccountStatusLogDAC. log.AccountID = Account.AccountID; AccountStatusLogDAC.Create(log); ts.Complete(); } return Account; }