protected override void OnBeforeSave() { base.OnBeforeSave(); if (base.IsNew) { if (Guid.Empty.Equals(this.ParentGroupClassId)) { throw new NotSupportedException("A new Task group entry needs to have its ParentGroupClassId set."); } byte[] nodeBefore = null; if (this.parentGroup != null) { ReadOnlyCollection <TaskGroupEntryInfo> childTaskFolders = this.parentGroup.GetChildTaskFolders(); if (childTaskFolders.Count > 0) { nodeBefore = childTaskFolders[childTaskFolders.Count - 1].Ordinal; } } else { bool flag; nodeBefore = FolderTreeData.GetOrdinalValueOfFirstMatchingNode(base.MailboxSession, TaskGroupEntry.FindLastTaskFolderOrdinalSortOrder, (IStorePropertyBag row) => TaskGroup.IsFolderTreeData(row) && TaskGroup.IsTaskSection(row) && TaskGroup.IsTaskFolderInGroup(row, this.ParentGroupClassId), TaskGroup.TaskInfoProperties, out flag); } base.SetNodeOrdinalInternal(nodeBefore, null); } }
protected override void OnBeforeSave() { base.OnBeforeSave(); if (base.IsNew) { bool flag; byte[] nodeBefore = FolderTreeData.GetOrdinalValueOfFirstMatchingNode(base.MailboxSession, TaskGroup.FindLastGroupOrdinalSortOrder, (IStorePropertyBag row) => TaskGroup.IsFolderTreeData(row) && TaskGroup.IsTaskSection(row) && TaskGroup.IsTaskGroup(row), TaskGroup.TaskInfoProperties, out flag); if (flag && !FolderTreeData.MyFoldersClassId.Equals(this.GroupClassId)) { using (TaskGroup taskGroup = TaskGroup.CreateMyTasksGroup(base.MailboxSession)) { nodeBefore = taskGroup.NodeOrdinal; } } base.SetNodeOrdinalInternal(nodeBefore, null); } }