public void StartJob(string jobId)
        {
            var job = SqlMapper.Entity <Models.ScheduleJobInfo>().Where(x => x.JobId == jobId).FirstOrDefault();

            using (var trans = SqlMapper.BeginTransaction())
            {
                try
                {
                    job.JobState = JobState.Normal;
                    trans.Entity <Models.ScheduleJobInfo>().Update(job);
                    ScheduleManager.AddJob(job);
                    trans.Commit();
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    throw ex;
                }
            }
        }
        public ScheduleJobInfo AddJob(ScheduleJobInfo dto)
        {
            var model = dto;

            model.JobId = Guid.NewGuid().ToString("N").ToLower();

            using (var trans = SqlMapper.BeginTransaction())
            {
                try
                {
                    trans.Entity <Models.ScheduleJobInfo>().Insert(model);
                    ScheduleManager.AddJob(model);
                    trans.Commit();
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    throw ex;
                }
            }

            return(GetJob(model.JobId));
        }