Beispiel #1
0
        public FinanceViewModel()
        {
            ControlViewModels.Add(new AccountViewModel());
            ControlViewModels.Add(new CreditViewModel());

            SelectedControlViewModel = ControlViewModels[0];
        }
        public AccountViewModel()
        {
            switch (MainViewModel.WindowFactory)
            {
            case ClientMainWindow:
                // Using data.
                AccountModels      = ModelResourcesManager.GetInstance().UserAccounts;
                CurrencyTypeModels = ModelResourcesManager.GetInstance().ExistedCurrencyTypes;
                CardTypeModels     = ModelResourcesManager.GetInstance().ExistedCardTypes;

                AccountToOpen = new AccountModel {
                    CurrencyTypeModelNavigation = CurrencyTypeModels[0]
                };
                CardToCreate = new CardModel {
                    CardTypeModelNavigation = CardTypeModels[0]
                };

                // Using VM
                ControlViewModels.Add(new AccountsListViewModel());
                ControlViewModels.Add(new CreateNewAccountViewModel());
                break;

            case AdminMainWindow:
            case WorkerMainWindow:

                // Using VM
                ControlViewModels.Add(new AccountsListViewModel());
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            SelectedControlViewModel = ControlViewModels.FirstOrDefault();
        }
Beispiel #3
0
        public OperationsPageViewModel()
        {
            ControlViewModels.Add(new TransferToAccountViewModel());
            ControlViewModels.Add(new CreditRepaymentViewModel());

            SelectedControlViewModel = ControlViewModels[0];
        }
Beispiel #4
0
        public ClientsViewModel()
        {
            ExistedClients = ModelResourcesManager.GetInstance().ExistedClients;

            ControlViewModels.Add(new ExistedClientsViewModel(this));
            ControlViewModels.Add(new SendClientNotificationViewModel(this));

            SelectedControlViewModel = ControlViewModels[0];
        }
Beispiel #5
0
        public MainViewModel(ApplicationViewModel applicationViewModel)
        {
            ApplicationViewModel           = applicationViewModel;
            applicationViewModel.MinHeight = 500;
            applicationViewModel.MinWidth  = 700;

            WindowFactory = MainWindowFactory.GetFactory();
            ControlViewModels.AddRange(WindowFactory.GetPages());
            SelectedControlViewModel = ControlViewModels[0];

            ModelResourcesManager.GetInstance().CurrencyConverter.Attach(this);
        }
Beispiel #6
0
        public RegistrationViewModel(AuthorizationViewModel authorizationViewModel)
        {
            AuthorizationViewModel = authorizationViewModel;

            ControlViewModels.Add(new RegistrationPage01());
            ControlViewModels.Add(new RegistrationPage02());

            SelectedControlViewModel = ControlViewModels[_iterator];

            RegisteredUser = new UserModel {
                UserType = "client"
            };
        }
        public CreditsAdminPageViewModel()
        {
            ExistedCreditTypes = ModelResourcesManager.GetInstance().ExistedCreditTypes;

            ControlViewModels.Add(new CreditTypesListViewModel());
            ControlViewModels.Add(new CreateNewCreditTypeViewModel());
            ControlViewModels.Add(new UpdateExistedCreditTypeViewModel());

            SelectedControlViewModel = ControlViewModels.FirstOrDefault();

            CurrencyTypeModels = ModelResourcesManager.GetInstance().ExistedCurrencyTypes;

            InitializeNewData();
        }
        public JournalViewModel()
        {
            switch (MainViewModel.WindowFactory)
            {
            case ClientMainWindow:
                Journal = ModelResourcesManager.GetInstance().UserJournal;

                ControlViewModels.Add(new AllJournalNotesTabViewModel(this));
                ControlViewModels.Add(new TransfersTabViewModel(this));
                ControlViewModels.Add(new CreditRepaymentTabViewModel(this));
                ControlViewModels.Add(new NotificationTabViewModel(this));
                break;

            case AdminMainWindow:
            case WorkerMainWindow:
                Journal = ModelResourcesManager.GetInstance().AllJournal;

                ControlViewModels.Add(new AllJournalNotesTabViewModel(this));
                ControlViewModels.Add(new TransfersTabViewModel(this));
                ControlViewModels.Add(new CreditRepaymentTabViewModel(this));
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Transfers        = new ObservableCollection <TransferToAccountModel>();
            CreditRepayments = new ObservableCollection <CreditRepaymentModel>();
            Notifications    = new ObservableCollection <NotificationModel>();

            foreach (var journalNote in Journal)
            {
                DetermineJournalModel(journalNote);
            }

            Journal.CollectionChanged += (_, e) =>
            {
                if (e.NewItems == null || e.Action != NotifyCollectionChangedAction.Add)
                {
                    return;
                }

                DetermineJournalModel((JournalModel)e.NewItems[0]);
            };

            SelectedControlViewModel = ControlViewModels[0];
        }
        public ClientInfoViewModel(ClientsViewModel clientsViewModel)
        {
            ClientsViewModel = clientsViewModel;

            ControlViewModels.Add(new AccountViewModel
            {
                AccountModels = new ObservableCollection <AccountModel>(ClientsViewModel.SelectedClient.Accounts)
            });
            ControlViewModels.Add(new CreditViewModel
            {
                UserApprovedCreditModels = new ObservableCollection <IssuedCreditModel>(
                    ClientsViewModel.SelectedClient.IssuedCredits
                    .Where(c => c.IsApproved).Where(c => !c.IsRepaid))
            });

            SelectedControlViewModel = ControlViewModels[0];
        }
Beispiel #10
0
        public CardsViewModel()
        {
            CardToCreate = new CardModel();

            LoggedInUser   = ModelResourcesManager.GetInstance().LoggedInUser;
            UserCards      = ModelResourcesManager.GetInstance().UserCards;
            UserAccounts   = ModelResourcesManager.GetInstance().UserAccounts;
            CardTypeModels = ModelResourcesManager.GetInstance().ExistedCardTypes;

            if (UserCards.Count > 0)
            {
                SelectedCard = UserCards[0];
            }

            ControlViewModels.Add(new CardsListViewModel());
            ControlViewModels.Add(new CreateNewCardViewModel());

            SelectedControlViewModel = ControlViewModels[0];
        }
Beispiel #11
0
        public CreditViewModel()
        {
            switch (MainViewModel.WindowFactory)
            {
            case ClientMainWindow:
                // Using data.
                UserApprovedCreditModels = ModelResourcesManager.GetInstance().UserCredits;
                UserAccounts             = ModelResourcesManager.GetInstance().UserAccounts;
                CreditTypeModels         = ModelResourcesManager.GetInstance().ExistedCreditTypes;

                ResetCreditToTaking();

                // Using VM
                ControlViewModels.Add(new CreditListViewModel());
                ControlViewModels.Add(new TakeNewCreditViewModel());
                break;

            case WorkerMainWindow:

                // Using VM
                ControlViewModels.Add(new CreditListViewModel());
                break;

            case AdminMainWindow:
                // Using VM
                ControlViewModels.Add(new CreditListViewModel());

                CreditTypeModels = ModelResourcesManager.GetInstance().ExistedCreditTypes;

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            SelectedControlViewModel = ControlViewModels.FirstOrDefault();
        }