Esempio n. 1
0
        private void InitiateTimecardTestJob(int jobNumber)
        {
            SetUpXmlApiSettings();
            IParameterisedJob <TimecardTestCriteria> job = null;
            var jobStatusTracker = Program.Container.Resolve <JobStatusTracker>();

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

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

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

            DateTime startDate;

            DateTime.TryParse(mtbTimecardTestStartDate.Text, out startDate);
            var criteria = new TimecardTestCriteria(startDate);

            try
            {
                ExecuteJob <TimecardTestCriteria>(job, criteria);
            }
            catch (DateOutOfRangeValidationException ex)
            {
                MessageBox.Show(string.Format(ToolUI.MsgInvalidDateRange, ex.Filename, ex.StartDate.ToString(DateFormat), ex.EndDate.ToString(DateFormat)));
            }
        }
Esempio n. 2
0
        private void InitiateShiftGuaranteeTestJob(int jobNumber)
        {
            SetUpXmlApiSettings();
            IParameterisedJob <ShiftGuaranteeTestCriteria> job = null;
            var jobStatusTracker = Program.Container.Resolve <JobStatusTracker>();

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

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

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

            DateTime startDate;

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

            ExecuteJob <ShiftGuaranteeTestCriteria>(job, criteria);
        }
Esempio n. 3
0
        private void ExecuteJob <TCriteria>(IParameterisedJob <TCriteria> job, TCriteria criteria)
        {
            try
            {
                var jobStatus = job.Run(criteria);

                ShowProgressBarStatus(jobStatus);
                if (jobStatus == JobStatus.Failed)
                {
                    MessageBox.Show(ToolUI.MsgJobFailed);
                }

                if (jobStatus == JobStatus.SuccessWithWarnings)
                {
                    MessageBox.Show(ToolUI.MsgJobWasCompletedWithSomeWarnings);
                }
            }
            catch (DependentJobWasNotRunException)
            {
                ShowProgressBarStatus(JobStatus.Failed);
                MessageBox.Show(ToolUI.MsgEmployeeAndPayRuleJobsWereNotRun);
            }
            catch (FileNotAccessibleException ex)
            {
                ShowProgressBarStatus(JobStatus.Failed);
                MessageBox.Show(string.Format(ToolUI.MsgFileIsNotAccessible, ex.FileName));
            }
            catch (SourceFileWasNotFoundException ex)
            {
                ShowProgressBarStatus(JobStatus.Failed);
                MessageBox.Show(string.Format(ToolUI.SourceFileIsNotFoundAt, ex.FileName), ToolUI.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }