예제 #1
0
        /// <summary>
        /// Create an new account.
        /// </summary>
        /// <param name="emId">Id of employee who use this account.</param>
        /// <param name="UserName">User name of this account.</param>
        /// <param name="password">Password of this account.</param>
        /// <param name="roleName">Role of this account.</param>
        public void CreateAccount(Guid accountId, Guid emId, String UserName, String password, String roleName)
        {
            Account newAcc = new Account();

            newAcc.Account_Id       = accountId;
            newAcc.Employee_Id      = emId;
            newAcc.Account_UserName = UserName;
            newAcc.Account_Password = SecurityHelper.Instance.GetMd5Hash(password);
            newAcc.Role_Name        = roleName;
            newAcc.Account_IsLocked = false;
            newAcc.Account_IsDelete = false;

            // Check Employee_Id exists

            // Check user name is unique
            if (AD.GetAccount(newAcc.Account_UserName) != null)
            {
                throw new Exception("This user name is existed.");
            }

            int result = AD.CreateAccount(newAcc);

            if (result == -1)
            {
                throw new Exception("An error occurred while executing this operation.");
            }
        }
예제 #2
0
        //public List<Customer> GetAll()
        //{
        //    CustomerDAL dal = new CustomerDAL();
        //    var customers = dal.GetAll();
        //    return customers;
        //}
        //public Accounts GetAccountsBL(string AccountID)
        //{
        //    AccountDAL a = new AccountDAL();
        //    var AccountType = a.AccountType(AccountID);
        //    var acc = a.GetAccountsDAL(AccountType, AccountID);
        //    return acc;
        //}

        public Accounts OpenNewAccount(string Account, Customer CustId)
        {
            AccountDAL ADal    = new AccountDAL();
            var        accinfo = ADal.CreateAccount(Account, CustId);

            CustId.NumberOfAccount++;
            return(accinfo);
        }
예제 #3
0
 public void CreateAccount(Account account)
 {
     AccountDAL.CreateAccount(account);
 }
예제 #4
0
        public string CreateAccount(IAccount accountNew)
        {
            AccountDAL accountDAL = new AccountDAL();

            return(accountDAL.CreateAccount(accountNew));
        }