Beispiel #1
0
        private void StartSynchronization(BackgroundWorker worker)
        {
            List <CMS2.Client.SyncHelper.ThreadState> listOfThread = new List <CMS2.Client.SyncHelper.ThreadState>();

            foreach (SyncTables table in _entities)
            {
                CMS2.Client.SyncHelper.ThreadState _threadState = new CMS2.Client.SyncHelper.ThreadState();
                _threadState.table  = table;
                _threadState.worker = worker;
                listOfThread.Add(_threadState);

                try
                {
                    Synchronize sync = new Synchronize(table.TableName, _filter, _threadState._event, new SqlConnection(_localConnectionString.Replace("master", _localDbName)), new SqlConnection(_mainConnectionString));
                    ThreadPool.QueueUserWorkItem(new WaitCallback(sync.PerformSync), _threadState);
                    _threadState._event.WaitOne();
                }
                catch (Exception ex)
                {
                }
            }
        }
Beispiel #2
0
        private void StartDeprovisionServer()
        {
            List <CMS2.Client.SyncHelper.ThreadState> listOfState = new List <CMS2.Client.SyncHelper.ThreadState>();
            SqlConnection mainConnection = new SqlConnection(_mainConnectionString);

            foreach (SyncTables table in _entities)
            {
                CMS2.Client.SyncHelper.ThreadState state = new CMS2.Client.SyncHelper.ThreadState();
                state.table  = table;
                state.worker = Worker;
                listOfState.Add(state);

                try
                {
                    Deprovision deprovision = new Deprovision(mainConnection, state._event, _filter, table.TableName);
                    ThreadPool.QueueUserWorkItem(new WaitCallback(deprovision.PerformDeprovisionTable), state);
                    state._event.WaitOne();
                }
                catch (Exception ex)
                {
                }
            }
        }
Beispiel #3
0
        private void StartProvision()
        {
            List <CMS2.Client.SyncHelper.ThreadState> listOfState = new List <CMS2.Client.SyncHelper.ThreadState>();
            SqlConnection localConnection = new SqlConnection(_localConnectionString.Replace("master", _localDbName));
            SqlConnection mainConnection  = new SqlConnection(_mainConnectionString);

            foreach (SyncTables table in _entities)
            {
                CMS2.Client.SyncHelper.ThreadState state = new CMS2.Client.SyncHelper.ThreadState();
                state.table  = table;
                state.worker = Worker;
                listOfState.Add(state);

                try
                {
                    Provision provision = new Provision(table.TableName, localConnection, mainConnection, state._event, _filter, _branchCorpOfficeId);
                    ThreadPool.QueueUserWorkItem(new WaitCallback(provision.PrepareDatabaseForSynchronization), state);
                    state._event.WaitOne();
                }
                catch (Exception ex)
                {
                }
            }
        }