Ejemplo n.º 1
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();
        }
        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();
        }
Ejemplo n.º 3
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();
        }