Beispiel #1
0
        public ActionResult DelDept(string deptName)
        {
            RtxDeptManager rdm = new RtxDeptManager();

            if (rdm.DelDept(deptName))
            {
                return(Json(new AjaxResult {
                    Status = "ok", Msg = "删除成功", Data = deptName
                }));
            }
            return(Json(new AjaxResult {
                Status = "error", Msg = "删除失败"
            }));
        }
        public ActionResult DelOUDept(string deptName)
        {
            string         filePath = Server.MapPath("~/ADConfig.xml");
            AdOperate      ado      = new AdOperate(filePath);
            DirectoryEntry entry    = ado.GetEntry();
            string         filter   = "(&(objectclass=organizationalUnit)(ou=" + deptName + "))";
            DirectoryEntry ouEntry  = ado.GetOUEntry(entry, filter);

            ado.DelEntry(ouEntry);
            RtxDeptManager rdm = new RtxDeptManager();

            rdm.DelDept(deptName);
            return(Json(new AjaxResult {
                Status = "ok", Msg = "部门删除成功"
            }));
        }