public IHttpActionResult PutProjectImages(int id, ProjectImages projectImages) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != projectImages.Id) { return(BadRequest()); } db.Entry(projectImages).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProjectImagesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private string ProcessUploadedFile(ProjectEditViewModel model, Project project) { string uniqueFileName = null; if (model.Images != null && model.Images.Count > 0) { foreach (IFormFile photo in model.Images) { string uploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "userdata/projects"); uniqueFileName = Guid.NewGuid().ToString() + "_" + photo.FileName; string filePath = Path.Combine(uploadsFolder, uniqueFileName); using (var fileStream = new FileStream(filePath, FileMode.Create)) { photo.CopyTo(fileStream); } Image image = new Image(); image.ImageId = Guid.NewGuid(); image.ImagePath = uniqueFileName; ProjectImages newImage = new ProjectImages(); newImage.Project = project; newImage.Image = image; context.ProjectImages.Add(newImage); context.SaveChanges(); } } return(uniqueFileName); }
public PostProcessWSA(BuildPostProcessArgs args, WSASDK sdk, string stagingArea = null) : base(args, sdk, stagingArea) { this._generateReferenceProjects = EditorUserBuildSettings.wsaGenerateReferenceProjects; this._images = new ProjectImages(); if (this._generateReferenceProjects) { MetroAssemblyCSharpCreator.ResetAssemblyCSharpProjectGUIDs(); } }
public PostProcessWSA(BuildPostProcessArgs args, WSASDK sdk, [Optional, DefaultParameterValue(null)] string stagingArea) : base(args, sdk, stagingArea) { this._generateReferenceProjects = EditorUserBuildSettings.wsaGenerateReferenceProjects; this._images = new ProjectImages(); if (this._generateReferenceProjects) { MetroAssemblyCSharpCreator.ResetAssemblyCSharpProjectGUIDs(); } }
public async Task <IActionResult> Edit(ProjectCreateViewModel projectViewModel) { if (ModelState.IsValid) { var project = await _context.Projects.Include(p => p.Categories).Include(p => p.Technologies).Include(p => p.Images).FirstOrDefaultAsync(p => p.Id == projectViewModel.Id); try { if (projectViewModel.Images != null && projectViewModel.Images.Count > 0) { if (project.Images != null) { foreach (var image in project.Images) { DeleteImage(image.ImageName); } } List <ProjectImages> images = new List <ProjectImages>(); foreach (var file in projectViewModel.Images) { var image = new ProjectImages() { ImageName = UploadImages(file) }; images.Add(image); } project.Images = images; } project.Categories = _context.Categories.Where(c => projectViewModel.CategoryId.Contains(c.Id)).ToList(); project.Technologies = _context.Technologies.Where(c => projectViewModel.TechnologyId.Contains(c.Id)).ToList(); _context.Update(project); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProjectExists(projectViewModel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } var categories = _context.Categories.ToList(); var technologies = _context.Technologies.ToList(); ViewBag.Categories = new SelectList(categories, "Id", "Name", projectViewModel.CategoryId); ViewBag.Technologies = new SelectList(technologies, "Id", "Name", projectViewModel.TechnologyId); return(View(projectViewModel)); }
public IHttpActionResult GetProjectImages(int id) { ProjectImages projectImages = db.ProjectImages.Find(id); if (projectImages == null) { return(NotFound()); } return(Ok(projectImages)); }
public IHttpActionResult PostProjectImages(ProjectImages projectImages) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ProjectImages.Add(projectImages); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = projectImages.Id }, projectImages)); }
public IHttpActionResult DeleteProjectImages(int id) { ProjectImages projectImages = db.ProjectImages.Find(id); if (projectImages == null) { return(NotFound()); } db.ProjectImages.Remove(projectImages); db.SaveChanges(); return(Ok(projectImages)); }
public async Task <IActionResult> Create(ProjectCreateViewModel projectCreateViewModel) { if (ModelState.IsValid) { Project project = new Project { Name = projectCreateViewModel.Name, Description = projectCreateViewModel.Description, Date = projectCreateViewModel.Date, Categories = _context.Categories.Where(c => projectCreateViewModel.CategoryId.Contains(c.Id)).ToList(), Technologies = _context.Technologies.Where(c => projectCreateViewModel.TechnologyId.Contains(c.Id)).ToList() }; if (projectCreateViewModel.Images != null) { foreach (var file in projectCreateViewModel.Images) { var image = new ProjectImages() { ImageName = UploadImages(file) }; project.Images.Add(image); } } _context.Add(project); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } var categories = _context.Categories.ToList(); var technologies = _context.Technologies.ToList(); ViewBag.Categories = new SelectList(categories, "Id", "Name", projectCreateViewModel.CategoryId); ViewBag.Technologies = new SelectList(technologies, "Id", "Name", projectCreateViewModel.TechnologyId); return(View(projectCreateViewModel)); }
private string ProcessUploadedFile(ProjectEditViewModel model) { string uniqueFileName = null; if (model.Images != null && model.Images.Count > 0) { foreach (IFormFile photo in model.Images) { string uploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "userdata/projects"); uniqueFileName = Guid.NewGuid().ToString() + "_" + photo.FileName; string filePath = Path.Combine(uploadsFolder, uniqueFileName); using (var fileStream = new FileStream(filePath, FileMode.Create)) { photo.CopyTo(fileStream); } var currentProject = context.Projects.AsNoTracking().Include(p => p.ProjectCategories).Single(p => p.Id == model.Project.Id); Image image = new Image(); image.ImageId = Guid.NewGuid(); image.ImagePath = uniqueFileName; ProjectImages newImage = new ProjectImages(); newImage.Project = currentProject; newImage.Image = image; using (var a = new AppDbContext(contextOptions)) { a.Projects.Include(p => p.ProjectImages).Single(p => p.Id == model.Project.Id).ProjectImages.Add(newImage); a.SaveChanges(); } } } return(uniqueFileName); }
/// <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(ClassificationsWhereYouAreTheKeyImageFileResourceInfo.Any() || CustomPageImages.Any() || DocumentLibraryDocuments.Any() || FieldDefinitionDataImages.Any() || FileResourceDatas.Any() || FirmaHomePageImages.Any() || FirmaPageImages.Any() || GeospatialAreaImages.Any() || OrganizationsWhereYouAreTheLogoFileResourceInfo.Any() || OrganizationImages.Any() || PerformanceMeasureImages.Any() || ProjectAttachmentsWhereYouAreTheAttachment.Any() || ProjectAttachmentUpdatesWhereYouAreTheAttachment.Any() || ProjectImages.Any() || ProjectImageUpdates.Any() || ReportTemplates.Any() || TenantAttributesWhereYouAreTheTenantBannerLogoFileResourceInfo.Any() || TenantAttributesWhereYouAreTheTenantFactSheetLogoFileResourceInfo.Any() || TenantAttributesWhereYouAreTheTenantSquareLogoFileResourceInfo.Any() || TenantAttributesWhereYouAreTheTenantStyleSheetFileResourceInfo.Any()); }
public void Create(string path, ProjectImages images) { this.Images = images; XDeclaration declaration = new XDeclaration("1.0", "utf-8", null); XDocument document = new XDocument(declaration, new object[0]); XElement content = this.CreatePackageElement(); document.Add(content); XElement element2 = this.CreateIdentityElement(); content.Add(element2); XElement element3 = this.CreatePhoneIdentityElement(); if (element3 != null) { content.Add(element3); } XElement element4 = this.CreatePropertiesElement(); content.Add(element4); XElement element5 = this.CreatePrerequisitesElement(); if (element5 != null) { content.Add(element5); } XElement element6 = this.CreateDependenciesElement(); if (element6 != null) { content.Add(element6); } XElement element7 = this.CreateResourcesElement(); content.Add(element7); XElement element8 = this.CreateApplicationsElement(); content.Add(element8); XElement element9 = this.CreateApplicationElement(); element8.Add(element9); XElement element10 = this.CreateVisualElementsElement(); element9.Add(element10); XElement element11 = this.CreateInitialRotationPreferenceElement(); if (element11 != null) { element10.Add(element11); } XElement element12 = this.CreateExtensionsElement(); if (element12 != null) { element9.Add(element12); } XElement element13 = this.CreateCapabilitiesElement(); if (element13 != null) { content.Add(element13); } using (StreamWriter writer = new StreamWriter(path, false, Encoding.UTF8)) { document.Save(writer); } this.Images = null; }
/// <summary> /// Active Dependent type names of this object /// </summary> public List <string> DependentObjectNames() { var dependentObjects = new List <string>(); if (GrantAllocationAwardLandownerCostShareLineItems.Any()) { dependentObjects.Add(typeof(GrantAllocationAwardLandownerCostShareLineItem).Name); } if (InteractionEventProjects.Any()) { dependentObjects.Add(typeof(InteractionEventProject).Name); } if (NotificationProjects.Any()) { dependentObjects.Add(typeof(NotificationProject).Name); } if (PerformanceMeasureActuals.Any()) { dependentObjects.Add(typeof(PerformanceMeasureActual).Name); } if (PerformanceMeasureExpecteds.Any()) { dependentObjects.Add(typeof(PerformanceMeasureExpected).Name); } if (ProjectClassifications.Any()) { dependentObjects.Add(typeof(ProjectClassification).Name); } if (ProjectCustomAttributes.Any()) { dependentObjects.Add(typeof(ProjectCustomAttribute).Name); } if (ProjectDocuments.Any()) { dependentObjects.Add(typeof(ProjectDocument).Name); } if (ProjectExemptReportingYears.Any()) { dependentObjects.Add(typeof(ProjectExemptReportingYear).Name); } if (ProjectExternalLinks.Any()) { dependentObjects.Add(typeof(ProjectExternalLink).Name); } if (ProjectFundingSources.Any()) { dependentObjects.Add(typeof(ProjectFundingSource).Name); } if (ProjectGrantAllocationExpenditures.Any()) { dependentObjects.Add(typeof(ProjectGrantAllocationExpenditure).Name); } if (ProjectGrantAllocationRequests.Any()) { dependentObjects.Add(typeof(ProjectGrantAllocationRequest).Name); } if (ProjectImages.Any()) { dependentObjects.Add(typeof(ProjectImage).Name); } if (ProjectInternalNotes.Any()) { dependentObjects.Add(typeof(ProjectInternalNote).Name); } if (ProjectLocations.Any()) { dependentObjects.Add(typeof(ProjectLocation).Name); } if (ProjectLocationStagings.Any()) { dependentObjects.Add(typeof(ProjectLocationStaging).Name); } if (ProjectNotes.Any()) { dependentObjects.Add(typeof(ProjectNote).Name); } if (ProjectOrganizations.Any()) { dependentObjects.Add(typeof(ProjectOrganization).Name); } if (ProjectPeople.Any()) { dependentObjects.Add(typeof(ProjectPerson).Name); } if (ProjectPriorityLandscapes.Any()) { dependentObjects.Add(typeof(ProjectPriorityLandscape).Name); } if (ProjectPrograms.Any()) { dependentObjects.Add(typeof(ProjectProgram).Name); } if (ProjectRegions.Any()) { dependentObjects.Add(typeof(ProjectRegion).Name); } if (ProjectTags.Any()) { dependentObjects.Add(typeof(ProjectTag).Name); } if (ProjectUpdateBatches.Any()) { dependentObjects.Add(typeof(ProjectUpdateBatch).Name); } if (Treatments.Any()) { dependentObjects.Add(typeof(Treatment).Name); } return(dependentObjects.Distinct().ToList()); }
/// <summary> /// Dependent type names of this entity /// </summary> public void DeleteChildren(DatabaseEntities dbContext) { foreach (var x in GrantAllocationAwardLandownerCostShareLineItems.ToList()) { x.DeleteFull(dbContext); } foreach (var x in InteractionEventProjects.ToList()) { x.DeleteFull(dbContext); } foreach (var x in NotificationProjects.ToList()) { x.DeleteFull(dbContext); } foreach (var x in PerformanceMeasureActuals.ToList()) { x.DeleteFull(dbContext); } foreach (var x in PerformanceMeasureExpecteds.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectClassifications.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectCustomAttributes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectDocuments.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectExemptReportingYears.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectExternalLinks.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectFundingSources.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectGrantAllocationExpenditures.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectGrantAllocationRequests.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectInternalNotes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectLocations.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectLocationStagings.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectNotes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectOrganizations.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectPeople.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectPriorityLandscapes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectPrograms.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectRegions.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectTags.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectUpdateBatches.ToList()) { x.DeleteFull(dbContext); } foreach (var x in Treatments.ToList()) { x.DeleteFull(dbContext); } }
public ActionResult SaveNewProject(AddProjectViewModel model) { if (!ModelState.IsValid) { var errorModel = new AddProjectViewModel() { Investor = model.Investor, InvestorEng = model.InvestorEng, Location = model.Location, LocationEng = model.LocationEng, Name = model.Name, isActive = model.isActive, NameEng = model.NameEng, SquareMeters = model.SquareMeters, SquareMetersEng = model.SquareMetersEng, Text = model.Text, TextEng = model.TextEng, Type = model.Type, TypeEng = model.TypeEng, YearBuilt = model.YearBuilt, YearBuiltEng = model.YearBuiltEng, YoutubeVideoLink = model.YoutubeVideoLink, Level = model.Level, LevelEng = model.LevelEng, MetaDescription = model.MetaDescription, MetaKeywords = model.MetaKeywords }; return(View("NewProject", errorModel)); } else { List <ProjectImages> images = new List <ProjectImages>(); string folderDate = DateTime.Now.ToString("yyyyMMddHHmmss"); Directory.CreateDirectory(Server.MapPath("~/DynamicContent/ProjectImages/Project" + folderDate)); var path = "~/DynamicContent/ProjectImages/Project" + folderDate; var pathToSave = "DynamicContent/ProjectImages/Project" + folderDate; var imgPath = ""; for (int i = 0; i < Request.Files.Count; i++) { var file = Request.Files[i]; if (file != null && file.ContentLength > 0) { var fileName = Path.GetFileName(file.FileName); ProjectImages fileDetail = new ProjectImages() { FileName = fileName, Extension = Path.GetExtension(fileName), FileNameNoExt = Path.GetFileNameWithoutExtension(fileName), FilePath = pathToSave }; images.Add(fileDetail); imgPath = Path.Combine(Server.MapPath(path), fileDetail.FileName); file.SaveAs(imgPath); } } var dbProject = new Project { DatePublished = DateTime.Now, YearBuiltEng = model.YearBuiltEng, Images = images, Investor = model.Investor, InvestorEng = model.InvestorEng, isActive = model.isActive, Location = model.Location, LocationEng = model.LocationEng, Name = model.Name, NameEng = model.NameEng, SquareMeters = model.SquareMeters, SquareMetersEng = model.SquareMetersEng, Text = model.Text, TextEng = model.TextEng, Type = model.Type, TypeEng = model.TypeEng, YearBuilt = model.YearBuilt, YoutubeVideoLink = model.YoutubeVideoLink, Level = model.Level, LevelEng = model.LevelEng, MetaDescription = model.MetaDescription, MetaKeywords = model.MetaKeywords }; ctx.Project.Add(dbProject); ctx.SaveChanges(); } return(RedirectToAction("Index")); }
/// <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(GrantAllocationAwardLandownerCostShareLineItems.Any() || InteractionEventProjects.Any() || NotificationProjects.Any() || PerformanceMeasureActuals.Any() || PerformanceMeasureExpecteds.Any() || ProjectClassifications.Any() || ProjectCustomAttributes.Any() || ProjectDocuments.Any() || ProjectExemptReportingYears.Any() || ProjectExternalLinks.Any() || ProjectFundingSources.Any() || ProjectGrantAllocationExpenditures.Any() || ProjectGrantAllocationRequests.Any() || ProjectImages.Any() || ProjectInternalNotes.Any() || ProjectLocations.Any() || ProjectLocationStagings.Any() || ProjectNotes.Any() || ProjectOrganizations.Any() || ProjectPeople.Any() || ProjectPriorityLandscapes.Any() || ProjectPrograms.Any() || ProjectRegions.Any() || ProjectTags.Any() || ProjectUpdateBatches.Any() || Treatments.Any()); }
/// <summary> /// Active Dependent type names of this object /// </summary> public List <string> DependentObjectNames() { var dependentObjects = new List <string>(); if (NotificationProjects.Any()) { dependentObjects.Add(typeof(NotificationProject).Name); } if (PerformanceMeasureActuals.Any()) { dependentObjects.Add(typeof(PerformanceMeasureActual).Name); } if (PerformanceMeasureExpecteds.Any()) { dependentObjects.Add(typeof(PerformanceMeasureExpected).Name); } if (ProjectAssessmentQuestions.Any()) { dependentObjects.Add(typeof(ProjectAssessmentQuestion).Name); } if (ProjectAttachments.Any()) { dependentObjects.Add(typeof(ProjectAttachment).Name); } if (ProjectClassifications.Any()) { dependentObjects.Add(typeof(ProjectClassification).Name); } if (ProjectContacts.Any()) { dependentObjects.Add(typeof(ProjectContact).Name); } if (ProjectCustomAttributes.Any()) { dependentObjects.Add(typeof(ProjectCustomAttribute).Name); } if (ProjectEvaluations.Any()) { dependentObjects.Add(typeof(ProjectEvaluation).Name); } if (ProjectExemptReportingYears.Any()) { dependentObjects.Add(typeof(ProjectExemptReportingYear).Name); } if (ProjectExternalLinks.Any()) { dependentObjects.Add(typeof(ProjectExternalLink).Name); } if (ProjectFundingSourceBudgets.Any()) { dependentObjects.Add(typeof(ProjectFundingSourceBudget).Name); } if (ProjectFundingSourceExpenditures.Any()) { dependentObjects.Add(typeof(ProjectFundingSourceExpenditure).Name); } if (ProjectGeospatialAreas.Any()) { dependentObjects.Add(typeof(ProjectGeospatialArea).Name); } if (ProjectGeospatialAreaTypeNotes.Any()) { dependentObjects.Add(typeof(ProjectGeospatialAreaTypeNote).Name); } if (ProjectImages.Any()) { dependentObjects.Add(typeof(ProjectImage).Name); } if (ProjectInternalNotes.Any()) { dependentObjects.Add(typeof(ProjectInternalNote).Name); } if (ProjectLocations.Any()) { dependentObjects.Add(typeof(ProjectLocation).Name); } if (ProjectLocationStagings.Any()) { dependentObjects.Add(typeof(ProjectLocationStaging).Name); } if (ProjectNoFundingSourceIdentifieds.Any()) { dependentObjects.Add(typeof(ProjectNoFundingSourceIdentified).Name); } if (ProjectNotes.Any()) { dependentObjects.Add(typeof(ProjectNote).Name); } if (ProjectOrganizations.Any()) { dependentObjects.Add(typeof(ProjectOrganization).Name); } if (ProjectProjectStatuses.Any()) { dependentObjects.Add(typeof(ProjectProjectStatus).Name); } if (ProjectRelevantCostTypes.Any()) { dependentObjects.Add(typeof(ProjectRelevantCostType).Name); } if (ProjectTags.Any()) { dependentObjects.Add(typeof(ProjectTag).Name); } if (ProjectUpdateBatches.Any()) { dependentObjects.Add(typeof(ProjectUpdateBatch).Name); } if (SecondaryProjectTaxonomyLeafs.Any()) { dependentObjects.Add(typeof(SecondaryProjectTaxonomyLeaf).Name); } if (TechnicalAssistanceRequests.Any()) { dependentObjects.Add(typeof(TechnicalAssistanceRequest).Name); } return(dependentObjects.Distinct().ToList()); }
public ReportTemplateProjectImageModel GetProjectKeyPhoto() { var projectKeyPhoto = ProjectImages.FirstOrDefault(x => x.IsKeyPhoto == true); return(projectKeyPhoto != null ? new ReportTemplateProjectImageModel(projectKeyPhoto) : null); }
public List <ReportTemplateProjectImageModel> GetProjectImages() { return(ProjectImages.Select(x => new ReportTemplateProjectImageModel(x)).ToList()); }
/// <summary> /// Active Dependent type names of this object /// </summary> public List <string> DependentObjectNames() { var dependentObjects = new List <string>(); if (ClassificationsWhereYouAreTheKeyImageFileResourceInfo.Any()) { dependentObjects.Add(typeof(Classification).Name); } if (CustomPageImages.Any()) { dependentObjects.Add(typeof(CustomPageImage).Name); } if (DocumentLibraryDocuments.Any()) { dependentObjects.Add(typeof(DocumentLibraryDocument).Name); } if (FieldDefinitionDataImages.Any()) { dependentObjects.Add(typeof(FieldDefinitionDataImage).Name); } if (FileResourceDatas.Any()) { dependentObjects.Add(typeof(FileResourceData).Name); } if (FirmaHomePageImages.Any()) { dependentObjects.Add(typeof(FirmaHomePageImage).Name); } if (FirmaPageImages.Any()) { dependentObjects.Add(typeof(FirmaPageImage).Name); } if (GeospatialAreaImages.Any()) { dependentObjects.Add(typeof(GeospatialAreaImage).Name); } if (OrganizationsWhereYouAreTheLogoFileResourceInfo.Any()) { dependentObjects.Add(typeof(Organization).Name); } if (OrganizationImages.Any()) { dependentObjects.Add(typeof(OrganizationImage).Name); } if (PerformanceMeasureImages.Any()) { dependentObjects.Add(typeof(PerformanceMeasureImage).Name); } if (ProjectAttachmentsWhereYouAreTheAttachment.Any()) { dependentObjects.Add(typeof(ProjectAttachment).Name); } if (ProjectAttachmentUpdatesWhereYouAreTheAttachment.Any()) { dependentObjects.Add(typeof(ProjectAttachmentUpdate).Name); } if (ProjectImages.Any()) { dependentObjects.Add(typeof(ProjectImage).Name); } if (ProjectImageUpdates.Any()) { dependentObjects.Add(typeof(ProjectImageUpdate).Name); } if (ReportTemplates.Any()) { dependentObjects.Add(typeof(ReportTemplate).Name); } if (TenantAttributesWhereYouAreTheTenantBannerLogoFileResourceInfo.Any()) { dependentObjects.Add(typeof(TenantAttribute).Name); } if (TenantAttributesWhereYouAreTheTenantFactSheetLogoFileResourceInfo.Any()) { dependentObjects.Add(typeof(TenantAttribute).Name); } if (TenantAttributesWhereYouAreTheTenantSquareLogoFileResourceInfo.Any()) { dependentObjects.Add(typeof(TenantAttribute).Name); } if (TenantAttributesWhereYouAreTheTenantStyleSheetFileResourceInfo.Any()) { dependentObjects.Add(typeof(TenantAttribute).Name); } return(dependentObjects.Distinct().ToList()); }
/// <summary> /// Dependent type names of this entity /// </summary> public void DeleteChildren(DatabaseEntities dbContext) { foreach (var x in ClassificationsWhereYouAreTheKeyImageFileResourceInfo.ToList()) { x.DeleteFull(dbContext); } foreach (var x in CustomPageImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in DocumentLibraryDocuments.ToList()) { x.DeleteFull(dbContext); } foreach (var x in FieldDefinitionDataImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in FileResourceDatas.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 GeospatialAreaImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in OrganizationsWhereYouAreTheLogoFileResourceInfo.ToList()) { x.DeleteFull(dbContext); } foreach (var x in OrganizationImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in PerformanceMeasureImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectAttachmentsWhereYouAreTheAttachment.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectAttachmentUpdatesWhereYouAreTheAttachment.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 ReportTemplates.ToList()) { x.DeleteFull(dbContext); } foreach (var x in TenantAttributesWhereYouAreTheTenantBannerLogoFileResourceInfo.ToList()) { x.DeleteFull(dbContext); } foreach (var x in TenantAttributesWhereYouAreTheTenantFactSheetLogoFileResourceInfo.ToList()) { x.DeleteFull(dbContext); } foreach (var x in TenantAttributesWhereYouAreTheTenantSquareLogoFileResourceInfo.ToList()) { x.DeleteFull(dbContext); } foreach (var x in TenantAttributesWhereYouAreTheTenantStyleSheetFileResourceInfo.ToList()) { x.DeleteFull(dbContext); } }
public ProjectImage GetKeyPhoto() { return(ProjectImages.SingleOrDefault(x => x.IsKeyPhoto)); }
/// <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()); }
public List <ReportTemplateProjectImageModel> GetProjectImagesByTiming(string timingName) { return(ProjectImages.Where(x => x.ProjectImageTiming.ProjectImageTimingName == timingName).Select(x => new ReportTemplateProjectImageModel(x)).ToList()); }
/// <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(NotificationProjects.Any() || PerformanceMeasureActuals.Any() || PerformanceMeasureExpecteds.Any() || ProjectAssessmentQuestions.Any() || ProjectAttachments.Any() || ProjectClassifications.Any() || ProjectContacts.Any() || ProjectCustomAttributes.Any() || ProjectEvaluations.Any() || ProjectExemptReportingYears.Any() || ProjectExternalLinks.Any() || ProjectFundingSourceBudgets.Any() || ProjectFundingSourceExpenditures.Any() || ProjectGeospatialAreas.Any() || ProjectGeospatialAreaTypeNotes.Any() || ProjectImages.Any() || ProjectInternalNotes.Any() || ProjectLocations.Any() || ProjectLocationStagings.Any() || ProjectNoFundingSourceIdentifieds.Any() || ProjectNotes.Any() || ProjectOrganizations.Any() || ProjectProjectStatuses.Any() || ProjectRelevantCostTypes.Any() || ProjectTags.Any() || ProjectUpdateBatches.Any() || SecondaryProjectTaxonomyLeafs.Any() || TechnicalAssistanceRequests.Any()); }
/// <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> /// Dependent type names of this entity /// </summary> public void DeleteChildren(DatabaseEntities dbContext) { foreach (var x in NotificationProjects.ToList()) { x.DeleteFull(dbContext); } foreach (var x in PerformanceMeasureActuals.ToList()) { x.DeleteFull(dbContext); } foreach (var x in PerformanceMeasureExpecteds.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectAssessmentQuestions.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectAttachments.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectClassifications.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectContacts.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectCustomAttributes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectEvaluations.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectExemptReportingYears.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectExternalLinks.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectFundingSourceBudgets.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectFundingSourceExpenditures.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectGeospatialAreas.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectGeospatialAreaTypeNotes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectInternalNotes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectLocations.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectLocationStagings.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectNoFundingSourceIdentifieds.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectNotes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectOrganizations.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectProjectStatuses.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectRelevantCostTypes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectTags.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectUpdateBatches.ToList()) { x.DeleteFull(dbContext); } foreach (var x in SecondaryProjectTaxonomyLeafs.ToList()) { x.DeleteFull(dbContext); } foreach (var x in TechnicalAssistanceRequests.ToList()) { x.DeleteFull(dbContext); } }
public ActionResult SaveEditedProject(EditProjectViewModel model) { if (!ModelState.IsValid) { var errorModel = new EditProjectViewModel() { Id = model.Id, Investor = model.Investor, InvestorEng = model.InvestorEng, Location = model.Location, LocationEng = model.LocationEng, Name = model.Name, isActive = model.isActive, NameEng = model.NameEng, SquareMeters = model.SquareMeters, SquareMetersEng = model.SquareMetersEng, Text = model.Text, TextEng = model.TextEng, Type = model.Type, TypeEng = model.TypeEng, YearBuilt = model.YearBuilt, YearBuiltEng = model.YearBuiltEng, YoutubeVideoLink = model.YoutubeVideoLink, Level = model.Level, LevelEng = model.LevelEng, MetaDescription = model.MetaDescription, MetaKeywords = model.MetaKeywords }; return(View("EditProject", errorModel)); } else { var proDB = ctx.Project.Find(model.Id); List <ProjectImages> images = new List <ProjectImages>(); var pathToSave = ctx.ProjectImages.Where(pimg => pimg.ProjectId == model.Id).FirstOrDefault().FilePath; var path = "~/" + pathToSave; var imgPath = ""; for (int i = 0; i < Request.Files.Count; i++) { var file = Request.Files[i]; if (file != null && file.ContentLength > 0) { var fileName = Path.GetFileName(file.FileName); ProjectImages fileDetail = new ProjectImages() { FileName = fileName, Extension = Path.GetExtension(fileName), FileNameNoExt = Path.GetFileNameWithoutExtension(fileName), FilePath = pathToSave }; images.Add(fileDetail); imgPath = Path.Combine(Server.MapPath(path), fileDetail.FileName); file.SaveAs(imgPath); } } var newImages = proDB.Images.Concat(images).ToList(); proDB.Images = newImages; proDB.Investor = model.Investor; proDB.InvestorEng = model.InvestorEng; proDB.isActive = model.isActive; proDB.Location = model.Location; proDB.LocationEng = model.LocationEng; proDB.Name = model.Name; proDB.NameEng = model.NameEng; proDB.SquareMeters = model.SquareMeters; proDB.SquareMetersEng = model.SquareMetersEng; proDB.Text = model.Text; proDB.TextEng = model.TextEng; proDB.Type = model.Type; proDB.TypeEng = model.TypeEng; proDB.YearBuilt = model.YearBuilt; proDB.YearBuiltEng = model.YearBuiltEng; proDB.YoutubeVideoLink = model.YoutubeVideoLink; proDB.Level = model.Level; proDB.LevelEng = model.LevelEng; proDB.MetaDescription = model.MetaDescription; proDB.MetaKeywords = model.MetaKeywords; ctx.SaveChanges(); } return(RedirectToAction("EditProject", new { id = model.Id })); }