예제 #1
0
        public FAReportViewModel(IFAService faService, IAccountFAService accountFAService, IStoresService storeService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Отчет по основным средствам";
            #endregion infrastructure

            #region report
            FAList                = new ObservableCollection <FASet>();
            AccountFAList         = new ObservableCollection <AccountFA>();
            FullFAList            = new List <AccountsBudgetDetailsSet>();
            LoadSelectedFACommand = new DelegateCommand(LoadSelectedFA);
            SelectedAccountFAList = new ObservableCollection <AccountsMainSet>();
            int i = 2016;
            YearList = new List <YearCheck>();
            while (i < DateTime.Now.Year + 5)
            {
                YearList.Add(new YearCheck {
                    IsSelected = i == DateTime.Now.Year ? true : false, Year = i
                });
                i++;
            }
            #endregion report

            #region services
            _faService        = faService;
            _accountFAService = accountFAService;
            _storeService     = storeService;
            #endregion services

            #region workers
            _worker                     = new BackgroundWorker();
            _worker.DoWork             += LoadReportData;
            _worker.RunWorkerCompleted += LoadReportData_Completed;
            #endregion workers
        }
예제 #2
0
        public FAReportViewModel(IFAService faService, IAccountFAService accountFAService, IStoresService storeService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Отчет по основным средствам";            
            #endregion infrastructure

            #region report
            FAList = new ObservableCollection<FASet>();
            AccountFAList = new ObservableCollection<AccountFA>();
            FullFAList = new List<AccountsBudgetDetailsSet>();
            LoadSelectedFACommand = new DelegateCommand(LoadSelectedFA);
            SelectedAccountFAList = new ObservableCollection<AccountsMainSet>();
            int i = 2016;
            YearList = new List<YearCheck>();
            while(i < DateTime.Now.Year + 5)
            {
                YearList.Add(new YearCheck { IsSelected = i == DateTime.Now.Year ? true : false, Year = i });
                i++;
            }
            #endregion report

            #region services
            _faService = faService;
            _accountFAService = accountFAService;
            _storeService = storeService;
            #endregion services

            #region workers
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadReportData;
            _worker.RunWorkerCompleted += LoadReportData_Completed;
            #endregion workers
        }        
        public AddFullAccountViewModel(ICompaniesService companiesService, 
                                       ITypesService typesService, 
                                       IAccountsMainService accountsService, 
                                       IAccountStatusService accountStatusService, 
                                       IAccountStoresService accountStoresService, 
                                       IStoresService storesService, 
                                       IAccountCapexesService accountCapexService, 
                                       IExpensesService expenseService, 
                                       ICapexesService capexService, 
                                       IStoresWorkService storesWorkService,
                                       IAccountFAService accountFAService,
                                       IFAService faService)
        {


            #region account
            SaveAccountCommand = new DelegateCommand(SaveAccount, CanSave).ObservesProperty(() => Account);
            #endregion account

            #region workers

            _worker = new BackgroundWorker();
            _worker.DoWork += LoadAccount;

            _addStoresWorker = new BackgroundWorker();
            _addStoresWorker.DoWork += LoadAddStoresToAccount;
            _addStoresWorker.RunWorkerCompleted += LoadAddStoresToAccount_Completed;
            #endregion workers 

            #region  capexes
            OpenAddCapexToAccountCommand = new DelegateCommand(OpenAddCapexToAccount);
            CloseAddCapexToAccountCommand = new DelegateCommand(CloseAddCapexToAccount);
            CopyAvailableSumCommand = new DelegateCommand(CopyAvailableSum);
            AddCapexToAccountCommand = new DelegateCommand(AddCapexToAccount, CanAddCapex).ObservesProperty(() => NewCapexForAccount);
            DeleteCapexAccountCommand = new DelegateCommand(DeleteCapex);
            #endregion capexes

            #region services
            _companiesService = companiesService;
            _typesService = typesService;
            _accountsService = accountsService;
            _accountStatusService = accountStatusService;
            _accountStoresService = accountStoresService;
            _storesService = storesService;
            _accountCapexService = accountCapexService;
            _expenseService = expenseService;
            _capexService = capexService;
            _storesWorkService = storesWorkService;
            _accountFAService = accountFAService;
            _faService = faService;
            #endregion services

            #region statuses
            IsChangeStatusOpen = false;
            StatusesList = Statuses.GetStatusesList();

            CancelNewStatusCommand = new DelegateCommand(CancelNew);
            ChangeStatusCommand = new DelegateCommand(ChangeStatus);
            SaveNewStatusCommand = new DelegateCommand(SaveNew, CanSaveNew);
            #endregion statuses

            #region stores
            EditAccountStoresListCommand = new DelegateCommand(EditAccountStoresList, CanEdit);
            DeleteAccountStoreCommand = new DelegateCommand(DeleteAccountStore);
            AddStoresToAccountCommand = new DelegateCommand(() => _addStoresWorker.RunWorkerAsync(), CheckStoreErrors).ObservesProperty(() => StoresForLoad);
            CloseAddStoresToAccountCommand = new DelegateCommand(CloseAddStores);
            IsEditAccountStoresOpen = false;
            #endregion stores

            #region FA
            AddFAOpen = false;
            AddFACommand = new DelegateCommand(AddFA);
            AddFAToAccountCommand = new DelegateCommand(AddFAToAccount, CanAddFA).ObservesProperty(() => NewFA);
            CloseFACommand = new DelegateCommand(CloseFA);
            #endregion FA

        }        
예제 #4
0
        public AddFullAccountViewModel(ICompaniesService companiesService,
                                       ITypesService typesService,
                                       IAccountsMainService accountsService,
                                       IAccountStatusService accountStatusService,
                                       IAccountStoresService accountStoresService,
                                       IStoresService storesService,
                                       IAccountCapexesService accountCapexService,
                                       IExpensesService expenseService,
                                       ICapexesService capexService,
                                       IStoresWorkService storesWorkService,
                                       IAccountFAService accountFAService,
                                       IFAService faService)
        {
            #region account
            SaveAccountCommand = new DelegateCommand(SaveAccount, CanSave).ObservesProperty(() => Account);
            #endregion account

            #region workers

            _worker         = new BackgroundWorker();
            _worker.DoWork += LoadAccount;

            _addStoresWorker                     = new BackgroundWorker();
            _addStoresWorker.DoWork             += LoadAddStoresToAccount;
            _addStoresWorker.RunWorkerCompleted += LoadAddStoresToAccount_Completed;
            #endregion workers

            #region  capexes
            OpenAddCapexToAccountCommand  = new DelegateCommand(OpenAddCapexToAccount);
            CloseAddCapexToAccountCommand = new DelegateCommand(CloseAddCapexToAccount);
            CopyAvailableSumCommand       = new DelegateCommand(CopyAvailableSum);
            AddCapexToAccountCommand      = new DelegateCommand(AddCapexToAccount, CanAddCapex).ObservesProperty(() => NewCapexForAccount);
            DeleteCapexAccountCommand     = new DelegateCommand(DeleteCapex);
            #endregion capexes

            #region services
            _companiesService     = companiesService;
            _typesService         = typesService;
            _accountsService      = accountsService;
            _accountStatusService = accountStatusService;
            _accountStoresService = accountStoresService;
            _storesService        = storesService;
            _accountCapexService  = accountCapexService;
            _expenseService       = expenseService;
            _capexService         = capexService;
            _storesWorkService    = storesWorkService;
            _accountFAService     = accountFAService;
            _faService            = faService;
            #endregion services

            #region statuses
            IsChangeStatusOpen = false;
            StatusesList       = Statuses.GetStatusesList();

            CancelNewStatusCommand = new DelegateCommand(CancelNew);
            ChangeStatusCommand    = new DelegateCommand(ChangeStatus);
            SaveNewStatusCommand   = new DelegateCommand(SaveNew, CanSaveNew);
            #endregion statuses

            #region stores
            EditAccountStoresListCommand   = new DelegateCommand(EditAccountStoresList, CanEdit);
            DeleteAccountStoreCommand      = new DelegateCommand(DeleteAccountStore);
            AddStoresToAccountCommand      = new DelegateCommand(() => _addStoresWorker.RunWorkerAsync(), CheckStoreErrors).ObservesProperty(() => StoresForLoad);
            CloseAddStoresToAccountCommand = new DelegateCommand(CloseAddStores);
            IsEditAccountStoresOpen        = false;
            #endregion stores

            #region FA
            AddFAOpen             = false;
            AddFACommand          = new DelegateCommand(AddFA);
            AddFAToAccountCommand = new DelegateCommand(AddFAToAccount, CanAddFA).ObservesProperty(() => NewFA);
            CloseFACommand        = new DelegateCommand(CloseFA);
            #endregion FA
        }