Exemple #1
0
        public void UpdateModel(Models.Grant grant, Person currentPerson)
        {
            grant.GrantName      = GrantName;
            grant.ShortName      = GrantShortName;
            grant.OrganizationID = OrganizationID;
            grant.GrantStatusID  = GrantStatusID;
            grant.GrantTypeID    = GrantTypeID;
            grant.GrantNumber    = GrantNumber;
            grant.CFDANumber     = CFDANumber;
            grant.StartDate      = GrantStartDate;
            grant.EndDate        = GrantEndDate;

            if (GrantFileResourceDatas != null)
            {
                // We allow for empty file resources to be posted - at least until such time as they become required.
                bool anyActualFileResourceDatasSupplied = GrantFileResourceDatas.Any(frd => frd != null);
                if (anyActualFileResourceDatasSupplied)
                {
                    foreach (var currentGrantFileResourceData in GrantFileResourceDatas)
                    {
                        Check.EnsureNotNull(currentGrantFileResourceData);

                        var fileResource = FileResource.CreateNewFromHttpPostedFile(currentGrantFileResourceData, currentPerson);
                        HttpRequestStorage.DatabaseEntities.FileResources.Add(fileResource);
                        var grantFileResource = new GrantFileResource(grant, fileResource, fileResource.OriginalCompleteFileName);
                        grant.GrantFileResources.Add(grantFileResource);
                    }
                }
            }
        }
        public GrantDetailViewData(Person currentPerson,
                                   Models.Grant grant,
                                   EntityNotesViewData grantNotesViewData,
                                   EntityNotesViewData internalNotesViewData)
            : base(currentPerson, grant)
        {
            PageTitle                  = grant.GrantTitle.ToEllipsifiedStringClean(110);
            BreadCrumbTitle            = $"{Models.FieldDefinition.Grant.GetFieldDefinitionLabel()} Detail";
            NewGrantNoteUrl            = grant.GetNewNoteUrl();
            GrantNotesViewData         = grantNotesViewData;
            InternalGrantNotesViewData = internalNotesViewData;

            GrantModificationGridSpec    = new GrantModificationGridSpec(currentPerson, grant);
            GrantModificationGridName    = "grantModificationsGridName";
            GrantModificationGridDataUrl = SitkaRoute <GrantController> .BuildUrlFromExpression(tc => tc.GrantModificationGridJsonDataByGrant(grant.PrimaryKey));

            //GrantAllocationGridSpec = new GrantAllocationGridSpec(currentPerson, GrantAllocationGridSpec.GrantAllocationGridCreateButtonType.Shown, grant);
            //GrantAllocationGridName = "grantAllocationsGridName";
            //GrantAllocationGridDataUrlTemplate = SitkaRoute<GrantController>.BuildUrlFromExpression(tc => tc.GrantAllocationGridJsonDataByGrantModification(UrlTemplate.Parameter1Int));

            GrantAllocationBudgetLineItemGridSpec    = new GrantAllocationBudgetLineItemGridSpec();
            GrantAllocationBudgetLineItemGridName    = "grantAllocationBudgetLineItemsGridName";
            GrantAllocationBudgetLineItemGridDataUrl = SitkaRoute <GrantController> .BuildUrlFromExpression(tc => tc.GrantAllocationBudgetLineItemGridJsonDataByGrant(grant));

            GrantAgreementGridSpec    = new GrantAgreementGridSpec();
            GrantAgreementGridName    = "grantAgreementGridName";
            GrantAgreementGridDataUrl = SitkaRoute <GrantController> .BuildUrlFromExpression(tc => tc.GrantAgreementGridJsonData(grant));

            GrantDetailsFileDetailsViewData = new FileDetailsViewData(
                EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(grant.GrantFileResources)),
                SitkaRoute <GrantController> .BuildUrlFromExpression(x => x.NewGrantFiles(grant.PrimaryKey)),
                new GrantEditAsAdminFeature().HasPermission(currentPerson, grant).HasPermission,
                Models.FieldDefinition.Grant
                );
        }
 public void UpdateModel(Models.Grant grant)
 {
     grant.GrantNumber = GrantNumber;
     grant.StartDate   = GrantStartDate;
     grant.EndDate     = GrantEndDate;
     grant.GrantName   = GrantName;
 }
Exemple #4
0
 protected GrantViewData(Person currentPerson, Models.Grant grant) : base(currentPerson, null)
 {
     Grant         = grant;
     HtmlPageTitle = grant.GrantTitle;
     EntityName    = $"{Models.FieldDefinition.Grant.GetFieldDefinitionLabel()}";
     EditGrantUrl  = grant.GetEditUrl();
     UserHasEditGrantPermissions = new GrantEditAsAdminFeature().HasPermissionByPerson(currentPerson);
     BackToGrantsText            = "Back to all Grants";
     GrantsListUrl = SitkaRoute <GrantController> .BuildUrlFromExpression(c => c.Index());
 }
        public DuplicateGrantViewModel(Models.Grant grantToDuplicate, int initialAwardGrantModificationID)
        {
            GrantName               = $"{grantToDuplicate.GrantName} - Copy";
            GrantStatusID           = grantToDuplicate.GrantStatusID;
            GrantNumber             = grantToDuplicate.GrantNumber;
            GrantModificationAmount = 0;
            GrantStartDate          = grantToDuplicate.StartDate;
            GrantEndDate            = grantToDuplicate.EndDate;

            InitialAwardGrantModificationID = initialAwardGrantModificationID;
        }
Exemple #6
0
 public NewGrantViewModel(Models.Grant grant)
 {
     GrantName      = grant.GrantName;
     GrantShortName = grant.ShortName;
     OrganizationID = grant.OrganizationID;
     GrantStatusID  = grant.GrantStatusID;
     GrantTypeID    = grant.GrantTypeID;
     GrantNumber    = grant.GrantNumber;
     CFDANumber     = grant.CFDANumber;
     GrantStartDate = grant.StartDate;
     GrantEndDate   = grant.EndDate;
 }
 public void UpdateModel(Models.Grant grant, Person currentPerson)
 {
     grant.GrantName      = GrantName;
     grant.ShortName      = GrantShortName;
     grant.OrganizationID = OrganizationID;
     grant.GrantStatusID  = GrantStatusID;
     grant.GrantTypeID    = GrantTypeID;
     grant.GrantNumber    = GrantNumber;
     grant.CFDANumber     = CFDANumber;
     //grant.AwardedFunds = TotalAwardAmount;
     grant.StartDate = GrantStartDate;
     grant.EndDate   = GrantEndDate;
 }
 public EditGrantViewModel(Models.Grant grant)
 {
     GrantName        = grant.GrantName;
     GrantShortName   = grant.ShortName;
     OrganizationID   = grant.OrganizationID;
     GrantStatusID    = grant.GrantStatusID;
     GrantTypeID      = grant.GrantTypeID;
     GrantNumber      = grant.GrantNumber;
     CFDANumber       = grant.CFDANumber;
     TotalAwardAmount = grant.GetTotalAwardAmount();
     GrantStartDate   = grant.StartDate;
     GrantEndDate     = grant.EndDate;
 }
        private void GrantModificationGridSpecConstructorImpl(Person currentPerson, Models.Grant grantToAssociate)
        {
            Check.Ensure(grantToAssociate != null, "Grant is null. Creating a New Grant Modification without a current Grant is currently not supported.");

            ObjectNameSingular  = $"{Models.FieldDefinition.GrantModification.GetFieldDefinitionLabel()}";
            ObjectNamePlural    = $"{Models.FieldDefinition.GrantModification.GetFieldDefinitionLabelPluralized()}";
            SaveFiltersInCookie = true;

            var userHasCreatePermissions = new GrantModificationCreateFeature().HasPermissionByPerson(currentPerson);

            if (userHasCreatePermissions && grantToAssociate != null)
            {
                var contentUrl = SitkaRoute <GrantModificationController> .BuildUrlFromExpression(gmc => gmc.NewGrantModificationForAGrant(grantToAssociate.PrimaryKey));

                CreateEntityModalDialogForm = new ModalDialogForm(contentUrl, 950, $"Create a new {Models.FieldDefinition.GrantModification.GetFieldDefinitionLabel()}");
            }

            // hidden columns for use by JavaScript
            Add(GrantModificationIDHiddenColumnName, x => x.GrantModificationID, 0);
            Add(GrantModificationNameHiddenColumnName, x => x.GrantModificationName, 0);

            var userHasDeletePermissions = new GrantModificationDeleteFeature().HasPermissionByPerson(currentPerson);

            if (userHasDeletePermissions)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(), true, true), 30, DhtmlxGridColumnFilterType.None);
            }

            var userHasEditPermissions = new GrantModificationEditAsAdminFeature().HasPermissionByPerson(currentPerson);

            if (userHasEditPermissions)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeEditIconAsModalDialogLinkBootstrap(
                        new ModalDialogForm(x.GetEditUrl(), $"Edit {ObjectNameSingular} - {x.GrantModificationName}"),
                        userHasEditPermissions), 30, DhtmlxGridColumnFilterType.None);
            }

            if (userHasCreatePermissions && grantToAssociate != null)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDuplicateIconAndLinkBootstrap(x.GetDuplicateUrl(), 950, $"Duplicate {Models.FieldDefinition.GrantModification.GetFieldDefinitionLabel()} \"{x.GrantModificationName}\" to New {Models.FieldDefinition.GrantModification.GetFieldDefinitionLabel()}"), 30, DhtmlxGridColumnFilterType.None);
            }

            Add(Models.FieldDefinition.GrantModificationName.ToGridHeaderString(), x => x.GetGrantModificationNameAsUrl(), 125, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
            Add(Models.FieldDefinition.GrantModificationStartDate.ToGridHeaderString(), x => x.GrantModificationStartDate, 100, DhtmlxGridColumnFormatType.Date);
            Add(Models.FieldDefinition.GrantModificationEndDate.ToGridHeaderString(), x => x.GrantModificationEndDate, 100, DhtmlxGridColumnFormatType.Date);
            Add(Models.FieldDefinition.GrantModificationStatus.ToGridHeaderString(), x => x.GrantModificationStatus.GetDisplayName(), 100, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.GrantModificationPurpose.ToGridHeaderString(), x => x.GrantModificationPurposeNamesAsCommaDelimitedString, 200, DhtmlxGridColumnFilterType.Text);
            Add(Models.FieldDefinition.GrantModificationAmount.ToGridHeaderString(), x => x.GrantModificationAmount, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantModificationDescription.ToGridHeaderString(), x => x.GrantModificationDescription, 125, DhtmlxGridColumnFilterType.Text);
        }
 public EditGrantModificationViewModel(Models.Grant grantToAssociate)
 {
     GrantID = grantToAssociate.GrantID;
     GrantModificationStartDate = grantToAssociate.StartDate ?? DateTime.Now;
     GrantModificationEndDate   = grantToAssociate.EndDate ?? DateTime.Now;
 }
Exemple #11
0
 public DuplicateGrantViewData(IEnumerable <Models.GrantStatus> grantStatuses, Models.Grant grantToDuplicate, List <Models.GrantAllocation> grantAllocations)
 {
     GrantStatuses    = grantStatuses.ToSelectListWithEmptyFirstRow(x => x.GrantStatusID.ToString(CultureInfo.InvariantCulture), y => y.GrantStatusName);
     GrantToDuplicate = grantToDuplicate;
     GrantAllocations = grantAllocations.ToSelectList(x => x.GrantAllocationID.ToString(CultureInfo.InvariantCulture), y => y.GrantAllocationName, true);
 }
        public GrantAllocationGridSpec(Person currentPerson, GrantAllocationGridCreateButtonType createButtonType, Models.Grant optionalRelevantGrant)
        {
            ObjectNameSingular  = $"{Models.FieldDefinition.GrantAllocation.GetFieldDefinitionLabel()}";
            ObjectNamePlural    = $"{Models.FieldDefinition.GrantAllocation.GetFieldDefinitionLabelPluralized()}";
            SaveFiltersInCookie = true;
            var userHasDeletePermissions = new GrantAllocationDeleteFeature().HasPermissionByPerson(currentPerson);
            var userHasCreatePermissions = new GrantCreateFeature().HasPermissionByPerson(currentPerson);

            if (userHasCreatePermissions && createButtonType == GrantAllocationGridCreateButtonType.Shown)
            {
                var contentUrl = SitkaRoute <GrantAllocationController> .BuildUrlFromExpression(t => t.New(optionalRelevantGrant));

                CreateEntityModalDialogForm = new ModalDialogForm(contentUrl, 950, "Create a new Grant Allocation");
            }

            CustomExcelDownloadUrl = SitkaRoute <GrantController> .BuildUrlFromExpression(tc => tc.GrantsExcelDownload());

            if (userHasDeletePermissions)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(), true, true), 30, DhtmlxGridColumnFilterType.None);
            }

            if (userHasCreatePermissions)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDuplicateIconAndLinkBootstrap(x.GetDuplicateUrl(), 950, "Duplicate Grant Allocation"), 30, DhtmlxGridColumnFilterType.None);
            }

            Add(Models.FieldDefinition.GrantNumber.ToGridHeaderString(), x => x.GrantModification.Grant.GrantNumber, GrantNumberColumnWidth, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.GrantAllocationName.ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.GrantAllocationName), 250, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
            Add(Models.FieldDefinition.GrantModification.ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GrantModification.GetDetailUrl(), x.GrantModification.GrantModificationName), 250, DhtmlxGridColumnFilterType.Text);
            Add(Models.FieldDefinition.AllocationAmount.ToGridHeaderString(), x => x.AllocationAmount, 90, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationCurrentBalance.ToGridHeaderString(), x => x.GetTotalBudgetVsActualLineItem().BudgetMinusExpendituresFromDatamart, 90, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);

            Add(Models.FieldDefinition.GrantManager.ToGridHeaderString(), x => x.GrantManager != null ? x.GrantManager.FullNameFirstLastAndOrgShortName : string.Empty, 150, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.ProgramManager.ToGridHeaderString(), x => x.GetAllProgramManagerPersonNamesAsString(), 150, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.GrantStartDate.ToGridHeaderString(), x => x.StartDate, 90, DhtmlxGridColumnFormatType.Date);
            Add(Models.FieldDefinition.GrantEndDate.ToGridHeaderString(), x => x.EndDate, 90, DhtmlxGridColumnFormatType.Date);
            Add($"Parent Grant {Models.FieldDefinition.GrantStatus.ToGridHeaderString()}", x => x.GrantModification.Grant.GrantStatus.GrantStatusName, 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.Division.ToGridHeaderString(), x => x.DivisionNameDisplay, 180, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.DNRUplandRegion.ToGridHeaderString(), x => x.RegionNameDisplay, 100, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.FederalFundCode.ToGridHeaderString(), x => x.FederalFundCode != null ? x.FederalFundCode.FederalFundCodeAbbrev : string.Empty, 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.ProgramIndexProjectCode.ToGridHeaderString(), x => x.GetAssociatedProgramIndexProjectCodePairsCommaDelimited(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.Organization.ToGridHeaderString(), x => x.Organization != null ? x.Organization.OrganizationName : string.Empty, 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
        }
 public GrantModificationGridSpec(Person currentPerson, Models.Grant grantToAssociate)
 {
     GrantModificationGridSpecConstructorImpl(currentPerson, grantToAssociate);
 }