Example #1
0
 public void TestSuccess1()
 {
     _NewAccount.IsAcceptEmail    = true;
     _NewAccount.IsAcceptSMS      = true;
     _NewAccount.IsValidateUsbKey = false;
     Expect.Call(_IAccountDal.GetAccountById(_NewAccount.Id)).Return(_CurrentAccount);
     Expect.Call(delegate { _IAccountDal.UpdateAccount(_CurrentAccount); });
     mocks.ReplayAll();
     _Target = new SavePersonalConfig(_IAccountDal, _NewAccount, null);
     _Target.Excute();
     mocks.ReplayAll();
     Assert.AreEqual(_NewAccount.IsAcceptEmail, _CurrentAccount.IsAcceptEmail);
     Assert.AreEqual(_NewAccount.IsAcceptSMS, _CurrentAccount.IsAcceptSMS);
     Assert.AreEqual(_NewAccount.IsValidateUsbKey, _CurrentAccount.IsValidateUsbKey);
 }
Example #2
0
        public List <Account> GetAccountByNameString(string sendAccount, out string errorname)
        {
            IAccountDal IAccountDal = DalInstance.AccountDalInstance;

            errorname = string.Empty;
            List <Account> retaccounts = new List <Account>();

            sendAccount = sendAccount.Replace(" ", "");
            sendAccount = sendAccount.Replace(" ", "");
            sendAccount = sendAccount.Replace('(', '(');
            sendAccount = sendAccount.Replace(')', ')');
            sendAccount = sendAccount.Replace(';', ';');
            string[] accounts = sendAccount.Split(';');
            for (int i = 0; i < accounts.Length; i++)
            {
                accounts[i] = accounts[i].Trim();

                Account account = IAccountDal.GetAccountByName(accounts[i]);
                if (account == null)
                {
                    errorname += string.IsNullOrEmpty(errorname) ? accounts[i] : "," + accounts[i];
                }
                else
                {
                    if (Model.Utility.Tools.FindAccountById(retaccounts, account.Id) == null)
                    {
                        account = IAccountDal.GetAccountById(account.Id);
                        retaccounts.Add(account);
                    }
                }
            }
            return(retaccounts);
        }
Example #3
0
        protected override void Validation()
        {
            _CurrentAccount = _IAccountDal.GetAccountById(_Account.Id);
            if (_CurrentAccount == null)
            {
                throw MessageKeys.AppException(MessageKeys._Account_IsNot_Exist);
            }
            if (_Account.IsValidateUsbKey && _CurrentAccount.UsbKey == null)
            {
                throw MessageKeys.AppException(MessageKeys._Account_IsValidateUsbKey_NoUsbKey);
            }

            if (_ElectronIdiograph != null && _ElectronIdiograph.Length > 0 && _CurrentAccount.UsbKey == null)
            {
                throw MessageKeys.AppException(MessageKeys._Account_ElectronIdiograph_NoUsbKey);
            }

            _ElectronIdiograph = SymmetricEncryptStream(_ElectronIdiograph, _CurrentAccount.UsbKey);
        }
Example #4
0
 public Account GetAccountById(int id)
 {
     return(new Account(_accountDal.GetAccountById(id)));
 }
Example #5
0
        private Account GetDepartmentLeaderByEmployeeId(int accoutID)
        {
            Account account = _IAccountDal.GetAccountById(accoutID);

            return(_IAccountDal.GetAccountById(account.Dept.Leader.Id));
        }