Esempio n. 1
0
 public static ProjectUserType GetUserType(this User user, Project project, UIBuildItContext db)
 {
     using (MiniProfiler.Current.Step("Get user type for " + user.Name))
     {
         if (project == null) // Not associated with a project
         {
             return ProjectUserType.Owner;
         }
         if (project.Owner == null)
         {
             // Creator becomes owner
             return ProjectUserType.Owner;
         }
         if (user.Id == project.Owner.Id)
         {
             return ProjectUserType.Owner;
         }
         var projectUsers = (from pu in db.ProjectUsers
                             where pu.UserMail == user.Email && pu.ProjectId == project.Id
                             select pu).ToList();
         if (projectUsers == null || projectUsers.Count == 0)
         {
             return ProjectUserType.None;
         }
         var result = ProjectUserType.None;
         foreach (var pu in projectUsers)
         {
             result |= pu.UserType;
         }
         return result;
     }
 }
Esempio n. 2
0
        internal static ICollection<GanttRow> GenerateRows(Project project, UIBuildItContext db)
        {
            _rows = new List<GanttRow>();
            var milestones = (from m in db.Milestones.AsNoTracking()
                             where m.ParentId == project.Id
                             select m).ToList();
            foreach(var m in milestones)
            {
                var row = new GanttRow() { id = (int)m.HashIndex(), parent = 0, progress = 0, duration = 0, text = m.Name };
                _rows.Add(row);

                var sprintSpans = AddSprintRows(m, db);
                var taskSpans = AddExecutionUnitTasks(m, db);
                var start = (sprintSpans.Item1 < taskSpans.Item1) ? sprintSpans.Item1: taskSpans.Item1;
                row.start_date = start.ToString("dd-MM-yyyy");
                var end = (sprintSpans.Item2 > taskSpans.Item2) ? sprintSpans.Item2 : taskSpans.Item2;
                row.duration = 0;// (int)(end - start).TotalHours / hoursPerDay;
            }

            return _rows;
        }
Esempio n. 3
0
 public static bool IsSystemEngineer(this User user, Project project, UIBuildItContext db)
 {
     return user.IsOwner(project) ||
         (ProjectUserType.SystemEngineer & user.GetUserType(project, db)) == ProjectUserType.SystemEngineer;
 }
Esempio n. 4
0
 public static bool IsProductManager(this User user, Project project, UIBuildItContext db)
 {
     return user.IsOwner(project) ||
         (ProjectUserType.ProductManager & user.GetUserType(project, db)) == ProjectUserType.ProductManager;
 }
Esempio n. 5
0
 public static bool IsOwner(this User user, Project project)
 {
     return user.Id == project.Owner.Id;
 }