Exemple #1
0
        private void CreateNewProjectProjectStatus(ActionItem actionItem)
        {
            var project = actionItem.Project;

            var finalStatusReport = project.ProjectProjectStatuses.Where(x => x.IsFinalStatusUpdate);

            if (finalStatusReport.Any())
            {
                return;
            }

            var lastStatusReport = project.ProjectProjectStatuses
                                   .OrderByDescending(x => x.ProjectProjectStatusCreateDate).FirstOrDefault();

            var defaultProjectStatus = HttpRequestStorage.DatabaseEntities.ProjectStatuses
                                       .OrderBy(ps => ps.ProjectStatusSortOrder).First();
            var projectStatus = lastStatusReport?.ProjectStatus ?? defaultProjectStatus;

            var projectProjectStatus = new ProjectProjectStatus(project, projectStatus, DateTime.Now,
                                                                CurrentFirmaSession.Person, DateTime.Now, false);

            projectProjectStatus.ActionItems.Add(actionItem);

            projectProjectStatus.ProjectProjectStatusRecentActivities =
                $"This is a system generated {FieldDefinitionEnum.StatusUpdate.ToType().GetFieldDefinitionLabel()} indicating the related {FieldDefinitionEnum.ActionItem.ToType().GetFieldDefinitionLabel()} " +
                $"has been marked {actionItem.ActionItemState.ActionItemStateDisplayName} " +
                $"by {CurrentFirmaSession.Person.GetFullNameFirstLastAndOrgShortName()} for this project ({project.GetDisplayName()}).";

            projectProjectStatus.ProjectProjectStatusComment =
                $"When marked {actionItem.ActionItemState.ActionItemStateDisplayName}, the related {FieldDefinitionEnum.ActionItem.ToType().GetFieldDefinitionLabel()} text read: {actionItem.ActionItemText}";

            project.ProjectProjectStatuses.Add(projectProjectStatus);

            HttpRequestStorage.DatabaseEntities.SaveChanges();
        }
        private PartialViewResult ViewDeleteProjectProjectStatus(ProjectProjectStatus projectProjectStatus, ConfirmDialogFormViewModel viewModel)
        {
            var canDelete      = !projectProjectStatus.HasDependentObjects();
            var confirmMessage = canDelete
                ? $"Are you sure you want to delete this {FieldDefinitionEnum.StatusUpdate.ToType().GetFieldDefinitionLabel()} for {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} '{projectProjectStatus.Project.GetDisplayName()}'?"
                : ConfirmDialogFormViewData.GetStandardCannotDeleteMessage($"{FieldDefinitionEnum.StatusUpdate.ToType().GetFieldDefinitionLabel()}");
            var viewData = new ConfirmDialogFormViewData(confirmMessage, canDelete);

            return(RazorPartialView <ConfirmDialogForm, ConfirmDialogFormViewData, ConfirmDialogFormViewModel>(viewData, viewModel));
        }
        private ActionResult MakeTheNewProjectProjectStatus(ProjectPrimaryKey projectPrimaryKey, EditProjectProjectStatusViewModel viewModel)
        {
            var project = projectPrimaryKey.EntityObject;
            var projectStatusFromViewModel = new ProjectStatusPrimaryKey(viewModel.ProjectStatusID).EntityObject;
            var projectProjectStatus       =
                ProjectProjectStatus.CreateNewBlank(project, projectStatusFromViewModel, CurrentFirmaSession.Person);

            viewModel.UpdateModel(projectProjectStatus, CurrentFirmaSession);
            project.ProjectProjectStatuses.Add(projectProjectStatus);
            HttpRequestStorage.DatabaseEntities.SaveChanges();
            return(new ModalDialogFormJsonResult());
        }
        public static HtmlString MakeProjectStatusEditLinkButton(ProjectProjectStatus projectProjectStatus, bool canEditProjectStatus, bool canEditFinalStatusReport)
        {
            var editIconAsModalDialogLinkBootstrap = new HtmlString(string.Empty);

            if ((canEditProjectStatus && !projectProjectStatus.IsFinalStatusUpdate) || (canEditFinalStatusReport && projectProjectStatus.IsFinalStatusUpdate))
            {
                editIconAsModalDialogLinkBootstrap = DhtmlxGridHtmlHelpers.MakeEditIconAsModalDialogLinkBootstrap(
                    projectProjectStatus.GetEditProjectProjectStatusUrl()
                    , $"Add {FieldDefinitionEnum.StatusUpdate.ToType().GetFieldDefinitionLabel()} Details:");
            }
            return(editIconAsModalDialogLinkBootstrap);
        }
        public static HtmlString MakeProjectStatusDetailsLinkButton(ProjectProjectStatus projectProjectStatus)
        {
            var detailsLink = ModalDialogFormHelper.ModalDialogFormLinkHiddenSave(
                null,
                "Show Details",
                projectProjectStatus.GetProjectProjectStatusDetailsUrl()
                , $"{FieldDefinitionEnum.StatusUpdate.ToType().GetFieldDefinitionLabel()} Details"
                , 900
                , "Close"
                , new List <string>());

            return(detailsLink);
        }
        public static HtmlString MakeProjectStatusDeleteLinkButton(ProjectProjectStatus projectProjectStatus, bool canEditProjectStatus, bool canEditFinalStatusReport)
        {
            var deleteIconAsModalDialogLinkBootstrap = new HtmlString(string.Empty);

            if ((canEditProjectStatus && !projectProjectStatus.IsFinalStatusUpdate) || (canEditFinalStatusReport && projectProjectStatus.IsFinalStatusUpdate))
            {
                deleteIconAsModalDialogLinkBootstrap = ModalDialogFormHelper.MakeDeleteLink(
                    BootstrapHtmlHelpers.MakeGlyphIconWithScreenReaderOnlyText("glyphicon-trash",
                                                                               "Delete status report").ToString(),
                    projectProjectStatus.GetDeleteProjectProjectStatusUrl(), new List <string> {
                }, true);
            }
            return(deleteIconAsModalDialogLinkBootstrap);
        }
        public ProjectTimelineProjectStatusChangeEvent(ProjectProjectStatus projectProjectStatus, bool canEditProjectProjectStatus, bool canEditFinalStatusReport)
        {
            Date        = projectProjectStatus.ProjectProjectStatusUpdateDate;
            DateDisplay = Date.ToString("MMM dd, yyyy");
            FiscalYear  = FirmaDateUtilities.CalculateFiscalYearForTenant(Date);
            Quarter     = (Quarter)FirmaDateUtilities.CalculateQuarterForTenant(Date);
            ProjectTimelineEventType       = ProjectTimelineEventType.ProjectStatusChange;
            TimelineEventTypeDisplayName   = projectProjectStatus.IsFinalStatusUpdate ? "Final Status Update" : "Status Updated";
            TimelineEventPersonDisplayName = projectProjectStatus.ProjectProjectStatusCreatePerson.GetPersonDisplayNameWithContactTypesListForProject(projectProjectStatus.Project);
            ProjectTimelineSide            = ProjectTimelineSide.Right;

            EditButton   = ProjectTimeline.MakeProjectStatusEditLinkButton(projectProjectStatus, canEditProjectProjectStatus, canEditFinalStatusReport);
            DeleteButton = ProjectTimeline.MakeProjectStatusDeleteLinkButton(projectProjectStatus, canEditProjectProjectStatus, canEditFinalStatusReport);
            Color        = projectProjectStatus.ProjectStatus.ProjectStatusColor;
            ShowDetailsLinkHtmlString = ProjectTimeline.MakeProjectStatusDetailsLinkButton(projectProjectStatus);
            ProjectProjectStatus      = projectProjectStatus;
        }
Exemple #8
0
        public ReportTemplateProjectStatusModel(ProjectProjectStatus projectProjectStatus)
        {
            // Private properties
            ProjectStatus = projectProjectStatus;


            // Public properties
            UpdateDate           = projectProjectStatus.ProjectProjectStatusUpdateDate.ToShortDateString();
            CreatePersonName     = projectProjectStatus.ProjectProjectStatusCreatePerson.GetFullNameFirstLast();
            CreateDate           = projectProjectStatus.ProjectProjectStatusCreateDate.ToShortDateString();
            LastEditedPersonName = projectProjectStatus.ProjectProjectStatusLastEditedPerson?.GetFullNameFirstLast() ?? projectProjectStatus.ProjectProjectStatusCreatePerson.GetFullNameFirstLast();
            LastEditedDate       = projectProjectStatus.ProjectProjectStatusLastEditedDate.HasValue ? projectProjectStatus.ProjectProjectStatusLastEditedDate.Value.ToShortDateString() : String.Empty;
            ProjectStatusComment = projectProjectStatus.ProjectProjectStatusComment;

            ProjectStatusDisplayName = projectProjectStatus.ProjectStatus.ProjectStatusDisplayName;
            ProjectStatusColor       = projectProjectStatus.ProjectStatus.ProjectStatusColor;
            ProjectStatusDescription = projectProjectStatus.ProjectStatus.ProjectStatusDescription;
        }
Exemple #9
0
 public ProjectTimelineProjectStatusChangeEvent(ProjectProjectStatus projectProjectStatus, bool canEditProjectProjectStatus, bool canEditFinalStatusReport)
 {
     Date        = projectProjectStatus.ProjectProjectStatusUpdateDate;
     DateDisplay = Date.ToString("MMM dd, yyyy");
     FiscalYear  = FirmaDateUtilities.CalculateFiscalYearForTenant(Date);
     Quarter     = (Quarter)FirmaDateUtilities.CalculateQuarterForTenant(Date);
     ProjectTimelineEventType       = ProjectTimelineEventType.ProjectStatusChange;
     TimelineEventTypeDisplayName   = projectProjectStatus.IsFinalStatusUpdate ? "Final Status Update" : "Status Updated";
     TimelineEventPersonDisplayName = projectProjectStatus.ProjectProjectStatusCreatePerson.GetPersonDisplayNameWithContactTypesListForProject(projectProjectStatus.Project);
     ProjectTimelineSide            = ProjectTimelineSide.Right;
     EditButton   = ProjectTimeline.MakeProjectStatusEditLinkButton(projectProjectStatus, canEditProjectProjectStatus, canEditFinalStatusReport);
     DeleteButton = ProjectTimeline.MakeProjectStatusDeleteLinkButton(projectProjectStatus, canEditProjectProjectStatus, canEditFinalStatusReport);
     Color        = projectProjectStatus.ProjectStatus.ProjectStatusColor;
     ShowDetailsLinkHtmlString = ProjectTimeline.MakeProjectStatusDetailsLinkButton(projectProjectStatus);
     ProjectProjectStatus      = projectProjectStatus;
     ActionItems = projectProjectStatus.ActionItems.ToList();
     AddActionItemLinkHtmlString = ModalDialogFormHelper.ModalDialogFormLink(string.Format("<span class='glyphicon glyphicon-plus' style='margin-right: 3px'></span>Add {0}", FieldDefinitionEnum.ActionItem.ToType().GetFieldDefinitionLabel()), SitkaRoute <ActionItemController> .BuildUrlFromExpression(c => c.NewForProjectStatus(projectProjectStatus.Project, projectProjectStatus)), string.Format("Add New {0}", FieldDefinitionEnum.ActionItem.ToType().GetFieldDefinitionLabel()), 700, "Add", "Cancel", new List <string> {
     }, null, null);
 }
Exemple #10
0
 public static string GetProjectProjectStatusDetailsUrl(this ProjectProjectStatus projectProjectStatus)
 {
     return(ProjectProjectStatusDetailsUrlTemplate.ParameterReplace(projectProjectStatus.ProjectID, projectProjectStatus.ProjectProjectStatusID));
 }
 public static string GetDropdownDisplayName(this ProjectProjectStatus projectProjectStatus)
 {
     return($"{projectProjectStatus.ProjectProjectStatusCreateDate:MM/dd/yyyy} - {projectProjectStatus.ProjectProjectStatusCreatePerson.GetFullNameFirstLast()} - {projectProjectStatus.ProjectStatus.ProjectStatusDisplayName}");
 }