public void DeleteFullAndChildless(DatabaseEntities dbContext) { foreach (var x in GrantAllocationFileResources.ToList()) { x.DeleteFullAndChildless(dbContext); } DeleteChildren(dbContext); Delete(dbContext); }
public void AddNewFileResource(FileResource fileResource, string displayName, string description) { var grantAllocationFileResource = new GrantAllocationFileResource(this, fileResource, displayName) { Description = description }; GrantAllocationFileResources.Add(grantAllocationFileResource); }
/// <summary> /// Dependent type names of this entity /// </summary> public void DeleteChildren(DatabaseEntities dbContext) { foreach (var x in AgreementsWhereYouAreTheAgreementFileResource.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ClassificationsWhereYouAreTheKeyImageFileResource.ToList()) { x.DeleteFull(dbContext); } foreach (var x in CustomPageImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in FieldDefinitionDataImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in FirmaHomePageImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in FirmaPageImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantAllocationAwardContractorInvoicesWhereYouAreTheGrantAllocationAwardContractorInvoiceFileResource.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantAllocationFileResources.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantFileResources.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantModificationFileResources.ToList()) { x.DeleteFull(dbContext); } foreach (var x in InteractionEventFileResources.ToList()) { x.DeleteFull(dbContext); } foreach (var x in InvoicesWhereYouAreTheInvoiceFileResource.ToList()) { x.DeleteFull(dbContext); } foreach (var x in OrganizationsWhereYouAreTheLogoFileResource.ToList()) { x.DeleteFull(dbContext); } foreach (var x in PriorityLandscapeFileResources.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectDocuments.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectDocumentUpdates.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectImageUpdates.ToList()) { x.DeleteFull(dbContext); } foreach (var x in SystemAttributesWhereYouAreTheBannerLogoFileResource.ToList()) { x.DeleteFull(dbContext); } foreach (var x in SystemAttributesWhereYouAreTheSquareLogoFileResource.ToList()) { x.DeleteFull(dbContext); } }
/// <summary> /// Active Dependent type names of this object /// </summary> public List <string> DependentObjectNames() { var dependentObjects = new List <string>(); if (AgreementsWhereYouAreTheAgreementFileResource.Any()) { dependentObjects.Add(typeof(Agreement).Name); } if (ClassificationsWhereYouAreTheKeyImageFileResource.Any()) { dependentObjects.Add(typeof(Classification).Name); } if (CustomPageImages.Any()) { dependentObjects.Add(typeof(CustomPageImage).Name); } if (FieldDefinitionDataImages.Any()) { dependentObjects.Add(typeof(FieldDefinitionDataImage).Name); } if (FirmaHomePageImages.Any()) { dependentObjects.Add(typeof(FirmaHomePageImage).Name); } if (FirmaPageImages.Any()) { dependentObjects.Add(typeof(FirmaPageImage).Name); } if (GrantAllocationAwardContractorInvoicesWhereYouAreTheGrantAllocationAwardContractorInvoiceFileResource.Any()) { dependentObjects.Add(typeof(GrantAllocationAwardContractorInvoice).Name); } if (GrantAllocationFileResources.Any()) { dependentObjects.Add(typeof(GrantAllocationFileResource).Name); } if (GrantFileResources.Any()) { dependentObjects.Add(typeof(GrantFileResource).Name); } if ((GrantModificationFileResource != null)) { dependentObjects.Add(typeof(GrantModificationFileResource).Name); } if ((InteractionEventFileResource != null)) { dependentObjects.Add(typeof(InteractionEventFileResource).Name); } if (InvoicesWhereYouAreTheInvoiceFileResource.Any()) { dependentObjects.Add(typeof(Invoice).Name); } if (OrganizationsWhereYouAreTheLogoFileResource.Any()) { dependentObjects.Add(typeof(Organization).Name); } if ((PriorityLandscapeFileResource != null)) { dependentObjects.Add(typeof(PriorityLandscapeFileResource).Name); } if (ProjectDocuments.Any()) { dependentObjects.Add(typeof(ProjectDocument).Name); } if (ProjectDocumentUpdates.Any()) { dependentObjects.Add(typeof(ProjectDocumentUpdate).Name); } if (ProjectImages.Any()) { dependentObjects.Add(typeof(ProjectImage).Name); } if (ProjectImageUpdates.Any()) { dependentObjects.Add(typeof(ProjectImageUpdate).Name); } if (SystemAttributesWhereYouAreTheBannerLogoFileResource.Any()) { dependentObjects.Add(typeof(SystemAttribute).Name); } if (SystemAttributesWhereYouAreTheSquareLogoFileResource.Any()) { dependentObjects.Add(typeof(SystemAttribute).Name); } return(dependentObjects.Distinct().ToList()); }
/// <summary> /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.) /// </summary> /// <returns></returns> public bool HasDependentObjects() { return(AgreementsWhereYouAreTheAgreementFileResource.Any() || ClassificationsWhereYouAreTheKeyImageFileResource.Any() || CustomPageImages.Any() || FieldDefinitionDataImages.Any() || FirmaHomePageImages.Any() || FirmaPageImages.Any() || GrantAllocationAwardContractorInvoicesWhereYouAreTheGrantAllocationAwardContractorInvoiceFileResource.Any() || GrantAllocationFileResources.Any() || GrantFileResources.Any() || (GrantModificationFileResource != null) || (InteractionEventFileResource != null) || InvoicesWhereYouAreTheInvoiceFileResource.Any() || OrganizationsWhereYouAreTheLogoFileResource.Any() || (PriorityLandscapeFileResource != null) || ProjectDocuments.Any() || ProjectDocumentUpdates.Any() || ProjectImages.Any() || ProjectImageUpdates.Any() || SystemAttributesWhereYouAreTheBannerLogoFileResource.Any() || SystemAttributesWhereYouAreTheSquareLogoFileResource.Any()); }
/// <summary> /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.) /// </summary> /// <returns></returns> public bool HasDependentObjects() { return(AgreementGrantAllocations.Any() || GrantAllocationAwards.Any() || GrantAllocationBudgetLineItems.Any() || GrantAllocationChangeLogs.Any() || GrantAllocationExpenditures.Any() || GrantAllocationFileResources.Any() || GrantAllocationNotes.Any() || GrantAllocationNoteInternals.Any() || GrantAllocationProgramIndexProjectCodes.Any() || GrantAllocationProgramManagers.Any() || InvoiceLineItems.Any() || ProjectGrantAllocationExpenditures.Any() || ProjectGrantAllocationExpenditureUpdates.Any() || ProjectGrantAllocationRequests.Any() || ProjectGrantAllocationRequestUpdates.Any()); }
/// <summary> /// Dependent type names of this entity /// </summary> public void DeleteChildren(DatabaseEntities dbContext) { foreach (var x in AgreementGrantAllocations.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantAllocationAwards.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantAllocationBudgetLineItems.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantAllocationChangeLogs.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantAllocationExpenditures.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantAllocationFileResources.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantAllocationNotes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantAllocationNoteInternals.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantAllocationProgramIndexProjectCodes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in GrantAllocationProgramManagers.ToList()) { x.DeleteFull(dbContext); } foreach (var x in InvoiceLineItems.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectGrantAllocationExpenditures.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectGrantAllocationExpenditureUpdates.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectGrantAllocationRequests.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectGrantAllocationRequestUpdates.ToList()) { x.DeleteFull(dbContext); } }
/// <summary> /// Active Dependent type names of this object /// </summary> public List <string> DependentObjectNames() { var dependentObjects = new List <string>(); if (AgreementGrantAllocations.Any()) { dependentObjects.Add(typeof(AgreementGrantAllocation).Name); } if (GrantAllocationAwards.Any()) { dependentObjects.Add(typeof(GrantAllocationAward).Name); } if (GrantAllocationBudgetLineItems.Any()) { dependentObjects.Add(typeof(GrantAllocationBudgetLineItem).Name); } if (GrantAllocationChangeLogs.Any()) { dependentObjects.Add(typeof(GrantAllocationChangeLog).Name); } if (GrantAllocationExpenditures.Any()) { dependentObjects.Add(typeof(GrantAllocationExpenditure).Name); } if (GrantAllocationFileResources.Any()) { dependentObjects.Add(typeof(GrantAllocationFileResource).Name); } if (GrantAllocationNotes.Any()) { dependentObjects.Add(typeof(GrantAllocationNote).Name); } if (GrantAllocationNoteInternals.Any()) { dependentObjects.Add(typeof(GrantAllocationNoteInternal).Name); } if (GrantAllocationProgramIndexProjectCodes.Any()) { dependentObjects.Add(typeof(GrantAllocationProgramIndexProjectCode).Name); } if (GrantAllocationProgramManagers.Any()) { dependentObjects.Add(typeof(GrantAllocationProgramManager).Name); } if (InvoiceLineItems.Any()) { dependentObjects.Add(typeof(InvoiceLineItem).Name); } if (ProjectGrantAllocationExpenditures.Any()) { dependentObjects.Add(typeof(ProjectGrantAllocationExpenditure).Name); } if (ProjectGrantAllocationExpenditureUpdates.Any()) { dependentObjects.Add(typeof(ProjectGrantAllocationExpenditureUpdate).Name); } if (ProjectGrantAllocationRequests.Any()) { dependentObjects.Add(typeof(ProjectGrantAllocationRequest).Name); } if (ProjectGrantAllocationRequestUpdates.Any()) { dependentObjects.Add(typeof(ProjectGrantAllocationRequestUpdate).Name); } return(dependentObjects.Distinct().ToList()); }