コード例 #1
0
        /// <summary>
        /// 华侨城同步
        /// </summary>
        public void ImportToDBHQC()
        {
            OrganizationAD org = new OrganizationAD();
            Dictionary <string, string> dicDep = new Dictionary <string, string>();

            ADsyn = new ADSynchronization("", "uid=a3admin,cn=users,dc=group,dc=chinaoct,dc=com", "a3admin");
            dicDep.Add("ou", "Name");
            dicDep.Add("adspath", "Path");
            dicDep.Add("searchguide", "Guid");
            var          list    = ADsyn.SearchDepartment("172.16.9.25", "(objectclass=organizationalUnit)", dicDep, "Yinhe.ProcessingCenter.SynAD.PathAnalyseHQC");
            ADDepartment deproot = new ADDepartment()
            {
                Name = "华侨城组织架构", Path = "LDAP://172.16.9.26/cn=chinaoct,cn=groups,dc=group,dc=chinaoct,DC=COM", Code = "LDAP://172.16.9.26/cn=华侨城组织架构,cn=groups,dc=group,dc=chinaoct,DC=COM", Level = 0, Guid = "0000000000000000000", ParentName = ""
            };

            list.Add(deproot);
            Console.WriteLine(list.Count());
            Yinhe.ProcessingCenter.SerializerXml <List <ADDepartment> > ser = new Yinhe.ProcessingCenter.SerializerXml <List <ADDepartment> >(list);
            ser.BuildXml("dep.xml");



            Dictionary <string, string> dicDep1 = new Dictionary <string, string>();

            dicDep1.Add("sn", "Name");
            dicDep1.Add("adspath", "Path");
            dicDep1.Add("uid", "LoginName");
            dicDep1.Add("mail", "EmailAddr");
            dicDep1.Add("seealso", "Guid");
            // dicDep1.Add("o", "DepartMentID");
            dicDep1.Add("o", "Code");
            var list1 = ADsyn.SearchUser("172.16.9.25", "(!(objectclass=container))", dicDep1, "Yinhe.ProcessingCenter.SynAD.PathAnalyseHQC");


            Console.WriteLine(list1.Count());
            Yinhe.ProcessingCenter.SerializerXml <List <ADUser> > ser1 = new Yinhe.ProcessingCenter.SerializerXml <List <ADUser> >(list1);
            ser1.BuildXml("user.xml");

            // list.Where(t => t.Name == "用户").FirstOrDefault().Name = "苏宁组织架构";

            ADDepartment curChild = this.GetADTreeHQC(list, list1, deproot);

            _log.Info(string.Format("获取数据 部门数:{0}  用户数 :{1}", list.Count(), list1.Count()));
            Yinhe.ProcessingCenter.SerializerXml <ADDepartment> ser2 = new Yinhe.ProcessingCenter.SerializerXml <ADDepartment>(curChild);
            ser2.BuildXml("tree.xml");

            if (list.Count() > 5)
            {
                _log.Info("开始同步");
                org.OrganizationSave(list, curChild);
                org.UserInsert(this.UserListFilter(curChild), 1, 0);
            }
            _log.Info("同步结束");
        }
コード例 #2
0
        /// <summary>
        /// 苏宁
        /// </summary>
        public void ImportToDBSN()
        {
            OrganizationAD org = new OrganizationAD();
            Dictionary <string, string> dicDep = new Dictionary <string, string>();

            ADsyn = new ADSynchronization("", "*****@*****.**", "ghr9fg_(&*3Nnl0A");
            dicDep.Add("name", "Name");
            dicDep.Add("adspath", "Path");
            var list = ADsyn.SearchDepartment("10.0.0.1", "(objectCategory=CN=Organizational-Unit,CN=Schema,CN=Configuration,DC=suning,DC=com,DC=cn)", dicDep, "Yinhe.ProcessingCenter.SynAD.PathAnalyseSN");

            Console.WriteLine(list.Count());
            Yinhe.ProcessingCenter.SerializerXml <List <ADDepartment> > ser = new Yinhe.ProcessingCenter.SerializerXml <List <ADDepartment> >(list);
            ser.BuildXml("dep.xml");



            Dictionary <string, string> dicDep1 = new Dictionary <string, string>();

            dicDep1.Add("name", "Name");
            dicDep1.Add("adspath", "Path");
            dicDep1.Add("samaccountname", "LoginName");
            dicDep1.Add("mail", "EmailAddr");
            dicDep1.Add("mobile", "MobieNumber");
            dicDep1.Add("telephonenumber", "PhoneNumber");
            var list1 = ADsyn.SearchUser("10.0.0.1", "(objectCategory=CN=Person,CN=Schema,CN=Configuration,DC=suning,DC=com,DC=cn)", dicDep1, "Yinhe.ProcessingCenter.SynAD.PathAnalyseSN");

            Console.WriteLine(list1.Count());
            Yinhe.ProcessingCenter.SerializerXml <List <ADUser> > ser1 = new Yinhe.ProcessingCenter.SerializerXml <List <ADUser> >(list1);
            ser1.BuildXml("user.xml");

            // list.Where(t => t.Name == "用户").FirstOrDefault().Name = "苏宁组织架构";

            ADDepartment curChild = this.GetADTree(list, list1, list.Where(t => t.Name == "用户").FirstOrDefault());

            Yinhe.ProcessingCenter.SerializerXml <ADDepartment> ser2 = new Yinhe.ProcessingCenter.SerializerXml <ADDepartment>(curChild);
            ser2.BuildXml("tree.xml");

            if (list.Count() > 5)
            {
                org.OrganizationSave(list, curChild);
                org.UserInsert(this.UserListFilter(curChild), 2, 0);
            }
        }
コード例 #3
0
        public void ImportToDBZHHY()
        {
            OrganizationAD  org      = new OrganizationAD();
            PathAnalyseZHHY analyse  = new PathAnalyseZHHY();
            var             depList  = analyse.GetDepList();
            var             userList = analyse.GetUserList();
            ADDepartment    curChild = this.GetADTreeByGuidMultDepZHHY(depList, userList, depList.Where(t => t.ParentGuid == "0").FirstOrDefault()); //顶部

            Yinhe.ProcessingCenter.SerializerXml <List <ADDepartment> > ser = new Yinhe.ProcessingCenter.SerializerXml <List <ADDepartment> >(depList);
            ser.BuildXml("dep.xml");
            Yinhe.ProcessingCenter.SerializerXml <List <ADUser> > ser1 = new Yinhe.ProcessingCenter.SerializerXml <List <ADUser> >(userList);
            ser1.BuildXml("user.xml");
            Yinhe.ProcessingCenter.SerializerXml <ADDepartment> ser2 = new Yinhe.ProcessingCenter.SerializerXml <ADDepartment>(curChild);
            ser2.BuildXml("tree.xml");
            if (depList.Count() > 5)
            {
                org.OrganizationSave(depList, curChild);
                org.UserInsertByDepType(userList, 1, 0, 1, 0);
            }
        }
コード例 #4
0
        /// <summary>
        /// 中海投资
        /// </summary>
        public void ImportToDBZHTZ()
        {
            OrganizationAD org = new OrganizationAD();
            Dictionary <string, string> dicDep = new Dictionary <string, string>();

            ADsyn = new ADSynchronization("", "coihl\\coihl_sysuser", "Cohl888");    //连接数据源
            dicDep.Add("name", "Name");
            dicDep.Add("adspath", "Path");
            //dicDep.Add("objectguid", "Guid");
            var list = ADsyn.SearchDepartment("192.0.0.172", "(objectCategory=CN=Organizational-Unit,CN=Schema,CN=Configuration,DC=cohl,DC=com)", dicDep, "Yinhe.ProcessingCenter.SynAD.PathAnalyseZHTZ");//根据Fileter查找树的子节点(部门)

            Console.WriteLine(list.Count());
            Yinhe.ProcessingCenter.SerializerXml <List <ADDepartment> > ser = new Yinhe.ProcessingCenter.SerializerXml <List <ADDepartment> >(list);
            ser.BuildXml("dep.xml");



            Dictionary <string, string> dicDep1 = new Dictionary <string, string>();

            dicDep1.Add("name", "Name");
            dicDep1.Add("adspath", "Path");
            dicDep1.Add("samaccountname", "LoginName");
            dicDep1.Add("mail", "EmailAddr");
            //dicDep1.Add("objectguid", "Guid");
            var list1 = ADsyn.SearchUser("192.0.0.172", "(objectCategory=CN=Person,CN=Schema,CN=Configuration,DC=cohl,DC=com)", dicDep1, "Yinhe.ProcessingCenter.SynAD.PathAnalyseZHTZ");

            Console.WriteLine(list1.Count());
            Yinhe.ProcessingCenter.SerializerXml <List <ADUser> > ser1 = new Yinhe.ProcessingCenter.SerializerXml <List <ADUser> >(list1);
            ser1.BuildXml("user.xml");
            ADDepartment curChild = this.GetADTree(list, list1, list.Where(t => t.Name == "中海投資").FirstOrDefault());  //顶部

            Yinhe.ProcessingCenter.SerializerXml <ADDepartment> ser2 = new Yinhe.ProcessingCenter.SerializerXml <ADDepartment>(curChild);
            ser2.BuildXml("tree.xml");
            if (list.Count() > 5)
            {
                org.OrganizationSave(list, curChild);
                org.UserInsert(this.UserListFilter(curChild), 2, 0);
            }
        }
コード例 #5
0
        /// <summary>
        /// 旭辉
        /// </summary>
        public void ImportToDBXH()
        {
            OrganizationAD org = new OrganizationAD();
            Dictionary <string, string> dicDep = new Dictionary <string, string>();

            ADsyn = new ADSynchronization("", "administrator", "*03ci33fiit#");
            dicDep.Add("name", "Name");
            dicDep.Add("adspath", "Path");
            var list = ADsyn.SearchDepartment("192.168.8.33", "(objectCategory=CN=Organizational-Unit,CN=Schema,CN=Configuration,DC=cifi,DC=com,DC=cn)", dicDep, "Yinhe.ProcessingCenter.SynAD.PathAnalyseXH");

            Console.WriteLine(list.Count());
            Yinhe.ProcessingCenter.SerializerXml <List <ADDepartment> > ser = new Yinhe.ProcessingCenter.SerializerXml <List <ADDepartment> >(list);
            ser.BuildXml("dep.xml");


            Dictionary <string, string> dicDep1 = new Dictionary <string, string>();

            dicDep1.Add("name", "Name");
            dicDep1.Add("adspath", "Path");
            dicDep1.Add("samaccountname", "LoginName");
            dicDep1.Add("userprincipalname", "EmailAddr");
            var list1 = ADsyn.SearchUser("192.168.8.33", "(objectCategory=CN=Person,CN=Schema,CN=Configuration,DC=cifi,DC=com,DC=cn)", dicDep1, "Yinhe.ProcessingCenter.SynAD.PathAnalyseXH");

            Console.WriteLine(list1.Count());
            Yinhe.ProcessingCenter.SerializerXml <List <ADUser> > ser1 = new Yinhe.ProcessingCenter.SerializerXml <List <ADUser> >(list1);
            ser1.BuildXml("user.xml");

            ADDepartment curChild = this.GetADTree(list, list1, list.Where(t => t.Name.Contains("旭辉")).FirstOrDefault());

            Yinhe.ProcessingCenter.SerializerXml <ADDepartment> ser2 = new Yinhe.ProcessingCenter.SerializerXml <ADDepartment>(curChild);
            ser2.BuildXml("tree.xml");

            if (list.Count() > 5)
            {
                org.OrganizationSave(list, curChild);
                org.UserInsert(list1, 2, 0);
            }
            //Console.WriteLine(Count(curChild));
        }