コード例 #1
0
        public bool Handle(DeleteActivity request)
        {
            var cannotDelete = _dispatcher
                               .Fetch(new OccurrencesQuery(DateTime.Today, TimeSpan.FromDays(365)))
                               .Any(n => n.ActivityKey == request.Key);

            if (cannotDelete)
            {
                return(false);
            }

            var activity = _activityDataStorage.Find(request.Key);

            return(_activityDataStorage.Delete(activity));
        }
コード例 #2
0
        public FinancialJournalEntry Handle(CreateFinancialJournalEntry request)
        {
            var taxon = _dispatcher.Fetch(new TaxonTreeQuery {
                TaxonKey = request.TaxonKey
            });

            if (!taxon.IsSelectable)
            {
                throw new InvalidOperationException("Taxon is no selectable");
            }

            var entry = _dataStorage.Create(new FinancialJournalEntry(0, request.TaxonKey)
            {
                Remarks    = request.Remarks,
                Actual     = request.Actual,
                Forecasted = request.Forecasted,
                When       = GetWhenFromRequest(request)
            });

            _queueDispatcher.Enqueue(new FinancialJournalEntrySaved(entry));

            return(entry);
        }
コード例 #3
0
 public TResult Fetch <TResult>(IQuery <TResult> query)
 {
     return(Execute("Fetch", query.GetType(), () => _dispatcher.Fetch(query)));
 }
コード例 #4
0
 public AnnualFinancialReport GetReport(int shiftMonth = 0) => _dispatcher
 .Fetch(new AnnualFinancialReportQuery {
     ShiftMonth = shiftMonth
 });
コード例 #5
0
 public DailyCalendar GetDailyCalendar(int fromDay, int toDay) => _dispatcher
 .Fetch(new DailyCalendarQuery(fromDay, toDay));