예제 #1
0
파일: Task.cs 프로젝트: vic0626/nas-merk
 /// <summary>
 /// Ctor for Task
 /// </summary>
 /// <param name="task">Task </param>
 public Task(ScheduleTask task)
 {
     this.Type = task.Type;
     this.Enabled = task.Enabled;
     this.StopOnError = task.StopOnError;
     this.Name = task.Name;
 }
예제 #2
0
        /// <summary>
        /// Deletes a task
        /// </summary>
        /// <param name="task">Task</param>
        public virtual void DeleteTask(ScheduleTask task)
        {
            if (task == null)
                throw new ArgumentNullException("task");

            _taskRepository.Delete(task);
        }
        public void Can_save_and_load_scheduleTask()
        {
            var scheduleTask = new ScheduleTask
                               {
                                   Name = "Task 1",
                                   Seconds = 1,
                                   Type = "some type 1",
                                   Enabled = true,
                                   StopOnError = true,
                                   LastStartUtc = new DateTime(2010, 01, 01),
                                   LastEndUtc = new DateTime(2010, 01, 02),
                                   LastSuccessUtc= new DateTime(2010, 01, 03),
                               };

            var fromDb = SaveAndLoadEntity(scheduleTask);
            fromDb.ShouldNotBeNull();
            fromDb.Name.ShouldEqual("Task 1");
            fromDb.Seconds.ShouldEqual(1);
            fromDb.Type.ShouldEqual("some type 1");
            fromDb.Enabled.ShouldEqual(true);
            fromDb.StopOnError.ShouldEqual(true);
            fromDb.LastStartUtc.ShouldEqual(new DateTime(2010, 01, 01));
            fromDb.LastEndUtc.ShouldEqual(new DateTime(2010, 01, 02));
            fromDb.LastSuccessUtc.ShouldEqual(new DateTime(2010, 01, 03));
        }
예제 #4
0
 protected ScheduleTaskModel PrepareScheduleTaskModel(ScheduleTask task)
 {
     var model = new ScheduleTaskModel()
                     {
                         Id = task.Id,
                         Name = task.Name,
                         Seconds = task.Seconds,
                         Enabled = task.Enabled,
                         StopOnError = task.StopOnError,
                         LastStartUtc = task.LastStartUtc.HasValue ? _dateTimeHelper.ConvertToUserTime(task.LastStartUtc.Value, DateTimeKind.Utc).ToString("G") : "",
                         LastEndUtc = task.LastEndUtc.HasValue ? _dateTimeHelper.ConvertToUserTime(task.LastEndUtc.Value, DateTimeKind.Utc).ToString("G") : "",
                         LastSuccessUtc = task.LastSuccessUtc.HasValue ? _dateTimeHelper.ConvertToUserTime(task.LastSuccessUtc.Value, DateTimeKind.Utc).ToString("G") : "",
                     };
     return model;
 }