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);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
    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;
                }
            }
        }
예제 #5
0
 public void Restart()
 {
     _currentIndex = 0;
     IsComplete    = false;
     IsRunning     = true;
     CurrentStep.Start();
 }
예제 #6
0
            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);
            }
예제 #7
0
 public virtual void Skip()
 {
     if (CurrentStep != null)
     {
         CurrentStep.Skip();
     }
 }
예제 #8
0
        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");
        }
예제 #10
0
파일: Quest.cs 프로젝트: xPathin/DiIiS-
 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);
     }
 }
예제 #11
0
파일: Wizard.cs 프로젝트: AliBashaSY/Coddee
 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);
     }
 }
예제 #12
0
 public ScenarioSnapshot CreateSnapshot()
 {
     return(new ScenarioSnapshot {
         DisplayText = GetDisplayText(),
         Steps = Steps.Select(s => s.CreateSnapshot()).ToList(),
         CurrentStep = CurrentStep.CreateSnapshot()
     });
 }
예제 #13
0
        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");
        }
예제 #14
0
 //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;
 }
예제 #15
0
 /// <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();
        }
예제 #17
0
        private void WizardBanner_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            this.Closing -= WizardBanner_Closing;

            if (CurrentStep != null && CurrentStep.Cleanup != null)
            {
                CurrentStep.Cleanup();
            }
        }
예제 #18
0
        private string ProcessCurrentStepText(string currentStepText)
        {
            string processed = currentStepText;

            processed = processed.Replace(C_MAXSTEP, MaxSteps.ToString());
            processed = processed.Replace(C_CURRENTSTEP, CurrentStep.ToString());

            return(processed);
        }
예제 #19
0
 /// <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);
 }
예제 #21
0
 /// <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);
     }
 }
예제 #22
0
파일: Quest.cs 프로젝트: xPathin/DiIiS-
 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);
 }
예제 #23
0
파일: MainUI.cs 프로젝트: via5/Synergy
        private void CloneModifier()
        {
            if (CurrentStep == null || CurrentStep.Modifiers.Count == 0)
            {
                return;
            }

            CurrentStep.AddModifier(CurrentModifier.Clone());
            SelectModifier(CurrentStep.Modifiers.Count - 1);
        }
예제 #24
0
        /// <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);
        }
예제 #25
0
        /// <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);
        }
예제 #26
0
 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);
 }