Exemplo n.º 1
0
		public static BaseTask CreateTask(ScheduledTaskInfo taskInfo)
		{
			BaseTask task = null;
			switch (taskInfo.ID)
			{
				case _UpdateOFACValidationSourcesTaskID:
					task = new UpdateOFACValidationSourcesTask(taskInfo);
					break;
				default:
					throw new ApplicationException("Invalid task ID");
			}
			task.IsInitialized = true;
			return task;
		}
Exemplo n.º 2
0
		public void SaveTask(ScheduledTaskInfo taskInfo)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				T_ScheduledTask tTask;
				tTask = dc.T_ScheduledTasks.SingleOrDefault(t => t.SheduledTaskID == taskInfo.ID);
				if (tTask == null)
				{
					throw new ApplicationException("Invalid sheduled task ID");
				}
				tTask.stTitle = taskInfo.Title;
				tTask.stInterval = taskInfo.Interval;
				tTask.stLastRan = taskInfo.LastRan;
				dc.SubmitChanges();
			}
		}
Exemplo n.º 3
0
		public ScheduledTaskInfo GetTaskByID(int id)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				var result = dc.T_ScheduledTasks.SingleOrDefault(t => t.SheduledTaskID == id);
				if (result == null)
				{
					throw new ApplicationException("Invalid sheduled task ID");
				}
				ScheduledTaskInfo task = new ScheduledTaskInfo();
				task.ID = result.SheduledTaskID;
				task.Title = result.stTitle;
				task.LastRan = result.stLastRan;
				task.Interval = result.stInterval;
				return task;
			}
		}
Exemplo n.º 4
0
		public IEnumerable<ScheduledTaskInfo> GetActiveTasks(DateTime dueTime)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				var result = dc.T_ScheduledTasks.Where(t => (t.stLastRan + new TimeSpan(t.stInterval)) < dueTime).ToArray();
				List<ScheduledTaskInfo> tasks = new List<ScheduledTaskInfo>(result.Count());
				foreach (var tTask in result)
				{
					ScheduledTaskInfo task = new ScheduledTaskInfo();
					task.ID = tTask.SheduledTaskID;
					task.Title = tTask.stTitle;
					task.LastRan = tTask.stLastRan;
					task.Interval = tTask.stInterval;
					tasks.Add(task);
				}
				return tasks;
			}
		}
		public UpdateOFACValidationSourcesTask(ScheduledTaskInfo taskInfo)
			: base(taskInfo)
		{
			_provider = new CCTValidationProvider();
		}
Exemplo n.º 6
0
		public static void UpdateTaskDone(ScheduledTaskInfo taskInfo)
		{
			taskInfo.LastRan = DateTime.Now;
			_provider.SaveTask(taskInfo);
		}
Exemplo n.º 7
0
		public BaseTask(ScheduledTaskInfo taskInfo)
		{
			_info = taskInfo;
		}