Exemplo n.º 1
0
        public MoneyTransferTemplateDetailsView(IMoneyTransferTemplateService service, MoneyTransferTemplateModel entity, bool isNew,
                                                bool showHiddenStorages, IEnumerable <StorageModel> storages, bool?allowSaveIfNoChanges = null)
            : base(service, entity, isNew, allowSaveIfNoChanges)
        {
            InitializeComponent();

            // init
            _showHiddenStorages = showHiddenStorages;
            _storages           = storages;

            // initialize datacontexts
            IEnumerable <StorageModel> showStorages;

            if (_showHiddenStorages)
            {
                showStorages = storages.OrderByDescending(_ => _.IsVisible).ThenBy(_ => _.Name);
            }
            else
            {
                showStorages = storages.Where(_ => _.IsVisible || entity.StorageFromId == _.Id || entity.StorageToId == _.Id)
                               .OrderBy(_ => _.Name);
            }

            comboFromStorage.ItemsSource = showStorages;
            comboToStorage.ItemsSource   = showStorages;

            // set currencies list
            compCurrencyExchangeRate.CurrencyIds = _storages.Select(_ => _.CurrencyId).Distinct().ToList();

            // set header and commands panel context
            LabelHeader.Content       = ViewHeader;
            CommandsPanel.DataContext = Commands;
        }
Exemplo n.º 2
0
        protected override void InitializationComplete()
        {
            // init
            _transactionService   = ServiceManager.ConfigureService <TransactionService>();
            _settingsService      = ServiceManager.ConfigureService <TransactionsSettingsService>();
            _storageService       = ServiceManager.ConfigureService <StorageService>();
            _recordService        = ServiceManager.ConfigureService <RecordService>();
            _moneyTransferService = ServiceManager.ConfigureService <MoneyTransferService>();

            _templatesService             = ServiceManager.ConfigureService <TransactionTemplateService>();
            _recordTemplateService        = ServiceManager.ConfigureService <RecordTemplateService>();
            _moneyTransferTemplateService = ServiceManager.ConfigureService <MoneyTransferTemplateService>();

            InitializeViewModel();
        }
 public TransactionTemplateService(ApplicationDbContext context) : base(context)
 {
     _recordTemplateService        = new RecordTemplateService(context);
     _moneyTransferTemplateService = new MoneyTransferTemplateService(context);
 }
Exemplo n.º 4
0
 public MoneyTransferTemplateDetailsView(IMoneyTransferTemplateService service, MoneyTransferTemplateModel entity, bool isNew,
                                         bool showHiddenStorages)
     : this(service, entity, isNew, showHiddenStorages,
            (ServiceManager.ConfigureService <StorageService>() as IStorageService).GetListForUser(GlobalVariables.UserId))
 {
 }