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)); }
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); }
public TResult Fetch <TResult>(IQuery <TResult> query) { return(Execute("Fetch", query.GetType(), () => _dispatcher.Fetch(query))); }
public AnnualFinancialReport GetReport(int shiftMonth = 0) => _dispatcher .Fetch(new AnnualFinancialReportQuery { ShiftMonth = shiftMonth });
public DailyCalendar GetDailyCalendar(int fromDay, int toDay) => _dispatcher .Fetch(new DailyCalendarQuery(fromDay, toDay));