Exemplo n.º 1
0
 public EditProjectProjectStatusViewData(
     ProjectFirmaModels.Models.Project project
     , bool allowEditUpdateDate
     , string createdByPerson
     , string deleteUrl
     , ProjectFirmaModels.Models.FirmaPage projectStatusFirmaPage
     , FirmaSession currentFirmaSession
     , List <ProjectFirmaModels.Models.ProjectStatus> allProjectStatuses
     , ProjectStatusLegendDisplayViewData projectStatusLegendDisplayViewData
     , bool isFinalStatusReport) : base(currentFirmaSession)
 {
     ProjectStatuses = allProjectStatuses.OrderBy(x => x.ProjectStatusSortOrder)
                       .ToSelectListWithEmptyFirstRow(x => x.ProjectStatusID.ToString(),
                                                      x => !string.IsNullOrEmpty(x.ProjectStatusDescription)
                                                                                  ? $"{x.ProjectStatusDisplayName} - {x.ProjectStatusDescription}"
                                                                                  : $"{x.ProjectStatusDisplayName}");
     ProjectStatusJsonList = new ProjectStatusJsonList(allProjectStatuses.Select(x => new ProjectStatusJson(x)).ToList());
     AllowEditUpdateDate   = allowEditUpdateDate;
     CreatedByPerson       = !string.IsNullOrEmpty(createdByPerson)
         ? createdByPerson
         : currentFirmaSession.UserDisplayName;
     DeleteButton                       = string.IsNullOrEmpty(deleteUrl) ? new HtmlString(string.Empty) : ModalDialogFormHelper.MakeDeleteIconButton(deleteUrl, $"Delete {FieldDefinitionEnum.Status.ToType().GetFieldDefinitionLabel()} Update", true);
     ProjectStatusFirmaPage             = new ViewPageContentViewData(projectStatusFirmaPage, currentFirmaSession);
     ProjectStatusLegendDisplayViewData = projectStatusLegendDisplayViewData;
     AllowEditFinal                     = isFinalStatusReport || ProjectProjectStatusController.AllowUserToSetNewStatusReportToFinal(project, currentFirmaSession);
 }
        private PartialViewResult ViewEdit(EditProjectProjectStatusViewModel viewModel, bool allowEditUpdateDate, string personCreatedDisplay, string deleteUrl, FirmaPage firmaPage, ProjectFirmaModels.Models.Project project, bool isFinalStatusReport)
        {
            var projectStatusFirmaPage             = firmaPage;
            var allProjectStatuses                 = HttpRequestStorage.DatabaseEntities.ProjectStatuses.ToList();
            var projectStatusesForLegend           = HttpRequestStorage.DatabaseEntities.ProjectStatuses.OrderBy(ps => ps.ProjectStatusSortOrder).ToList();
            var projectStatusLegendDisplayViewData = new ProjectStatusLegendDisplayViewData(projectStatusesForLegend);
            var viewData = new EditProjectProjectStatusViewData(project, allowEditUpdateDate, personCreatedDisplay, deleteUrl, projectStatusFirmaPage, CurrentFirmaSession, allProjectStatuses, projectStatusLegendDisplayViewData, isFinalStatusReport);

            return(RazorPartialView <EditProjectProjectStatus, EditProjectProjectStatusViewData, EditProjectProjectStatusViewModel>(viewData, viewModel));
        }
Exemplo n.º 3
0
        public ProjectTimelineDisplayViewData(ProjectFirmaModels.Models.Project project,
                                              Models.ProjectTimeline projectTimeline, bool userHasProjectStatusUpdatePermissions,
                                              ProjectStatusLegendDisplayViewData projectStatusLegendDisplayViewData)
        {
            ProjectTimeline = projectTimeline;
            UserHasProjectStatusUpdatePermissions = userHasProjectStatusUpdatePermissions;
            var updateStatusUrl = SitkaRoute <ProjectProjectStatusController> .BuildUrlFromExpression(tc => tc.New(project));

            AddProjectProjectStatusButton =
                ModalDialogFormHelper.MakeNewIconButton(updateStatusUrl, "Update Status", true);
            ProjectStatusLegendDisplayViewData = projectStatusLegendDisplayViewData;
            CurrentProjectStatus = project.GetCurrentProjectStatus();
        }