예제 #1
0
        public void Handle(NoteTextChanged evnt)
        {
            using (var context = new ReadModelContainer())
            {
                var itemToUpdate = context.NoteItemSet.Single(item => item.Id == evnt.NoteId);
                itemToUpdate.Text = evnt.NewText;

                context.SaveChanges();
            }
        }
예제 #2
0
 public void Handle(NoteTextChanged evnt)
 {
     if (evnt.SummaryId.Equals(Guid.Empty))
     {
         AggregateRoot aggregateRoot = new NoteDailySummary(Guid.NewGuid(), System.DateTime.UtcNow, 0, 1);
         UnitOfWork.Current.RegisterDirtyInstance(aggregateRoot);
     }
     else
     {
         var noteDailySummary = UnitOfWork.Current.GetById(typeof(NoteDailySummary), evnt.SummaryId) as NoteDailySummary;
         noteDailySummary.UpdateDailySummary(0, 1);
         UnitOfWork.Current.RegisterDirtyInstance(noteDailySummary);
     }
 }
예제 #3
0
        public void Handle(NoteTextChanged evnt)
        {
            using (var context = new ReadModelContainer())
            {
                var date          = evnt.EventTimeStamp.Date;
                var totalsForDate = context.TotalsPerDayItemSet.SingleOrDefault(i => i.Date == date);

                if (totalsForDate == null)
                {
                    totalsForDate = new TotalsPerDayItem {
                        Date = date
                    };
                    context.TotalsPerDayItemSet.AddObject(totalsForDate);
                }

                totalsForDate.EditCount++;

                context.SaveChanges();
            }
        }
예제 #4
0
파일: Note.cs 프로젝트: mojamcpds/ncqrs
 // Event handler for the NoteTextChanged event. This method
 // is automaticly wired as event handler based on convension.
 protected void OnNoteTextChanged(NoteTextChanged e)
 {
     _text = e.NewText;
 }
예제 #5
0
 protected virtual void OnNoteTextChanged(NoteEventArgs e)
 {
     NoteTextChanged?.Invoke(this, e);
 }
예제 #6
0
 protected void OnNoteTextChanged(NoteTextChanged e)
 {
     this.text = e.Text;
 }