Esempio n. 1
0
        private void OnLogEntryEdited(CreateEditLogEntryPage page, DreamLogEntryViewModel model)
        {
            DreamLogEntry original = datalayer.GetLogEntry(model.EntryId);

            original.Update(model);
            if (this.datalayer.SaveChanges() > 0)
            {
                this.LoadItems();
            }
            this.IsBusy = false;
        }
Esempio n. 2
0
        private DreamLogEntryViewModel GetDreamLogEntryViewModel(IDatalayer datalayer, DreamLogEntry entry)
        {
            DreamLogEntryViewModel model = new DreamLogEntryViewModel();

            model.Update(entry);
            if (model.FK_CategoryId.HasValue)
            {
                model.Category = datalayer.GetDreamCategory(entry.FK_CategoryId.Value);
            }
            model.Log = datalayer.DreamLogCollections.First();
            return(model);
        }
Esempio n. 3
0
        private void OnLogEntryCreated(CreateEditLogEntryPage page, DreamLogEntryViewModel model)
        {
            DreamLogEntry entry = model.Copy <DreamLogEntry>();

            if (entry.FK_CategoryId == -1)
            {
                entry.FK_CategoryId = null;
                entry.Category      = null;
            }
            entry.Log       = this.datalayer.DreamLogCollections.First();
            entry.FK_LogId  = entry.Log.LogId;
            entry.CreatedAt = DateTime.Now;

            if (this.datalayer.AddLogEntry(entry))
            {
                this.LoadEntriesCommand.Execute(null);
            }

            this.IsBusy = false;
        }