示例#1
0
        public CapexReportViewModel(ICapexesService capexService, IAccountStatusService statusService, IAccountsMainService accountsMainService, IStoresService storeService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Отчет по CAPEX";
            #endregion infrastructure

            #region capex
            YearList = new List <int>();
            for (var i = 2015; i <= DateTime.Now.Year; i++)
            {
                YearList.Add(i);
            }
            CapexList                = new ObservableCollection <CapexWithRest>();
            CapexAccountsList        = new ObservableCollection <AccountsWithStatus>();
            LoadCapexCommand         = new DelegateCommand(LoadCapex);
            LoadSelectedCapexCommand = new DelegateCommand(LoadSelectedCapex);
            StatusSumList            = new ObservableCollection <StatusSum>();
            _storesList              = new List <StoresSet>();
            #endregion capex

            #region services
            _capexService        = capexService;
            _statusService       = statusService;
            _accountsMainService = accountsMainService;
            _storesService       = storeService;
            #endregion services

            #region workers
            _worker                     = new BackgroundWorker();
            _worker.DoWork             += LoadFullCapexInfo;
            _worker.RunWorkerCompleted += LoadFullCapexInfo_Completed;
            #endregion workers
        }
        public CapexReportViewModel(ICapexesService capexService, IAccountStatusService statusService, IAccountsMainService accountsMainService, IStoresService storeService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Отчет по CAPEX";
            #endregion infrastructure

            #region capex
            YearList = new List<int>();
            for (var i = 2015; i <= DateTime.Now.Year; i++)
                YearList.Add(i);
            CapexList = new ObservableCollection<CapexWithRest>();
            CapexAccountsList = new ObservableCollection<AccountsWithStatus>();
            LoadCapexCommand = new DelegateCommand(LoadCapex);
            LoadSelectedCapexCommand = new DelegateCommand(LoadSelectedCapex);
            StatusSumList = new ObservableCollection<StatusSum>();
            _storesList = new List<StoresSet>();
            #endregion capex

            #region services
            _capexService = capexService;
            _statusService = statusService;
            _accountsMainService = accountsMainService;
            _storesService = storeService;
            #endregion services

            #region workers
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadFullCapexInfo;
            _worker.RunWorkerCompleted += LoadFullCapexInfo_Completed;
            #endregion workers
        }
        public AdditionalInfoViewModel(IAccountStatusService accountStatusService, IAccountStoresService accountStoresService, IStoresService storesService, IAccountCapexesService accountCapexService, IExpensesService expenseService, ICapexesService capexService, IStoresWorkService storesWorkService)
        {
            #region infrastrcture
            ConfirmationRequest = new InteractionRequest<IConfirmation>();
            #endregion infrastructure

            #region statuses
            IsChangeStatusOpen = false;
            IsStatusHistoryOpen = false;

            StatusesList = Statuses.GetStatusesList();
            StatusHistoryList = new ObservableCollection<AccountsStatusDetailsSet>();

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

            #region stores
            IsEditAccountStoresOpen = false;

            AccountStoresList = new ObservableCollection<StoresSet>();
            StoresList = new ObservableCollection<StoresSet>();

            EditAccountStoresListCommand = new DelegateCommand(EditAccountStoresList, CanEdit);
            AddStoresToAccountCommand = new DelegateCommand(() => _addStoresWorker.RunWorkerAsync(), CheckStoreErrors).ObservesProperty(() => StoresForLoad);
            DeleteAccountStoreCommand = new DelegateCommand(DeleteAccountStore);
            SearchStoreNumberByNameCommand = new DelegateCommand(SearchStoreNumberByName);
            #endregion stores

            #region  services
            _accountStatusService = accountStatusService;
            _accountStoresService = accountStoresService;
            _storesService = storesService;
            _accountCapexService = accountCapexService;
            _expenseService = expenseService;
            _capexService = capexService;
            _storesWorkService = storesWorkService;
            #endregion services

            #region capexes
            AccountCapexList = new ObservableCollection<AccountsCapexInfoSet>();
            ExpensesList = new ObservableCollection<AccountsExpenseSet>(expenseService.GetExpensesList());
            CapexesList = new ObservableCollection<CapexSet>();          
            IsAddCapexOpen = false;

            OpenAddCapexToAccountCommand = new DelegateCommand(OpenAddCapexToAccount);
            CopyAvailableSumCommand = new DelegateCommand(CopyAvailableSum);
            AddCapexToAccountCommand = new DelegateCommand(AddCapexToAccount);
            DeleteCapexAccountCommand = new DelegateCommand(DeleteCapexAccount);
            #endregion capexes

            #region workers
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadAccountAdditionalInfo;

            _addStoresWorker = new BackgroundWorker();
            _addStoresWorker.DoWork += LoadAddStoresToAccount;
            _addStoresWorker.RunWorkerCompleted += LoadAddStoresToAccount_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

        }        
示例#5
0
        public AdditionalInfoViewModel(IAccountStatusService accountStatusService, IAccountStoresService accountStoresService, IStoresService storesService, IAccountCapexesService accountCapexService, IExpensesService expenseService, ICapexesService capexService, IStoresWorkService storesWorkService)
        {
            #region infrastrcture
            ConfirmationRequest = new InteractionRequest <IConfirmation>();
            #endregion infrastructure

            #region statuses
            IsChangeStatusOpen  = false;
            IsStatusHistoryOpen = false;

            StatusesList      = Statuses.GetStatusesList();
            StatusHistoryList = new ObservableCollection <AccountsStatusDetailsSet>();

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

            #region stores
            IsEditAccountStoresOpen = false;

            AccountStoresList = new ObservableCollection <StoresSet>();
            StoresList        = new ObservableCollection <StoresSet>();

            EditAccountStoresListCommand   = new DelegateCommand(EditAccountStoresList, CanEdit);
            AddStoresToAccountCommand      = new DelegateCommand(() => _addStoresWorker.RunWorkerAsync(), CheckStoreErrors).ObservesProperty(() => StoresForLoad);
            DeleteAccountStoreCommand      = new DelegateCommand(DeleteAccountStore);
            SearchStoreNumberByNameCommand = new DelegateCommand(SearchStoreNumberByName);
            #endregion stores

            #region  services
            _accountStatusService = accountStatusService;
            _accountStoresService = accountStoresService;
            _storesService        = storesService;
            _accountCapexService  = accountCapexService;
            _expenseService       = expenseService;
            _capexService         = capexService;
            _storesWorkService    = storesWorkService;
            #endregion services

            #region capexes
            AccountCapexList = new ObservableCollection <AccountsCapexInfoSet>();
            ExpensesList     = new ObservableCollection <AccountsExpenseSet>(expenseService.GetExpensesList());
            CapexesList      = new ObservableCollection <CapexSet>();
            IsAddCapexOpen   = false;

            OpenAddCapexToAccountCommand = new DelegateCommand(OpenAddCapexToAccount);
            CopyAvailableSumCommand      = new DelegateCommand(CopyAvailableSum);
            AddCapexToAccountCommand     = new DelegateCommand(AddCapexToAccount);
            DeleteCapexAccountCommand    = new DelegateCommand(DeleteCapexAccount);
            #endregion capexes

            #region workers
            _worker         = new BackgroundWorker();
            _worker.DoWork += LoadAccountAdditionalInfo;

            _addStoresWorker                     = new BackgroundWorker();
            _addStoresWorker.DoWork             += LoadAddStoresToAccount;
            _addStoresWorker.RunWorkerCompleted += LoadAddStoresToAccount_Completed;
            #endregion workers
        }
示例#6
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
        }