예제 #1
0
        private void InitiatePunchRoundTestJob(int jobNumber)
        {
            SetUpXmlApiSettings();
            IParameterisedJob <PunchRoundTestCriteria> job = null;
            var jobStatusTracker = Program.Container.Resolve <JobStatusTracker>();

            switch (jobNumber)
            {
            case 1:
                job = new PopulatePunchRoundTestDataJob(_commandExecutor, _outputFileDictionary, jobStatusTracker, _logger);
                break;

            case 2:
                job = new GatherPunchRoundTestTimesheetJob(_commandExecutor, _outputFileDictionary, jobStatusTracker, _logger);
                break;

            case 3:
                job = new CleanUpPunchRoundTestDataJob(_commandExecutor, _outputFileDictionary, jobStatusTracker, _logger);
                break;
            }

            DateTime startDate;

            DateTime.TryParse(mtbPunchRoundTestStartDate.Text, out startDate);
            var criteria = new PunchRoundTestCriteria {
                StartDate = startDate
            };

            try
            {
                ExecuteJob <PunchRoundTestCriteria>(job, criteria);
            }
            catch (DateOutOfRangeValidationException ex)
            {
                MessageBox.Show(string.Format(ToolUI.MsgInvalidDateRange, ex.Filename, ex.StartDate.ToString(DateFormat), ex.EndDate.ToString(DateFormat)));
            }
        }
        public new void SetUp()
        {
            Job = new PopulatePunchRoundTestDataJob(CommandExecutor.Object, OutputDirectory, StatusTracker, Logger.Object);

            base.SetUp();
        }