public static void SendNote(DevTask task, string title) { string fullTitle = title + " in " + task.Name; Note note = new Note(fullTitle, task.Id); task.Notes.Add(note); }
public static void AssignDevTask(ApplicationUser user, DevTask task) { if (UserManager.checkUserRole(user.Id, "Developer")) { user.DevTasks.Add(task); task.ApplicationUsers.Add(user); db.SaveChanges(); } }
public static void AssignDevsToTask(List <ApplicationUser> devs, DevTask task) { foreach (ApplicationUser dev in devs) { if (!dev.DevTasks.Contains(task) && !task.ApplicationUsers.Contains(dev)) { AssignDevTask(dev, task); } } }
//SendDeadlineAlert(Project) public static void SendBugReport(DevTask task, string description) { string title = "Bug Report: " + task.Name; int projectId = task.Project.Id; SendNote(task, description); List <ApplicationUser> recipients = db.Users.Where(u => userManager.IsInRole(u.Id, "ProjectManager")).ToList(); foreach (ApplicationUser r in recipients) { SendNotification(title, description, r, task); } }
public static void SendDeadlineNotification(DevTask task) { string title = "Upcoming Deadline: " + task.Name; int projectId = task.ProjectId; Project project = db.Projects.Find(projectId); string description = task.Name + " in " + project.Name + " will be due in one day."; List <ApplicationUser> recipients = task.ApplicationUsers.Where(u => UserManager.checkUserRole(u.Id, "Developer")).ToList(); foreach (ApplicationUser r in recipients) { SendNotification(title, description, r, task); } }
public static void SendCompletionNotifications(DevTask task) { string title = "Task Completion Report: " + task.Name; int projectId = task.ProjectId; Project project = db.Projects.Find(projectId); string description = task.Name + " in " + project.Name + " has been completed."; List <ApplicationUser> recipients = db.Users.AsEnumerable().Where(u => UserManager.checkUserRole(u.Id, "Project Manager")).ToList(); foreach (ApplicationUser r in recipients) { SendNotification(title, description, r, task); } }
public static void AddComment(string comment, int id) { DevTask task = db.DevTasks.Find(id); if (task.Comments == null) { task.Comments = new List <string> { comment }; } else { task.Comments.Add(comment); } db.SaveChanges(); }
//AddNote public static void UpdateCompletionPercent(double newValue, DevTask task) { if (newValue <= 100) { task.PercentCompleted = newValue; if (newValue == 100) { task.IsComplete = true; SendCompletionNotifications(task); } else { task.IsComplete = false; } //db.SaveChanges(); } else { //error } }
public static void DeleteDevTask(DevTask task) { db.DevTasks.Remove(task); db.SaveChanges(); }
public static void UpdateDevTask(DevTask task) { db.SaveChanges(); }
public DevTask CreateDevTask(int id, string name, string description, DateTime deadline, int projectId) { DevTask newTask = new DevTask(id, name, description, deadline, projectId); return(newTask); }
public static void SendNotification(string title, string description, ApplicationUser user, DevTask task) { Notification notification = new Notification(title, description, user.Id, task.Id, task.ProjectId); user.Notifications.Add(notification); task.Notification.Add(notification); }