/// <summary> /// Create a new instance of a Task. /// </summary> /// <param name="name"></param> /// <param name="status"></param> /// <param name="isOptional"></param> /// <returns></returns> public static Entity.Task CreateTask(string name, Entity.ProjectStatus status = null, bool isOptional = false) { return(new Entity.Task(name, status, isOptional) { Id = 1, RowVersion = new byte[] { 12, 13, 14 } }); }
/// <summary> /// Creates a default list of tasks. /// </summary> /// <param name="status"></param> /// <returns></returns> public static List <Entity.Task> CreateDefaultTasks(Entity.ProjectStatus status = null) { return(new List <Entity.Task>() { new Entity.Task("Task 1", status) { Id = 1, RowVersion = new byte[] { 12, 13, 14 } }, new Entity.Task("Task 2", status) { Id = 2, RowVersion = new byte[] { 12, 13, 14 } } }); }
/// <summary> /// Create a new instance of a ProjectStatusNotification class. /// </summary> /// <param name="template"></param> /// <param name="fromStatus"></param> /// <param name="toStatus"></param> /// <param name="delay"></param> /// <param name="delayDays"></param> public ProjectStatusNotification(NotificationTemplate template, ProjectStatus fromStatus, ProjectStatus toStatus, NotificationDelays delay, int delayDays = 0) { this.TemplateId = template?.Id ?? throw new ArgumentNullException(nameof(template)); this.Template = template; this.FromStatusId = fromStatus?.Id; this.FromStatus = fromStatus; this.ToStatusId = toStatus?.Id; this.ToStatus = toStatus; this.Priority = template.Priority; this.Delay = delay; this.DelayDays = delayDays; }
/// <summary> /// Create a new instance of a Task. /// </summary> /// <param name="context"></param> /// <param name="id"></param> /// <param name="name"></param> /// <param name="status"></param> /// <param name="isOptional"></param> /// <returns></returns> public static Entity.Task CreateTask(this PimsContext context, int id, string name, Entity.ProjectStatus status = null, bool isOptional = false) { var task = new Entity.Task(name, status, isOptional) { Id = id, CreatedById = Guid.NewGuid(), CreatedOn = DateTime.UtcNow, UpdatedById = Guid.NewGuid(), UpdatedOn = DateTime.UtcNow, IsOptional = false, RowVersion = new byte[] { 12, 13, 14 } }; if (status != null) { context.ProjectStatus.Update(status); } context.Tasks.Add(task); return(task); }
/// <summary> /// Create a new instance of a Task class, initializes with specified arguments. /// </summary> /// <param name="name"></param> /// <param name="status"></param> /// <param name="isOptional"></param> public Task(string name, ProjectStatus status, bool isOptional = true) : this(name, isOptional) { this.StatusId = status?.Id; this.Status = status; }