Beispiel #1
0
        public void CreateNewJob(string jobname)
        {
            //check if already exists.
            using (var context = new JobContext())
            {
                try
                {
                    var job = context.Jobs.First(j => j.name == jobname);
                    if (job != null)
                    {
                        Debug.WriteLine(jobname + "はすでにテーブルに存在しているため追加しませんでした。");
                        return;
                    }
                }
                catch
                {
                }

            }

            Job newjob = new Job(jobname);
            using (var context = new JobContext())
            {

                context.Jobs.Add(newjob);
                context.SaveChanges();
            }
        }
Beispiel #2
0
        public void DeleteJob(string jobname)
        {
            using (var context = new JobContext())
            {
                var job = context.Jobs.First(j => j.name == jobname);
                context.Jobs.Remove(job);

                context.SaveChanges();
            }
        }
Beispiel #3
0
        public void StopJob(string jobname)
        {
            using (var context = new JobContext())
            {
                var job = context.Jobs.First(j => j.name == jobname);
                DateTime now = DateTime.Now;
                job.stop(now);

                JobRecord record = new JobRecord(job);
                context.JobRecords.Add(record);

                context.SaveChanges();
            }
        }
Beispiel #4
0
 public void StartJob(string jobname)
 {
     using (var context = new JobContext())
     {
         var job = context.Jobs.First(j => j.name == jobname);
         job.start(DateTime.Now);
         context.SaveChanges();
     }
 }