コード例 #1
0
 void addAccountList(Accounts obj)
 {
     AccountsList.Add(new AccountsDetailVM()
     {
         Data = obj
     });
 }
コード例 #2
0
 private void AddAccount(Account account)
 {
     DataCollection.ReadFiles();
     AccountsList.Add(account);
     DataCollection.AccountList.Add(account);
     DataCollection.SaveFiles();
     MessageBox.Success("Account has been created.");
 }
コード例 #3
0
        private void CreateNewAccountExecute(object parameter)
        {
            Object[]    parameters  = parameter as Object[];
            String      username    = parameters[0] as String;
            String      password    = parameters[1] as String;
            String      firstName   = parameters[2] as String;
            String      lastName    = parameters[3] as String;
            object      roleRegular = parameters[4];
            object      roleAdmin   = parameters[5];
            UserControl CreateNewAccountUserControl = parameters[6] as UserControl;

            AccountToAdd = new Account(username)
            {
                FirstName = firstName,
                LastName  = lastName,
                Password  = password,
                Role      = (bool)roleRegular ? ERole.REGULAR : ERole.ADMIN,
            };


            Account createdAccount = null;

            try
            {
                createdAccount = AccountProxy.CreateNewAccount(AccountToAdd);
            }
            catch (Exception e)
            {
                logger.Error($"Error while deleting - server side. Message: {e.Message}");
                LoggerHelper.Instance.LogMessage($"Error while deleting - server side. Message: {e.Message}", EEventPriority.ERROR, EStringBuilder.CLIENT);
            }
            if (createdAccount != null)
            {
                AccountsList.Add(createdAccount);

                logger.Error($"Account successfuly added.");
                LoggerHelper.Instance.LogMessage($"Account successfuly added.", EEventPriority.ERROR, EStringBuilder.CLIENT);

                CurrentWindow = Window.GetWindow(CreateNewAccountUserControl);
                CurrentWindow.Close();
            }
            else
            {
                logger.Error($"Error on server or username already exists.");
                LoggerHelper.Instance.LogMessage($"Error on server or username already exists.", EEventPriority.ERROR, EStringBuilder.CLIENT);

                CurrentWindow = Window.GetWindow(CreateNewAccountUserControl);
                CurrentWindow.Close();
            }
        }
コード例 #4
0
        public void PushBack(Account account)
        {
            AccountsList.Add(new List <Account>());

            if (FlattenAll)
            {
                PushAll(account, AccountsList.Last());
                StableSort(AccountsList.Last());
            }
            else
            {
                SortAccounts(account, AccountsList.Last());
            }

            SortedAccountsI.Add(AccountsList.Last().Begin());
        }
コード例 #5
0
ファイル: AccountsVM.cs プロジェクト: Robson10/RSync
        private void AddAccount()
        {
            AddAccountV addAccountV = new AddAccountV();

            if (addAccountV.ShowDialog() == true)
            {
                if (addAccountV.DataContext != null &&
                    (addAccountV.DataContext is AddAccountVM) &&
                    (addAccountV.DataContext as AddAccountVM).Account != null)
                {
                    Account newAccount = (addAccountV.DataContext as AddAccountVM).Account;
                    AccountsList.Add(newAccount);
                    AccountsList = AccountsList.OrderBy(x => x.Server).ThenBy(x => x.CustomName).ThenBy(x => x.Login).ToList();
                }
            }
        }
コード例 #6
0
        private void AccountsUpdateTask()
        {
            if (UpdateHelper.Instance.AccountsListAdditionHelper.Count != 0)
            {
                foreach (Account a in UpdateHelper.Instance.AccountsListAdditionHelper)
                {
                    if (!AccountsList.Contains(a, new AccountComparer()))
                    {
                        AccountsList.Add(a);
                    }
                }
            }

            if (UpdateHelper.Instance.AccountsListModificationHelper.Count != 0)
            {
                foreach (Account a in UpdateHelper.Instance.AccountsListModificationHelper)
                {
                    if (AccountsList.Contains(a, new AccountComparer()))
                    {
                        Account foundAccount = AccountsList.FirstOrDefault(ac => ac.Username.Equals(a.Username));
                        AccountsList.Remove(foundAccount);
                    }
                }
            }

            if (UpdateHelper.Instance.AccountsListRemovalHelper.Count != 0)
            {
                foreach (Account a in UpdateHelper.Instance.AccountsListRemovalHelper)
                {
                    if (AccountsList.Contains(a, new AccountComparer()))
                    {
                        Account foundAccount = AccountsList.FirstOrDefault(ac => ac.Username.Equals(a.Username));
                        AccountsList.Remove(foundAccount);
                        AccountsList.Add(a);
                    }
                }
            }

            if (++UpdateHelper.Instance.AccountCounter >= UpdateHelper.Instance.Limit - 1)
            {
                UpdateHelper.Instance.AccountsListAdditionHelper     = new List <Account>();
                UpdateHelper.Instance.AccountsListRemovalHelper      = new List <Account>();
                UpdateHelper.Instance.AccountsListModificationHelper = new List <Account>();

                UpdateHelper.Instance.AccountCounter = 0;
            }
        }
コード例 #7
0
        /// <summary>
        /// Opens NewAccountDialogViewModel with DialogService, following MVVM pattern.
        /// </summary>
        public void NewAccountDialogView()
        {
            var     viewModel = new NewAccountDialogViewModel();
            IDialog result    = dialogService.ShowDialog(viewModel);

            if (result != null)
            {
                if (result.ShowDialog().HasValue&& result.Content != null && result.Content.GetType() == typeof(AccountModel))
                {
                    AccountsList.Add((AccountModel)result.Content);
                    //because acconutlist is subscribed to onchange event, listener will be notified and saved.
                }
                else
                {
                    //Future location of error notifier for new account dialog view
                }
            }
        }
コード例 #8
0
        private void ModifyAccountExecute(object parameter)
        {
            Object[] parameters = parameter as Object[];


            Account modifiedAccount = null;

            try
            {
                modifiedAccount = AccountProxy.ModifyAccount(AccountToModify);
            }
            catch (Exception e)
            {
                logger.Error($"Error while deleting - server side. Message: {e.Message}");
                LoggerHelper.Instance.LogMessage($"Error while deleting - server side. Message: {e.Message}", EEventPriority.ERROR, EStringBuilder.CLIENT);
            }

            if (modifiedAccount != null)
            {
                Account foundAccount = AccountsList.FirstOrDefault(a => a.Username.Equals(modifiedAccount.Username));
                AccountsList.Remove(foundAccount);
                AccountsList.Add(modifiedAccount);

                logger.Info($"Account successfully modified.");
                LoggerHelper.Instance.LogMessage($"Account successfully modified.", EEventPriority.INFO, EStringBuilder.CLIENT);
                UserControl uc     = parameters[0] as UserControl;
                Window      window = Window.GetWindow(uc);
                window.Close();
            }
            else
            {
                logger.Error($"Error while deleting - server side.");
                LoggerHelper.Instance.LogMessage($"Error while deleting - server side.", EEventPriority.ERROR, EStringBuilder.CLIENT);
                UserControl uc     = parameters[0] as UserControl;
                Window      window = Window.GetWindow(uc);
                window.Close();
            }
        }
コード例 #9
0
        public void PushBack(Account account)
        {
            AccountsList.Add(new List <Account>());

            if (FlattenAll)
            {
                PushAll(account, AccountsList.Last());
                StableSort(AccountsList.Last());

                if (Logger.Current.ShowDebug("account.sorted"))
                {
                    foreach (var acct in AccountsList.Last())
                    {
                        Logger.Current.Debug("account.sorted", () => String.Format("Account (flat): {0}", acct.FullName));
                    }
                }
            }
            else
            {
                SortAccounts(account, AccountsList.Last());
            }

            SortedAccountsI.Add(AccountsList.Last().Begin());
        }
コード例 #10
0
        public AccountsList BuildAccountsList(String bankId)
        {
            AccountsList accountsList = new AccountsList(bankId);
            AccountOwner owner1       = new AccountOwner(Guid.NewGuid().ToString(), "Washington", "George");
            AccountOwner owner2       = new AccountOwner(Guid.NewGuid().ToString(), "Jefferson", "Thomas");
            AccountOwner owner3       = new AccountOwner(Guid.NewGuid().ToString(), "Lincoln", "Abraham");
            AccountOwner owner4       = new AccountOwner(Guid.NewGuid().ToString(), "Hamilton", "Alexander");
            AccountOwner owner5       = new AccountOwner(Guid.NewGuid().ToString(), "Jackson", "Andrew");
            AccountOwner owner6       = new AccountOwner(Guid.NewGuid().ToString(), "Grant", "Ulysses");
            AccountOwner owner7       = new AccountOwner(Guid.NewGuid().ToString(), "Franklin", "Benjamin");
            AccountOwner owner8       = new AccountOwner(Guid.NewGuid().ToString(), "McKinley", "William");
            AccountOwner owner9       = new AccountOwner(Guid.NewGuid().ToString(), "Cleveland", "Grover");
            AccountOwner owner10      = new AccountOwner(Guid.NewGuid().ToString(), "Chase", "Salmon");
            AccountOwner owner11      = new AccountOwner(Guid.NewGuid().ToString(), "Wilson", "Woodrow");

            //String accountNumber, String ownerId, String lastName, String firstName, decimal balance
            //String accountNumber, AccountOwner owner, decimal balance
            IAccount account1  = new acct.Checking("0000000001cx", owner1, 1.00m);
            IAccount account2  = new acct.Checking("0000000002cx", owner2, 2.00m);
            IAccount account3  = new acct.Checking("0000000003cx", owner3, 5.00m);
            IAccount account4  = new acct.Checking("0000000004cx", owner4, 10.00m);
            IAccount account5  = new acct.Checking("0000000005cx", owner5, 20.00m);
            IAccount account6  = new acct.Checking("0000000006cx", owner6, 50.00m);
            IAccount account7  = new acct.Checking("0000000007cx", owner7, 100.00m);
            IAccount account8  = new acct.Checking("0000000008cx", owner8, 500.00m);
            IAccount account9  = new acct.Checking("0000000009cx", owner9, 1000.00m);
            IAccount account10 = new acct.Checking("0000000010cx", owner10, 10000.00m);
            IAccount account11 = new acct.Checking("0000000011cx", owner11, 100000.00m);

            IAccount account1ci  = new acct.CorporateInvestment("0000000001ci", owner1, 1.00m);
            IAccount account2ci  = new acct.CorporateInvestment("0000000002ci", owner2, 2.00m);
            IAccount account3ci  = new acct.CorporateInvestment("0000000003ci", owner3, 5.00m);
            IAccount account4ci  = new acct.CorporateInvestment("0000000004ci", owner4, 10.00m);
            IAccount account5ci  = new acct.CorporateInvestment("0000000005ci", owner5, 20.00m);
            IAccount account6ci  = new acct.CorporateInvestment("0000000006ci", owner6, 50.00m);
            IAccount account7ci  = new acct.CorporateInvestment("0000000007ci", owner7, 100.00m);
            IAccount account8ci  = new acct.CorporateInvestment("0000000008ci", owner8, 500.00m);
            IAccount account9ci  = new acct.CorporateInvestment("0000000009ci", owner9, 1000.00m);
            IAccount account10ci = new acct.CorporateInvestment("0000000010ci", owner10, 10000.00m);
            IAccount account11ci = new acct.CorporateInvestment("0000000011ci", owner11, 100000.00m);

            IAccount account1ii  = new acct.IndividualInvestment("0000000001ii", owner1, 1.00m);
            IAccount account2ii  = new acct.IndividualInvestment("0000000002ii", owner2, 2.00m);
            IAccount account3ii  = new acct.IndividualInvestment("0000000003ii", owner3, 5.00m);
            IAccount account4ii  = new acct.IndividualInvestment("0000000004ii", owner4, 10.00m);
            IAccount account5ii  = new acct.IndividualInvestment("0000000005ii", owner5, 20.00m);
            IAccount account6ii  = new acct.IndividualInvestment("0000000006ii", owner6, 50.00m);
            IAccount account7ii  = new acct.IndividualInvestment("0000000007ii", owner7, 100.00m);
            IAccount account8ii  = new acct.IndividualInvestment("0000000008ii", owner8, 500.00m);
            IAccount account9ii  = new acct.IndividualInvestment("0000000009ii", owner9, 1000.00m);
            IAccount account10ii = new acct.IndividualInvestment("0000000010ii", owner10, 10000.00m);
            IAccount account11ii = new acct.IndividualInvestment("0000000011ii", owner11, 100000.00m);

            accountsList.Add(account1);
            accountsList.Add(account2);
            accountsList.Add(account3);
            accountsList.Add(account4);
            accountsList.Add(account5);
            accountsList.Add(account6);
            accountsList.Add(account7);
            accountsList.Add(account8);
            accountsList.Add(account9);
            accountsList.Add(account10);
            accountsList.Add(account11);
            accountsList.Add(account1ci);
            accountsList.Add(account2ci);
            accountsList.Add(account3ci);
            accountsList.Add(account4ci);
            accountsList.Add(account5ci);
            accountsList.Add(account6ci);
            accountsList.Add(account7ci);
            accountsList.Add(account8ci);
            accountsList.Add(account9ci);
            accountsList.Add(account10ci);
            accountsList.Add(account11ci);
            accountsList.Add(account1ii);
            accountsList.Add(account2ii);
            accountsList.Add(account3ii);
            accountsList.Add(account4ii);
            accountsList.Add(account5ii);
            accountsList.Add(account6ii);
            accountsList.Add(account7ii);
            accountsList.Add(account8ii);
            accountsList.Add(account9ii);
            accountsList.Add(account10ii);
            accountsList.Add(account11ii);

            return(accountsList);
        }
コード例 #11
0
 private void AddAccount(Account account)
 {
     AccountsList.Add(account);
     MessageBox.Success("Account has been created.");
 }