示例#1
0
        public void UnindentItem(ISublistEntry entry)
        {
            var currentParent = _entryProvider.GetParent(entry, AllEntries);

            if (currentParent != null)
            {
                var parentOfParent = _entryProvider.GetParent(currentParent, AllEntries);
                if (parentOfParent != null)
                {
                    entry.ParentId = parentOfParent.Id;
                    parentOfParent.AddSubEntrySafely(entry);
                    currentParent.SubEntries.Remove(entry);
                    _entryProvider.ChangeEntry(entry);
                }
                else
                {
                    entry.ParentId = 0;
                    _entryProvider.ChangeEntry(entry);
                    currentParent.SubEntries.Remove(entry);
                    AllEntries.Add(entry);
                }

                RefreshAllEntries();
            }
        }
示例#2
0
        public void AddEntry(Entry entity, int todayIndex)
        {
            Db.Entries.InsertOnSubmit(entity);
            Db.SubmitChanges();

            AllEntries.Add(entity);
            AllDates[todayIndex].Entries.Add(entity);
        }
示例#3
0
        public void CreateEntry(ISublistEntry parent)
        {
            var newEntry = new SublistEntry();

            if (parent != null)
            {
                parent.AddSubEntrySafely(newEntry);
            }
            else
            {
                AllEntries.Add(newEntry);
            }

            _entryProvider.StoreNewEntry(newEntry);

            RefreshAllEntries();
        }