Exemple #1
0
        private void StartPuller(TabItem tabItem, SqlCommand command, RuntimeRegionSettings settings)
        {
            var asyncSqlPuller = new AsyncReplicaOperations.AsyncSQLConnectPuller(OperationsAPI.ThreadCount);

            if (settings.Restrictions.CountRestrictions > 0)
            {
                asyncSqlPuller.fillPull(command.ExecuteReader(), settings.Restrictions.CountRestrictions);
            }
            else
            {
                if (settings.Restrictions.Count > 0)
                {
                    asyncSqlPuller.fillPull(settings.Restrictions.ToList <Restriction>());
                }
                else
                {
                    asyncSqlPuller.fillPull(command.ExecuteReader());
                }
            }
            asyncSqlPuller.CommandText      = string.Format("use {0} exec {1} @StoreId", sqlConnection.Database, procName);
            asyncSqlPuller.ExtractPathSQL   = extractPathSQL;
            asyncSqlPuller.ConnectionString = sqlConnection.ConnectionString;
            asyncSqlPuller.RegionID         = (string)tabItem.Header;
            asyncSqlPuller.Direction        = direction;
            SetProgressCount(asyncSqlPuller.RegionID, asyncSqlPuller.lastElementCount);
            if (!timer.IsRunning)
            {
                timer.Start();
            }
            asyncSqlPuller.StatusChanged += AsyncSqlPuller_StatusChanged;
            asyncSqlPuller.LogProcessed  += AsyncSqlPuller_LogProcessed;
            pullers.Add(asyncSqlPuller);
        }
Exemple #2
0
 private void AsyncSqlPuller_LogProcessed(AsyncReplicaOperations.AsyncSQLConnectPuller sender, AsyncLogEventArgs e)
 {
     this.AttachLog(e.LogValue, sender.RegionID);
     if (e.LogValue.Status != TaskRunningStatus.Running)
     {
         this.IncrementProgress(sender.RegionID);
     }
     //FileLogger.GetInstance().WriteLog(e.LogValue, DateTime.Now);
 }
Exemple #3
0
 private void AsyncSqlPuller_StatusChanged(AsyncReplicaOperations.AsyncSQLConnectPuller sender, AsyncStatusChangedEventArgs e)
 {
     if (e.NewStatus == RunningStatusEnum.Completed)
     {
         if (!pullers.All(x => x.Status == RunningStatusEnum.Completed))
         {
             AsyncSQLConnectPuller puller = pullers.First(x => x.Status == RunningStatusEnum.NotRunning);
             puller.operatePull();
         }
         else
         {
             this.Notify();
         }
     }
 }