Ejemplo n.º 1
0
        protected void LoadViewModel(RequestFormViewModel viewModel)
        {
            viewModel.BudgetLocations = _agencyManagementService.GetAll();

            viewModel.ExecutiveSponsors = (viewModel.Request != null &&
                                           viewModel.Request.ExecutiveSponsorPersonId.HasValue)
                                              ? _personManagementService.GetActiveStaffWithAgency(
                viewModel.Request.ExecutiveSponsorPersonId.Value)
                                              : _personManagementService.GetActiveStaffWithAgency();

            viewModel.ITDivisions = _orgManagementService.GetByAgency(13);

            viewModel.ProjectManagers = (viewModel.Request != null &&
                                         viewModel.Request.ProjectManagerId.HasValue)
                                            ? _personManagementService.GetActiveStaff(
                viewModel.Request.ProjectManagerId.Value)
                                            : _personManagementService.GetActiveStaff();

            viewModel.RequestStatuses = _requestStatusManagementService.GetAll();
            viewModel.RequestTypes    = _requestTypeManagementService.GetAll();
            viewModel.UserLeads       = (viewModel.Request != null &&
                                         viewModel.Request.UserLeadPersonId.HasValue)
                                      ? _personManagementService.GetActiveStaffWithAgency(
                viewModel.Request.UserLeadPersonId.Value)
                                      : _personManagementService.GetActiveStaffWithAgency();
            viewModel.WrmsSystems = _wrmsSystemManagementService.GetActiveSystems();

            if (viewModel.Request != null && viewModel.Request.Id > 0)
            {
                viewModel.TotalRequestHours = _timeEntryManagementService.GetTotalHours(viewModel.Request.Id);
            }
        }