// GET: Projects/Details/5
        public ActionResult Details(int?id)
        {
            ProjectDetailViewModel vm = new ProjectDetailViewModel();
            //AdminProjectViewModel vm = new AdminProjectViewModel();
            UserRolesHelper helper  = new UserRolesHelper();
            ProjectsHelper  phelper = new ProjectsHelper();

            var pSub = phelper.ProjectUsersByRole(id.Value, "Submitter");
            var pDev = phelper.ProjectUsersByRole(id.Value, "Developer");

            var pms = helper.UsersInRole("ProjectManager");

            vm.PMUsers     = new SelectList(pms, "Id", "FirstName");
            vm.TeamMembers = new SelectList(db.Users, "Id", "FullName");
            vm.Developers  = pDev;
            vm.Submitters  = pSub;
            vm.Project     = db.Projects.Find(id);


            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //Project project = db.Projects.Find(id);
            if (vm.Project == null)
            {
                return(HttpNotFound());
            }
            return(View(vm));
        }
Esempio n. 2
0
        public ActionResult AssignDev(int ticketId)
        {
            AssignDevViewModel vm     = new AssignDevViewModel();
            ProjectsHelper     helper = new ProjectsHelper();

            var tkt = db.Tickets.Find(ticketId);
            var dev = helper.ProjectUsersByRole(tkt.ProjectId, "Developer");

            vm.Developers = new SelectList(dev, "Id", "FirstName");
            vm.Ticket     = tkt;

            return(View(vm));
        }
        public PartialViewResult AddUsers(int id, List <string> SelectedUsers)
        {
            ProjectsHelper helper = new ProjectsHelper();
            var            prj    = db.Projects.Find(id);

            foreach (var usr in prj.Users)
            {
                helper.RemoveUserFromProject(usr.Id, id);
            }

            foreach (var dev in SelectedUsers)
            {
                helper.AddUserToProject(dev, prj.Id);
            }

            ProjectsHelper         phelper = new ProjectsHelper();
            ProjectDetailViewModel model   = new ProjectDetailViewModel();

            model.Developers = phelper.ProjectUsersByRole(id, "Submitter");
            model.Submitters = phelper.ProjectUsersByRole(id, "Developer");
            return(PartialView("_TeamMembers", model));
        }
        public ActionResult AddDEV(int id)
        {
            ProjectDevViewModel vm      = new ProjectDevViewModel();
            UserRolesHelper     helper  = new UserRolesHelper();
            ProjectsHelper      pHelper = new ProjectsHelper();

            var dev     = helper.UsersInRole("Developer");
            var projdev = pHelper.ProjectUsersByRole(id, "Developer").Select(u => u.Id).ToArray();

            vm.DevUsers = new MultiSelectList(dev, "Id", "FirstName", projdev);
            vm.Project  = db.Projects.Find(id);

            return(View(vm));
        }
Esempio n. 5
0
        public ActionResult AssignDEV(int id)
        {
            UserRolesHelper URHelper = new UserRolesHelper();
            string          PM       = User.Identity.GetUserId();

            if (PM != db.Projects.Find(id).PMID &&
                URHelper.IsUserinRole(PM, "admin") != true)
            {
                return(RedirectToAction("Index"));
            }
            ProjectDEVViewModel vm      = new ProjectDEVViewModel();
            UserRolesHelper     helper  = new UserRolesHelper();
            ProjectsHelper      phelper = new ProjectsHelper();

            var dev     = helper.UsersInRole("Developer");
            var projdev = phelper.ProjectUsersByRole(id, "Developer").Select(u => u.Id).ToArray();

            vm.DevUsers = new MultiSelectList(dev, "Id", "DisplayName", projdev);
            vm.Project  = db.Projects.Find(id);

            return(View(vm));
        }