private void doProc() {
   if (this._conn != null) {
     try {
       this._state = RemoteProcState.Running;
       this.Started = DateTime.Now;
       this.doOnStarted();
       this._doProcessCursor();
     } catch (ThreadAbortException) {
     } catch (EBioSQLBreaked) {
       this._state = RemoteProcState.Breaked;
     } catch (Exception ex) {
       this._state = RemoteProcState.Error;
       this._lastError = EBioException.CreateIfNotEBio(ex);
     } finally {
       if (this._conn != null) {
         this._conn.Close();
         this._conn = null;
       }
       if (this.State == RemoteProcState.Breaking)
         this._state = RemoteProcState.Breaked;
       else if (this.State == RemoteProcState.Running)
         this._state = RemoteProcState.Done;
      
       if (this.State == RemoteProcState.Breaked)
         this.doOnBreaked();
       else if (this.State == RemoteProcState.Error)
         this.doOnError();
       this.doOnFinished();
     }
   }
 }
Exemple #2
0
 /// <summary>
 /// Выполнен
 /// </summary>
 public static Boolean IsFinished(RemoteProcState state) {
   switch (state) {
     case RemoteProcState.Breaked:
     case RemoteProcState.Done:
     case RemoteProcState.Error:
       return true;
     default:
       return false;
   }
 }
Exemple #3
0
 /// <summary>
 /// Выполняется
 /// </summary>
 public static Boolean IsRunning(RemoteProcState state) {
   switch (state) {
     case RemoteProcState.Breaked:
     case RemoteProcState.Done:
     case RemoteProcState.Error:
     case RemoteProcState.Redy:
       return false;
     default:
       return true;
   }
 }
 private void doProc() {
   if (this._conn != null) {
     try {
       this._state = RemoteProcState.Running;
       this.Started = DateTime.Now;
       this.DoOnStarted();
       if (this._prepareCmdProc != null) {
         String vCurrentSQL = null;
         Params vCurrentParams = null;
         this._currentCmd = this._prepareCmdProc(this._conn, ref vCurrentSQL, ref vCurrentParams);
         SQLCmd.ExecuteScript(this._currentCmd, vCurrentSQL, vCurrentParams);
       }
       Thread.Sleep(100);
     } catch (ThreadAbortException) {
     } catch (EBioSQLBreaked) {
       this._state = RemoteProcState.Breaked;
     } catch (Exception ex) {
       this._state = RemoteProcState.Error;
       this._lastError = EBioException.CreateIfNotEBio(ex);
     } finally {
       if (this._conn != null) {
         this._conn.Close();
         this._conn = null;
       }
       if (this.State == RemoteProcState.Breaking)
         this._state = RemoteProcState.Breaked;
       else if (this.State == RemoteProcState.Running)
         this._state = RemoteProcState.Done;
       
       if (this.State == RemoteProcState.Breaked)
         this.doOnBreaked();
       else if (this.State == RemoteProcState.Error)
         this.doOnError();
       this.doOnFinished();
     }
   }
 }
 /// <summary>
 /// Добавляем состояние к отчету
 /// </summary>
 /// <param name="rptUID"></param>
 /// <param name="newState"></param>
 /// <param name="newStateDesc"></param>
 /// <param name="userUID"></param>
 /// <param name="remoteIP"></param>
 protected override void doOnAddQueueState(String rptUID, RemoteProcState newState, String newStateDesc, String userUID, String remoteIP) {
   const string sql = "begin xlr.set_rpt_state(:p_rpt_uid, :p_rpt_state, :p_state_desc, :p_usr_uid, :p_remote_ip); end;";
   var v_prms = new Params();
   v_prms.Add("p_rpt_uid", rptUID);
   v_prms.Add("p_rpt_state", (int)newState);
   v_prms.Add("p_state_desc", newStateDesc);
   v_prms.Add("p_usr_uid", userUID);
   v_prms.Add("p_remote_ip", remoteIP);
   SQLCmd.ExecuteScript(this.cfg.dbSession, sql, v_prms, 120);
 }
 public void Dispose() {
   this.Abort(() => {
     this._state = RemoteProcState.Disposed;
   });
 }
 public void Abort(Action callback) {
   if (this.IsRunning) {
     this._state = RemoteProcState.Breaking;
   }
 }
 public void Run(ThreadPriority priority) {
   this._conn = this.dbSess.GetConnection();
   this._state = RemoteProcState.Running;
   this.UID = null;
   this._thread = new Thread(this.doProc);
   this._thread.Name = "DSFetch-{" + this.bioCode + "}-[" + (!String.IsNullOrEmpty(this.Pipe) ? this.Pipe : "NO_PIPE_DEFINED") + "]";
   this._thread.Start();
 }
Exemple #9
0
 protected abstract void doOnAddQueueState(String rptUID, RemoteProcState newState, String newStateDesc, String userUID, String remoteIP);
 public void Abort(Action callback) {
   if (this.IsRunning) {
     this._state = RemoteProcState.Breaking;
     if ((this._currentCmd != null) && (this._conn != null)) {
       this._currentCmd.Cancel();
     }
   }
   //if(new ArrayList {ThreadState.Background, ThreadState.Running, ThreadState.Suspended, ThreadState.SuspendRequested, ThreadState.WaitSleepJoin}.Contains(this.FThread.ThreadState))
   //  this.FThread.Abort();
 }
Exemple #11
0
 private void _buildFile() {
   try {
     this._state = RemoteProcState.Running;
     this._started = DateTime.Now;
     this._bioParams.SetValue("hide_deleted1", 1);
     this._bioParams.SetValue("hide_deleted2", 1);
     var prms = new Params(
       new Param("IOCode", this._bioCode),
       new Param("DSDefNode", this._ds),
       new Param("IOParams", this._bioParams),
       new Param("DbConn", this._conn)
       );
   } catch (ThreadAbortException ex) {
     Utl.SaveStringToFile(this._lastErrorFile, ex.ToString(), null);
     this._state = RemoteProcState.Breaked;
   } catch (Exception ex) {
     Utl.SaveStringToFile(this._lastErrorFile, ex.ToString(), null);
     this._state = RemoteProcState.Error;
   } finally {
     if (this._state != RemoteProcState.Error) {
       if (this._state != RemoteProcState.Breaked)
         this._state = RemoteProcState.Done;
     }
   }
 }