public string RunSheduledCampaigns(int emailBatchSize = 50, int smsBatchSize = 50)
 {
     ScheduleService scheduleService = new ScheduleService();
     scheduleService.RunScheduledCampaigns(emailBatchSize, smsBatchSize);
     return "SUCCESS";
     //Timer timer =
 }
        public bool CanStartJob()
        {
            JobService jobService = new JobService();
            bool hasJobCompleted =  jobService.IsLastJobCompleted();

            ScheduleService scheduleService = new ScheduleService();
            bool hasScheduledCampaigns  = scheduleService.HasScheduledCampaigns();

            if (hasJobCompleted && hasScheduledCampaigns)
            {
                return true;
            }
            return false;
        }
 public ActionResult Schedules(int messageId = 0)
 {
     var schedules = new ScheduleService().GetSchedules().OrderBy(p => p.StartTime);
     return View(schedules);
 }
 public string RunSheduledSmsCampaigns(int size = 50)
 {
     ScheduleService scheduleService = new ScheduleService();
     scheduleService.RunScheduledCampaignsByType((int)CampaignType.SMS, size);
     return "SUCCESS";
 }
 public IEnumerable<Schedule> GetSchedules()
 {
     //ErrorMethod();
     ScheduleService scheduleService = new ScheduleService();
     return scheduleService.GetSchedules();
 }