Пример #1
0
        /// <summary>
        /// 对比AD和DB中的数据,然后更新到OA数据库中
        /// </summary>
        private void CompareADAndDBData(AD2DBTransferContext context)
        {
            //查询对比组织机构、用户、和用户组织机构关系表
            OrginalOguDataOperation ogu = new OrginalOguDataOperation(context);

            ogu.CompareAndModifyData();
            OrginalUsersDataOperation users = new OrginalUsersDataOperation(context);

            users.CompareAndModifyData();
            OrginalOUUsersDataOperation ouusers = new OrginalOUUsersDataOperation(context);

            ouusers.CompareAndModifyData();
            OrginalUserInfoExtendDataOperation userinfo = new OrginalUserInfoExtendDataOperation(context);

            userinfo.CompareAndModifyData();

            using (DbContext ctx = DbContext.GetContext(this.initialParams.AccreditAdminConnectionName))
            {
                DeleteDB(context);                //先删除3个表的信息、然后更新3个表的信息、最后添加三个表的信息。
                UpdateDB(context);
                AddDB(context);
            }

            using (DbContext ctx = DbContext.GetContext(this.initialParams.UserInfoExtend))
            {
                OrginalUserInfoExtendDataOperation userinfoExtend = new OrginalUserInfoExtendDataOperation(context);
                userinfoExtend.DeleteOperation();
                userinfoExtend.UpdateOperation();
                userinfoExtend.AddOperation();
            }
        }
Пример #2
0
        private void AddDB(AD2DBTransferContext context)
        {
            OrginalOguDataOperation ogu = new OrginalOguDataOperation(context);

            ogu.AddOperation();
            OrginalUsersDataOperation users = new OrginalUsersDataOperation(context);

            users.AddOperation();
            OrginalOUUsersDataOperation ouusers = new OrginalOUUsersDataOperation(context);

            ouusers.AddOperation();

            this.initialParams.Log.Write(string.Format("ORGANIZATIONS表添加数量是:{0},USERS表添加数量是:{1},OUUSERS表添加数量是:{2}",
                                                       ogu.AddCount.ToString(), users.AddCount.ToString(), ouusers.AddCount.ToString()));
        }