/// <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;
        }
コード例 #2
0
        public string Create(string email, string id_customer, string password, string confirm_password)
        {
            account_dal.setAccount(email, id_customer, password, confirm_password, "khachhang");

            if (email == "" || password == "" || confirm_password == "")
            {
                return("Hãy điền đầy đủ thông tin !!!");
            }
            if (account_dal.Check_Exists_IdCustomer() == true)
            {
                return("Khách hàng này đã có tài khoản, xin hãy kiểm tra lại!!!");
            }
            if (account_dal.Check_Exists_Email() == true)
            {
                return("Email này đã có người sử dụng !!!");
            }
            if (IsValidEmail(email) == false)
            {
                return("Email không hợp lệ !!!");
            }
            if (password.Length < 6)
            {
                return("Mật khẩu phải có ít nhất 6 ký tự !!!");
            }
            if (confirm_password != password)
            {
                return("Mật khẩu nhập lại không khớp với mật khẩu đã nhập!!!");
            }
            account_dal.Create();
            return("Đã thêm thành công tài khoản !!!");
        }
コード例 #3
0
        public void Create(Account newAccount)
        {
            // Call the DAL to create a new record.
            AccountDAL accountDAL = new AccountDAL();

            accountDAL.Create(newAccount);
        }
コード例 #4
0
ファイル: AccountBL.cs プロジェクト: Epags1996/Project0
        public string Create(Account newAccount)
        {
            AccountDAL accountDAL = new AccountDAL();

            return(accountDAL.Create(newAccount));
        }