Exemple #1
0
        public async Task <ProjectViewViewModel> GetTeamByProjectID(int id)
        {
            ProjectViewViewModel projectViewViewModel = new ProjectViewViewModel();
            var listOfUsers      = new List <User>();
            var listOfRoles      = new List <Role>();
            var UsersByProjectID = from t in _context.Teams
                                   join u in _context.User on t.UserIdFk equals u.UserId
                                   join r in _context.Role on t.RoleIdFk equals r.RoleId
                                   where t.PriIdFk == id
                                   select new { u.Fname, u.Lname, r.RoleName };
            var ListOfUsersByProjectID = await UsersByProjectID.ToListAsync();

            foreach (var item in ListOfUsersByProjectID)
            {
                listOfUsers.Add(new User {
                    Fname = item.Fname, Lname = item.Lname
                });
                listOfRoles.Add(new Role {
                    RoleName = item.RoleName
                });
            }
            projectViewViewModel.Roles = listOfRoles;
            projectViewViewModel.Users = listOfUsers;

            return(projectViewViewModel);
        }
Exemple #2
0
        public dynamic ProjectView(dynamic pId)
        {
            // make sure the id is a valid integer
            int projectId = 0;

            if (!Int32.TryParse((pId ?? "").ToString(), out projectId))
            {
                return(HttpStatusCode.BadRequest);
            }

            // look up the project - return a 404 if we can't load it
            ProjectModel project = _projectRepo.GetById(projectId);

            if (project == null)
            {
                return(HttpStatusCode.NotFound);
            }

            // set up the view model
            ProjectViewViewModel viewModel = new ProjectViewViewModel();

            viewModel.ProjectId        = projectId;
            viewModel.ProjectName      = project.Name;
            viewModel.UnprocessedCount = _projectRepo.GetUnprocessedLogFileCount(projectId);
            viewModel.IsProjectEditor  = this.Context.CurrentUser.HasClaim(Claims.ProjectEdit);

            AddScript(Scripts.ProjectView);
            return(this.View[Views.Project.View, viewModel]);
        }
        private void CodeTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            ProjectViewViewModel vm = DataContext as ProjectViewViewModel;

            if (e.NewValue is FocusGridModel ||
                e.NewValue is EventTabModel ||
                e.NewValue is LocalisationModel ||
                e.NewValue is ScriptModel)
            {
                if (vm != null)
                {
                    vm.SelectedItem = e.NewValue;
                }
                RenameButton.IsEnabled = true;
            }
            else
            {
                if (vm != null)
                {
                    vm.SelectedItem = null;
                }
                RenameButton.IsEnabled = false;
            }
            vm?.DeleteElementMenuCommand.RaiseCanExecuteChanged();
            vm?.EditElementMenuCommand.RaiseCanExecuteChanged();
        }
Exemple #4
0
        public IActionResult Index()
        {
            ProjectViewViewModel projectViewViewModel = new ProjectViewViewModel
            {
                Projects = GetAllProjects().Result.Projects
            };

            return(View(projectViewViewModel));
        }
Exemple #5
0
        public async Task <ProjectViewViewModel> GetTeamsByProjectID(int projectId)
        {
            HttpClient          client = _api.Initial();
            HttpResponseMessage res    = await client.GetAsync($"api/teamsapi/GetTeamByProjectID/{projectId}");

            ProjectViewViewModel result = new ProjectViewViewModel();

            if (res.IsSuccessStatusCode)
            {
                var data = res.Content.ReadAsStringAsync().Result;
                result = JsonConvert.DeserializeObject <ProjectViewViewModel>(data);
            }
            return(result);
        }
        public ActionResult Index()
        {
            List <Project> projects = _db.Projects
                                      .Include(a => a.Tags)
                                      .ToList();

            ProjectViewViewModel pvvm = new ProjectViewViewModel
            {
                Projects        = projects.Where(p => p.IsHidden == false).ToList(),
                IsAuthenticated = User.Identity.IsAuthenticated,
                HiddenProjects  = projects.Where(p => p.IsHidden).ToList()
            };

            return(View(pvvm));
        }
Exemple #7
0
        public async Task <IActionResult> Index(ProjectViewViewModel projectViewViewModel)
        {
            var selectedProjID = int.Parse(projectViewViewModel.SelectedProjectID);

            projectViewViewModel.Projects = GetAllProjects().Result.Projects;
            projectViewViewModel.Project  = await GetProjectInfoByProjectID(selectedProjID);

            projectViewViewModel.Risks = await GetRisksByProjectID(selectedProjID);

            Task <ProjectViewViewModel> result = GetTeamsByProjectID(selectedProjID);

            projectViewViewModel.Users = result.Result.Users;
            projectViewViewModel.Roles = result.Result.Roles;
            return(View("Index", projectViewViewModel));
        }
Exemple #8
0
        //should combine these methods later in one large query
        public async Task <ProjectViewViewModel> GetAllProjects()
        {
            HttpClient          client = _api.Initial();
            HttpResponseMessage res    = await client.GetAsync("api/projectsapi");

            var projectViewViewModel = new ProjectViewViewModel();

            if (res.IsSuccessStatusCode)
            {
                var result            = res.Content.ReadAsStringAsync().Result;
                var projectSelectList = JsonConvert.DeserializeObject <IEnumerable <Projects> >(result).Select(a => new SelectListItem
                {
                    Text  = a.PrjName,
                    Value = a.ProjId.ToString()
                });
                projectViewViewModel.Projects = new SelectList(projectSelectList, "Value", "Text");
            }
            return(projectViewViewModel);
        }
Exemple #9
0
 public ProjectView()
 {
     InitializeComponent();
     DataContext = new ProjectViewViewModel();
 }