public override int RunJob() { try { FileLock(true); _deleteParticipantDataTimeout = Convert.ToInt32(DataAccessUtilities.GetSystemParameterByName("DeleteParticipantDataTimeout")); _deleteInputFileErrorsOver1YearOldTimeout = Convert.ToInt32(DataAccessUtilities.GetSystemParameterByName("DeleteOldInputFileErrorsTimeout")); _deleteValidatedParticipantDataTimeout = Convert.ToInt32(DataAccessUtilities.GetSystemParameterByName("DeleteValidatedParticipantDataTimeout")); _copyValidatedParticipantsTimeout = Convert.ToInt32(DataAccessUtilities.GetSystemParameterByName("CopyValidatedParticipantsTimeout")); int jobReturnCode = ValidatedUpload(_decisionLevel); //unlock the File provider for future uploads FileLock(false); return(jobReturnCode); } catch (Exception e) { if (CurrentStep != null) { CurrentStep.Finish(false); } UnhandledException = e; spRunner2.PublishError("Copy Valid Records", 3, e.Message, _inputFileHistoryCode, null, null); //Log error to db for debug purposes. //unlock the File provider for future uploads FileLock(false); return(1); } }
public override int RunJob() { try { FileLock(true); _deleteParticipantDataTimeout = Convert.ToInt32(DataAccessUtilities.GetSystemParameterByName("DeleteParticipantDataTimeout")); _deleteInputFileErrorsOver1YearOldTimeout = Convert.ToInt32(DataAccessUtilities.GetSystemParameterByName("DeleteOldInputFileErrorsTimeout")); int jobReturnCode = ClearUpload(); InputFileHistory ifh = inputFileHistoryRepository.Find(x => x.Code == _inputFileHistoryCode).First(); ifh.Status = "Cancelled"; inputFileHistoryRepository.Update(ifh); //unlock the File provider for future uploads FileLock(false); return(jobReturnCode); } catch (Exception e) { if (CurrentStep != null) { CurrentStep.Finish(false); } UnhandledException = e; spRunner2.PublishError("Clear Participant Data", 3, e.Message, _inputFileHistoryCode, null, null); //Log error to db for debug purposes. //unlock the File provider for future uploads FileLock(false); return(1); } }
public override bool ShouldEnchant() { string keyName = $"{Name}.ENCHANT"; if (CurrentStep == null) { FrameHelper.UpdateDebugFrame(keyName, "No step"); return(false); } if (!MyCharLevelIsHighEnough()) { FrameHelper.UpdateDebugFrame(keyName, "Level up first"); return(false); } if (!CurrentStep.ItemoCraft.IsAnEnchant) { FrameHelper.UpdateDebugFrame(keyName, "Not an enchant"); return(false); } if (!CurrentStep.HasMatsToCraftOne()) { FrameHelper.UpdateDebugFrame(keyName, "Not enough materials"); return(false); } if (!CurrentStep.KnownRecipe) { FrameHelper.UpdateDebugFrame(keyName, "We don't know the recipe"); return(false); } FrameHelper.UpdateDebugFrame(keyName, "RUNNING"); return(true); }
/// <summary> /// Updates the state machine. This should be invoked periodically. /// </summary> public void Update() { if (CurrentStep == null) { Reset(); } CurrentStep.Update(); if (CurrentStep.ReachedExit != null) { var nextSteps = FindNextSteps(CurrentStep, CurrentStep.ReachedExit); if (nextSteps.Count() > 1) { throw new NotImplementedException(); } var nextStep = nextSteps.FirstOrDefault(); CurrentStep.Leave(); CurrentStep = nextStep; if (nextStep != null) { nextStep.Enter(); Console.WriteLine("New step: " + nextStep.GetType().Name); } else { Console.WriteLine("Process finished!"); IsFinished = true; } } }
public void Restart() { _currentIndex = 0; IsComplete = false; IsRunning = true; CurrentStep.Start(); }
private bool Run(List <String> stepNameAlreadyCalled) { if (CurrentStep == null) { return(true); } if (stepNameAlreadyCalled.Contains(CurrentStep.Name)) { return(false); } bool isStepEnd = CurrentStep.Run(FirstCallCurrentStep); if (isStepEnd) { // To avoid forever loop stepNameAlreadyCalled.Add(CurrentStep.Name); FirstCallCurrentStep = true; CurrentStep = CurrentStep.NextStep; if (CurrentStep != null && CurrentStep.IsImmediateRun) { return(Run(stepNameAlreadyCalled)); } } else { FirstCallCurrentStep = false; } return(false); }
public virtual void Skip() { if (CurrentStep != null) { CurrentStep.Skip(); } }
public void Run() { var currentDirection = 0; var currentIndex = 0; while (currentIndex < steps.Count) { PreviousStep = currentIndex > 0 ? steps[currentIndex - 1] : null; CurrentStep = steps[currentIndex]; var result = CurrentStep.Run(this); switch (result) { case IStepResult.Next: currentDirection = 1; break; case IStepResult.Previous: currentDirection = -1; break; case IStepResult.Skip: // do not change direction break; default: IsCancelled = true; return; } currentIndex += currentDirection; } }
void Copier_SqlRowsCopied(object sender, SqlRowsCopiedEventArgs e) { _recordsSoFar += 1000; decimal percentthrough = Convert.ToDecimal(_recordsSoFar) / Convert.ToDecimal(_flatRecordCount) * 100; int percentInt = Convert.ToInt32(decimal.Truncate(percentthrough)); CurrentStep.UpdateProgress(percentInt, "Bulk uploading"); }
public void NotifyBonus(Mooege.Common.MPQ.FileFormats.QuestStepObjectiveType type, int value) { if (CurrentStep != null) { //Logger.Debug(" NotifyBonus through Quest impl for type {0} and value {1} ", type, value); CurrentStep.NotifyBonus(type, value); } }
private void Back() { if (!CurrentStep.IsFirstStep) { CurrentStep.SetCompleted(false); CurrentStep = Steps.OrderByDescending(e => e.Index).First(e => e.Index < CurrentStep.Index && e.Visibility == Visibility.Visible); } }
public ScenarioSnapshot CreateSnapshot() { return(new ScenarioSnapshot { DisplayText = GetDisplayText(), Steps = Steps.Select(s => s.CreateSnapshot()).ToList(), CurrentStep = CurrentStep.CreateSnapshot() }); }
void Copier_SqlRowsCopied(object sender, SqlRowsCopiedEventArgs e) { _recordsSoFar += 1000; decimal percentthrough = Convert.ToDecimal(reader.CurrentPosition) / Convert.ToDecimal(reader.FileLength) * 100; int percentInt = Convert.ToInt32(decimal.Truncate(percentthrough)); CurrentStep.UpdateProgress(percentInt, "Bulk uploading"); }
//reset all values in the node that way the next time it's accessed all values are there default values public override void Reset() { m_UnderGroundTimer = 0.0f; m_WaitTimer = 0.0f; m_IsAttacking = false; m_IsInitialized = false; m_CurrentStep = CurrentStep.Step1MoveUnderGround; }
/// <summary> /// This method will be executed for continuing to guide tour /// </summary> /// <param name="CurrentStepSequence">This parameter will contain the "sequence" of the current Step so we can continue the same step</param> internal void ContinueStep(int CurrentStepSequence) { if (CurrentStepSequence >= 0) { CalculateStep(GuideFlow.CURRENT, CurrentStepSequence); CurrentStep.Show(GuideFlow.FORWARD); } }
/// <summary> /// Resets the automaton to the initial state. /// </summary> public void Reset() { if (CurrentStep == null) { CurrentStep = InitialState; } CurrentStep?.Reset(); }
private void WizardBanner_Closing(object sender, System.ComponentModel.CancelEventArgs e) { this.Closing -= WizardBanner_Closing; if (CurrentStep != null && CurrentStep.Cleanup != null) { CurrentStep.Cleanup(); } }
private string ProcessCurrentStepText(string currentStepText) { string processed = currentStepText; processed = processed.Replace(C_MAXSTEP, MaxSteps.ToString()); processed = processed.Replace(C_CURRENTSTEP, CurrentStep.ToString()); return(processed); }
/// <summary> /// This method will be executed for moving to the previous step, basically searches the previous step in the list, shows it and hides the current one. /// </summary> /// <param name="CurrentStepSequence">This parameter is the "sequence" of the current Step so we can get the previous Step from the list</param> internal void PreviousStep(int CurrentStepSequence) { HideCurrentStep(CurrentStepSequence, GuideFlow.BACKWARD); if (CurrentStepSequence > 0) { CalculateStep(GuideFlow.BACKWARD, CurrentStepSequence); CurrentStep.Show(GuideFlow.BACKWARD); } }
/// <summary> /// Removes old data for the current file from the validated area. /// </summary> private void CopyValidatedParticipants(SqlTransaction transact) { CurrentStep = this["CopyValidatedParticipants"]; CurrentStep.Timeout = _copyValidatedParticipantsTimeout; CurrentStep.Start(); CurrentStep.UpdateProgress(0, "Copying records to validated area"); spRunner.CopyValidatedParticipants(ProviderKey, _decisionLevel, transact, _copyValidatedParticipantsTimeout); CurrentStep.Finish(true); }
/// <summary> /// This method will be executed for moving to the next step, basically searches the next step in the list, shows it and hides the current one. /// </summary> /// <param name="CurrentStepSequence">This parameter will contain the "sequence" of the current Step so we can get the next Step from the list</param> internal void NextStep(int CurrentStepSequence) { HideCurrentStep(CurrentStepSequence, GuideFlow.FORWARD); if (CurrentStepSequence < TotalSteps) { CalculateStep(GuideFlow.FORWARD, CurrentStepSequence); CurrentStep.Show(GuideFlow.FORWARD); } }
public void Advance() { ////Logger.Debug(" Advancing Current step {0}", CurrentStep.QuestStepID); //foreach (var objsetelm in CurrentStep.ObjectivesSets) //{ // //Logger.Debug(" Current step Objective sets type {0}", objsetelm.GetType()); //} CurrentStep.CompleteObjectiveSet(0); }
private void CloneModifier() { if (CurrentStep == null || CurrentStep.Modifiers.Count == 0) { return; } CurrentStep.AddModifier(CurrentModifier.Clone()); SelectModifier(CurrentStep.Modifiers.Count - 1); }
/// <summary> /// Removes old data for the current file from the loading area. /// </summary> private void DeleteInputFileErrorsOver1YearOld() { CurrentStep = this["DeleteInputFileErrorsOver1YearOld"]; CurrentStep.Timeout = _deleteInputFileErrorsOver1YearOldTimeout; CurrentStep.Start(); CurrentStep.UpdateProgress(0, "Deleting data over 1 year old from error message table"); spRunner.DeleteInputFileErrorsOver1YearOld(_deleteInputFileErrorsOver1YearOldTimeout); CurrentStep.Finish(true); }
/// <summary> /// Removes old data for the current file from the loading area. /// </summary> private void DeleteParticipantData() { CurrentStep = this["DeleteParticipantData"]; CurrentStep.Timeout = _deleteParticipantDataTimeout; CurrentStep.Start(); CurrentStep.UpdateProgress(0, "Deleting previous file from loading area"); spRunner.DeleteParticipantData(ProviderKey, _deleteParticipantDataTimeout); CurrentStep.Finish(true); }
public bool MoveNext() { if (position >= 0) { CurrentStep.Reverse(); CurrentStep.alreadyPlayed = true; } position++; return(position < etapes.Count); }
/// <summary> /// Removes old data for the current file from the validated area. /// </summary> private void DeleteValidatedParticipantData(SqlTransaction transact) { CurrentStep = this["DeleteValidatedParticipantData"]; CurrentStep.Timeout = _deleteValidatedParticipantDataTimeout; CurrentStep.Start(); CurrentStep.UpdateProgress(0, "Deleting previous file from validated area"); spRunner.DeleteValidatedParticipantData(ProviderKey, transact, _deleteValidatedParticipantDataTimeout); CurrentStep.Finish(true); }
// We have all materials ? public bool WeHaveAllMats(string key = null) { if (CurrentStep.HasAllMats()) { FrameHelper.UpdateDebugFrame(key, "We have all materials"); return(true); } FrameHelper.UpdateDebugFrame(key, "We don't have all materials"); return(false); }
// Remaining mats can be bought ? public bool WeCanBuyRemainingMats(string key = null) { if (CurrentStep.CanBuyRemainingMats()) { FrameHelper.UpdateDebugFrame(key, "We can buy the remaining mats"); return(true); } FrameHelper.UpdateDebugFrame(key, "The remaining mats can't be bought"); return(false); }
// We have mats to craft one ? public bool WeHaveMatsToCraftOne(string key = null) { if (CurrentStep.HasMatsToCraftOne()) { FrameHelper.UpdateDebugFrame(key, "We have mats to craft one"); return(true); } FrameHelper.UpdateDebugFrame(key, "We don't have mats to craft one"); return(false); }