示例#1
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (tvwDepart.SelectedNode == null)
     {
         UnitCommon.WarnMsg("请选择待删除的部门!");
         return;
     }
     if (tvwDepart.SelectedNode.Level == 0)
     {
         UnitCommon.WarnMsg("不能删除公司!"); // 根节点不能删除
         return;
     }
     if (UnitCommon.ConfirmMsg("确定要删除该部门吗?"))
     {
         int id = int.Parse(tvwDepart.SelectedNode.Tag.ToString());
         DepartmentManager deptMgr = new DepartmentManager();
         bool succ3 = deptMgr.DelDept(id);
         if (succ3)
         {
             FormState = "查看";
             BuildDeptTree();
         }
         else
         {
             UnitCommon.ErrorMsg("删除部门失败!");
         }
     }
 }