예제 #1
0
        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);
        }
예제 #2
0
 public static void AssignDevTask(ApplicationUser user, DevTask task)
 {
     if (UserManager.checkUserRole(user.Id, "Developer"))
     {
         user.DevTasks.Add(task);
         task.ApplicationUsers.Add(user);
         db.SaveChanges();
     }
 }
예제 #3
0
 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);
         }
     }
 }
예제 #4
0
        //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);
            }
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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);
            }
        }
예제 #7
0
        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();
        }
예제 #8
0
 //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
     }
 }
예제 #9
0
 public static void  DeleteDevTask(DevTask task)
 {
     db.DevTasks.Remove(task);
     db.SaveChanges();
 }
예제 #10
0
 public static void UpdateDevTask(DevTask task)
 {
     db.SaveChanges();
 }
예제 #11
0
        public DevTask CreateDevTask(int id, string name, string description, DateTime deadline, int projectId)
        {
            DevTask newTask = new DevTask(id, name, description, deadline, projectId);

            return(newTask);
        }
예제 #12
0
        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);
        }