Exemplo n.º 1
0
        public ApplicationUser ProjectDev(int Project)
        {
            UserRoleHelper helper = new UserRoleHelper();
            var dev = helper.UsersInRole("Developer");

            Project project = FindProject(Project);

            foreach (var d in dev)
            {
                if (project.Users.Contains(d))
                {
                    return d;
                }
            }
            return null; ;
        }
Exemplo n.º 2
0
        public bool ProjectHasDev(int Project)
        {
            UserRoleHelper helper = new UserRoleHelper();
            var dev = helper.UsersInRole("Developer");

            Project project = FindProject(Project);

            foreach (var d in dev)
            {
                if (project.Users.Contains(d))
                {
                    return true;
                }
            }
            return false;
        }
Exemplo n.º 3
0
        public ActionResult Edit(int? Id)
        {
            UserRoleHelper helper = new UserRoleHelper();
            var pms = helper.UsersInRole("Project Manager");
            var devs = helper.UsersInRole("Developer");
            var project = db.Projects.Find(Id);
            var model = new ProjectUserViewModel()
            {
                Project = project,
               Pms = new MultiSelectList(pms, "Id", "UserName", project.Users.Select(u => u.Id)),
                Devs = new MultiSelectList(devs, "Id", "UserName", project.Users.Select(u => u.Id)),
                Ticket = null,

            };
            return View(model);
        }
Exemplo n.º 4
0
        public bool ProjectHasPm(int Project)
        {
            UserRoleHelper helper = new UserRoleHelper();
            var pms = helper.UsersInRole("Project Manager");

            var project = FindProject(Project);

            foreach(var p in pms)
            {
                if(project.Users.Contains(p))
                {
                    return true;
                }
            }
            return false;
        }
Exemplo n.º 5
0
        public ApplicationUser ProjectPm(int Project)
        {
            UserRoleHelper helper = new UserRoleHelper();
            var pms = helper.UsersInRole("Project Manager");

            Project project = FindProject(Project);

            foreach (var p in pms)
            {
                if (project.Users.Contains(p))
                {
                    return p;
                }
            }
            return null; ;
        }
Exemplo n.º 6
0
        // GET: TicketModels/Edit/5
        public ActionResult Edit(int? id)
        {
            UserRoleHelper helper = new UserRoleHelper();
            var devs = helper.UsersInRole("Developer").ToList();
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Ticket ticketModel = db.Tickets.Find(id);
            if (ticketModel == null)
            {
                return HttpNotFound();
            }

            ViewBag.AssignedUserId = new SelectList(devs, "Id", "DisplayName", ticketModel.Id);
            ViewBag.OwnerId = new SelectList(db.Users, "Id", "FirstName", ticketModel.OwnerId);
            ViewBag.PriorityId = new SelectList(db.TicketPriorities, "Id", "Name", ticketModel.PriorityId);
            ViewBag.ProjectId = new SelectList(db.Projects, "Id", "Name", ticketModel.ProjectId);
            ViewBag.StatusId = new SelectList(db.TicketStatuses, "Id", "Name", ticketModel.StatusId);
            ViewBag.TypeId = new SelectList(db.TicketTypes, "Id", "Name", ticketModel.TypeId);
            return View(ticketModel);
        }
Exemplo n.º 7
0
        public ActionResult RoleRemove(ApplicationUser user, string RoleName)
        {

            UserRoleHelper helper = new UserRoleHelper();
            if (helper.IsUserInRole(user.Id, RoleName))
            {
                helper.RemoveUserFromRole(user.Id, RoleName);

            }

            return RedirectToAction("Index", "Home");

        }
Exemplo n.º 8
0
        public ActionResult RoleAdd (ApplicationUser user, string RoleName)
        {
            
            UserRoleHelper helper = new UserRoleHelper();
            if(!helper.IsUserInRole(user.Id,RoleName))
            {
                helper.AddUserToRole(user.Id, RoleName);
             
            }

            return RedirectToAction("Users");

        }