I have this code I need to write. In my database I have some child jobs that belong to parent job. I need to stop the parent job if all child jobs are stopped, I have this code but it is not working and I am not sure why. I don't get any errors but it just does not work:

public void Stop()
        {
            JobList childJobs = JobList.GetChildJobs(this);
            if (_isActive)
            {
                // TODO:  Add Logic to check to see if all this job's parent's child jobs are stopped.  If they are, stop the parent.
                foreach (Job j in childJobs)
                {
                    if (j.JobStatus.JobStatusMnemonic == "STOPPED")
                    {
                        _jobStatusMnemonic = "STOPPED";
                        UpdateJob(this);
                        JobExecutionLog.CreateJobExecutionLog(JobAuid, DateTime.Now, DateTime.Now, "The Job has stopped successfully.");
                    }
                }
            }
                
        }

Recommended Answers

All 2 Replies

Where did you get the classes: JobList, Job?

I created them, did you want to post the code for them too?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.