示例#1
0
        public InfoViewModel(IAccountsMainService accountsMainService, IRegionManager regionManager, IExcelReportService excelReportService, IEventAggregator eventAggregator, AccountsController accountsController)
        {
            #region infrastructure
            AccountsTabItemHeader = "Общая информация";
            _regionManager = regionManager;
            AccountList = new List<AccountsMainSet>();
            NavigateCommand = new DelegateCommand<object>(Navigate);
            CurrentYear = DateTime.Now.Year;
            _accountsController = accountsController;
            #endregion infrastructure

            #region services
            _accountsMainService = accountsMainService;
            _excelReportService = excelReportService;
            #endregion services

            #region events
            _eventAggregator = eventAggregator;
            eventAggregator.GetEvent<SaveFileEvent>().Subscribe(GetFilename);
            #endregion events

            #region errors
            StoreErrorList = new ObservableCollection<AccountsMainSet>();
            CapexErrorList = new ObservableCollection<AccountsMainSet>();

            #endregion errors

            #region statuses
            StartYearStatus = 2010;
            EndYearStatus = CurrentYear;
            IsATH = false;
            StatusChoicesList = new List<StatusChoice> { new StatusChoice { Status = Statuses.InAcc},
                                                         new StatusChoice { Status = Statuses.InCancel },
                                                         new StatusChoice { Status = Statuses.InPayed },
                                                         new StatusChoice { Status = Statuses.InPO },
                                                         new StatusChoice { Status = Statuses.InReturn },
                                                         new StatusChoice { Status = Statuses.InWork } };
            AccountSelectedList = new ObservableCollection<AccountsExt>();
            ExportToExcelCommand = new DelegateCommand(ExportToExcel);
            #endregion statuses

            #region workers
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadAccountList;
            _worker.RunWorkerCompleted += LoadAccountList_Completed;
            #endregion workers
        }        
        public ChangeStatusViewModel(IAccountsMainService accountsMainService, IAccountStatusService accountStatusService, IEventAggregator eventAggregator, AccountsController accountsController, IExcelReportService excelReportService)
        {
            #region infrastructure
            AccountsTabItemHeader = "Изменение статусов";
            ExportConfirmationRequest = new InteractionRequest<IConfirmation>();
            _accountsController = accountsController;
            #endregion infrastructure

            #region workers
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadAllAccounts;
            _worker.DoWork += LoadAllAccounts_Completed;
            #endregion workers

            #region services
            _accountsMainService = accountsMainService;
            _accountStatusService = accountStatusService;
            _excelReportService = excelReportService;
            #endregion services

            #region events
            _eventAggregator = eventAggregator;
            eventAggregator.GetEvent<SaveFileEvent>().Subscribe(GetFilename);
            #endregion events

            #region statuses
            SearchAccountNumberCommand = new DelegateCommand(SearchAccount);
            SelectAccountCommand = new DelegateCommand(SelectAccount);
            DeleteSelectedAccCommand = new DelegateCommand(DeleteSelected);
            ChangeStatusCommand = new DelegateCommand(ChangeStatus, CanChange).ObservesProperty(() => SelectedStatus).ObservesProperty(() => AccountForChangeDate).ObservesProperty(() => AccountPayNumber);            
            AccountForChangeList = new ObservableCollection<AccountsMainSet>();
            
            #endregion statuses
        }