fix removing of entries
This commit is contained in:
parent
2e8daca61c
commit
7e85159fd5
@ -271,15 +271,27 @@ public partial class MainWindow : MetroWindow {
|
|||||||
object obj = entries.SelectedItem;
|
object obj = entries.SelectedItem;
|
||||||
bool removed = false;
|
bool removed = false;
|
||||||
|
|
||||||
if (obj.GetType() == typeof(Objective)) {
|
if (obj.GetType() == typeof(SystemObjectives)) {
|
||||||
removed = report.Objectives.Remove(obj as Objective);
|
removed = report.SystemObjectives.Remove(obj as SystemObjectives);
|
||||||
} else if (obj.GetType() == typeof(UITransaction) ||
|
} else if (obj.GetType() == typeof(Objective)) {
|
||||||
obj.GetType().IsSubclassOf(typeof(UITransaction))) {
|
report
|
||||||
foreach (Objective parent in report.Objectives) {
|
.SystemObjectives
|
||||||
if (parent.UITransactions.Remove(obj as UITransaction)) {
|
.ForEach(x => {
|
||||||
|
if (x.Objectives.Remove(obj as Objective)) {
|
||||||
removed = true;
|
removed = true;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
} else if (obj.GetType() == typeof(UITransaction) ||
|
||||||
|
obj.GetType().IsSubclassOf(typeof(UITransaction))) {
|
||||||
|
report
|
||||||
|
.SystemObjectives
|
||||||
|
.SelectMany(x =>
|
||||||
|
x.Objectives
|
||||||
|
.Where(x => x.UITransactions.Contains(obj as UITransaction))
|
||||||
|
)
|
||||||
|
.ToList()
|
||||||
|
.ForEach(x => removed = x.UITransactions.Remove(obj as UITransaction))
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (removed) {
|
if (removed) {
|
||||||
|
Loading…
Reference in New Issue
Block a user