private void add_Click(object sender, RoutedEventArgs e) { var c = tvProperties.SelectedItem as PropertyNodeItem; if (c == null) { c = new PropertyNodeItem(); if (MessageAlert.Alter("是否添加顶级部门!")) { c.id = 0; } else { MessageAlert.Alert("请选则上级部门"); return; } } winDepartment wd = new winDepartment(c.id, c.id, true); wd.ShowDialog(); this.tvProperties.ItemsSource = null; lt.TreeLoad(); this.dataGrid1.ItemsSource = GetDepartmentModel(); }
private void editer_Click(object sender, RoutedEventArgs e) { var c = tvProperties.SelectedItem as PropertyNodeItem; if (c == null) { MessageAlert.Alert("请先选择要操作的部门"); return; } winDepartment wd = new winDepartment(c.parentId, c.id, false); wd.ShowDialog(); this.tvProperties.ItemsSource = null; lt.TreeLoad(); this.dataGrid1.ItemsSource = GetDepartmentModel(); }