Exemplo n.º 1
0
        public ManageViewData(Person currentPerson,
                              Models.FirmaPage firmaPage,
                              string customNotificationUrl,
                              ProjectUpdateStatusGridSpec projectsRequiringUpdateGridSpec,
                              string projectsRequiringUpdateGridDataUrl,
                              PeopleReceivingReminderGridSpec peopleReceivingReminderGridSpec,
                              string peopleReceivingReminderGridDataUrl, int projectsWithNoContactCount,
                              ProjectUpdateConfiguration projectUpdateConfiguration) : base(currentPerson, firmaPage)
        {
            var reportingYear = FirmaDateUtilities.CalculateCurrentYearToUseForRequiredReporting();

            PageTitle     = $"Manage {Models.FieldDefinition.Project.GetFieldDefinitionLabel()} Updates";
            ReportingYear = reportingYear;

            ProjectsRequiringUpdateGridDataUrl = projectsRequiringUpdateGridDataUrl;
            ProjectsRequiringUpdateGridSpec    = projectsRequiringUpdateGridSpec;
            ProjectsRequiringUpdateGridName    = "projectsRequiringAnUpdateGrid";

            PeopleReceivingReminderGridDataUrl = peopleReceivingReminderGridDataUrl;
            ProjectsWithNoContactCount         = projectsWithNoContactCount;

            ProjectUpdateConfiguration = projectUpdateConfiguration ?? ProjectUpdateConfiguration.CreateNewBlank();

            PeopleReceivingReminderGridSpec = peopleReceivingReminderGridSpec;
            PeopleReceivingReminderGridName = "peopleReceivingAnReminderGrid";

            KickOffIntroPreviewUrl =
                SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.KickOffIntroPreview());

            ReminderIntroPreviewUrl =
                SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.ReminderIntroPreview());

            CloseOutIntroPreviewUrl =
                SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.CloseOutIntroPreview());

            var getPersonIDFunctionString =
                $"function() {{ return Sitka.{PeopleReceivingReminderGridName}.getValuesFromCheckedGridRows({0}, \'PersonID\', \'PersonIDList\'); }}";

            var modalDialogFormLink = ModalDialogFormHelper.ModalDialogFormLink(
                "<span class=\"glyphicon glyphicon-envelope\" style=\"margin-right:5px\"></span>Send Notification to Selected People",
                customNotificationUrl,
                "Send Notification to Selected People",
                700,
                "Send",
                "Cancel",
                new List <string>(),
                null,
                getPersonIDFunctionString);

            PeopleReceivingReminderGridSpec.ArbitraryHtml = new List <string> {
                modalDialogFormLink.ToString()
            };

            EditProjectUpdateConfigurationUrl =
                SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.EditProjectUpdateConfiguration());
        }
 public EditProjectUpdateConfigurationViewModel(ProjectUpdateConfiguration projectUpdateConfiguration)
 {
     ProjectUpdateKickOffDate          = projectUpdateConfiguration?.ProjectUpdateKickOffDate;
     ProjectUpdateCloseOutDate         = projectUpdateConfiguration?.ProjectUpdateCloseOutDate;
     ProjectUpdateReminderInterval     = projectUpdateConfiguration?.ProjectUpdateReminderInterval;
     EnableProjectUpdateReminders      = projectUpdateConfiguration?.EnableProjectUpdateReminders;
     SendPeriodicReminders             = projectUpdateConfiguration?.SendPeriodicReminders;
     SendCloseOutNotification          = projectUpdateConfiguration?.SendCloseOutNotification;
     ProjectUpdateKickOffIntroContent  = projectUpdateConfiguration?.ProjectUpdateKickOffIntroContentHtmlString;
     ProjectUpdateReminderIntroContent = projectUpdateConfiguration?.ProjectUpdateReminderIntroContentHtmlString;
     ProjectUpdateCloseOutIntroContent = projectUpdateConfiguration?.ProjectUpdateCloseOutIntroContentHtmlString;
 }
 public void UpdateModel(ProjectUpdateConfiguration projectUpdateConfiguration)
 {
     projectUpdateConfiguration.ProjectUpdateKickOffDate          = ProjectUpdateKickOffDate;
     projectUpdateConfiguration.ProjectUpdateCloseOutDate         = ProjectUpdateCloseOutDate;
     projectUpdateConfiguration.ProjectUpdateReminderInterval     = ProjectUpdateReminderInterval;
     projectUpdateConfiguration.EnableProjectUpdateReminders      = EnableProjectUpdateReminders.GetValueOrDefault(); // will never be null
     projectUpdateConfiguration.SendPeriodicReminders             = SendPeriodicReminders.GetValueOrDefault();        // will never be null
     projectUpdateConfiguration.SendCloseOutNotification          = SendCloseOutNotification.GetValueOrDefault();     // will never be null
     projectUpdateConfiguration.ProjectUpdateKickOffIntroContent  = ProjectUpdateKickOffIntroContent?.ToString();
     projectUpdateConfiguration.ProjectUpdateReminderIntroContent =
         ProjectUpdateReminderIntroContent?.ToString();
     projectUpdateConfiguration.ProjectUpdateCloseOutIntroContent =
         ProjectUpdateCloseOutIntroContent?.ToString();
 }