Example #1
0
 /// <summary>
 /// to == null: toTop
 /// </summary>
 private void AddDpvm(DepartmentViewModel from, DepartmentViewModel to)
 {
     if (to == null)
     {
         TopDepartmentVMs.Add(from);
     }
     else
     {
         to.AddChildDepartment(from);
     }
 }
Example #2
0
 private void RemoveDpvm(DepartmentViewModel dpvm)
 {
     if (dpvm.IsTopDp)
     {
         TopDepartmentVMs.Remove(dpvm);
     }
     else
     {
         dpvm.ParentDpvm.RemoveChildDepartment(dpvm);
     }
 }
Example #3
0
        private void RemoveDepartment()
        {
            //move children to Top
            foreach (var childDpvm in SelectedDp.ChildrenDpvms)
            {
                childDpvm.ParentDpvm = null;
                TopDepartmentVMs.Add(childDpvm);
            }
            SelectedDp.ChildrenDpvms.Clear();

            //remove
            RemoveDpvm(SelectedDp);
            Model.RemoveWithEntity(SelectedDp.Model);
        }