private void SelDelOfSingleRow(DDocRow row) { if (row.SelectedMembers.Count == row.MemberCount()) { if (row.Equals(FirstRow)) { row.FirstMember = null; row.LastMember = null; CurrentRow = row; CurrentRow.CurrentMember = null; } else { RemoveRow(row); CurrentRow = row.PreDocRow ?? FirstRow; CurrentRow.CurrentMember = CurrentRow.LastMember ?? CurrentRow.FirstMember; } } else { CurrentRow = row; if (row.SelectedMembers.Count == 0) return; var beginMember = row.SelectedMembers[0]; var endMember = row.SelectedMembers[row.SelectedMembers.Count - 1]; if (beginMember.PreMember != null) { beginMember.PreMember.NextMember = endMember.NextMember; if (endMember.NextMember != null) { endMember.NextMember.PreMember = beginMember.PreMember; } else { CurrentRow.LastMember = beginMember.PreMember.Equals(CurrentRow.FirstMember) ? null : beginMember.PreMember; } CurrentRow.CurrentMember = beginMember.PreMember; } else if (endMember.NextMember != null) { CurrentRow.FirstMember = endMember.NextMember; var tailMember = endMember.GetTailMember(); CurrentRow.LastMember = tailMember.Equals(endMember.NextMember) ? null : tailMember; CurrentRow.CurrentMember = null; endMember.NextMember.PreMember = null; } } }
private void RemoveRow(DDocRow row) { if (row == null) return; var ownerDoc = row.OwnerDocument; if (row.Equals(ownerDoc.FirstRow)) { if (row.NextDocRow == null) { ownerDoc.FirstRow = null; return; } else if (row.NextDocRow.Equals(ownerDoc.LastRow)) { ownerDoc.FirstRow = row.NextDocRow; ownerDoc.LastRow = null; row.NextDocRow.PreDocRow = null; row.NextDocRow = null; return; } ownerDoc.FirstRow = row.NextDocRow; row.NextDocRow.PreDocRow = null; row.NextDocRow = null; } else if (row.Equals(ownerDoc.LastRow)) { if (row.PreDocRow.Equals(ownerDoc.FirstRow)) { row.PreDocRow.NextDocRow = null; row.PreDocRow = null; ownerDoc.LastRow = null; return; } ownerDoc.LastRow = row.PreDocRow; row.PreDocRow.NextDocRow = null; row.PreDocRow = null; } else { if (row.PreDocRow != null) row.PreDocRow.NextDocRow = row.NextDocRow; if (row.NextDocRow != null) row.NextDocRow.PreDocRow = row.PreDocRow; row.PreDocRow = null; row.NextDocRow = null; } }