public static bool DeleteFromAmazonS3(string providerName, JobApplicationAttachmentType attachmentType, string itemTitle) { SiteSettingsHelper siteSettingsHelper = new SiteSettingsHelper(); S3FilemanagerService fileManagerService = new S3FilemanagerService(_siteSettingsHelper.GetAmazonS3RegionEndpoint(), _siteSettingsHelper.GetAmazonS3AccessKeyId(), _siteSettingsHelper.GetAmazonS3SecretKey()); var response = fileManagerService.DeleteObjectFromProvider <S3FileManagerResponse, S3FileManagerRequest>( new S3FileManagerRequest { FileName = itemTitle, Directory = _siteSettingsHelper.GetAmazonS3UrlName() + "/" + JobApplicationAttachmentSettings.PROFILE_RESUME_UPLOAD_LIBRARY, S3BucketName = _siteSettingsHelper.GetAmazonS3BucketName() }); return(response != null ? response.Success : false); }
public static string FileUploadLibraryGet(JobApplicationAttachmentType attachmentType) { switch (attachmentType) { case JobApplicationAttachmentType.Resume: return(JobApplicationAttachmentSettings.APPLICATION_RESUME_UPLOAD_LIBRARY); case JobApplicationAttachmentType.Coverletter: return(JobApplicationAttachmentSettings.APPLICATION_COVERLETTER_UPLOAD_LIBRARY); case JobApplicationAttachmentType.ProfileResume: return(JobApplicationAttachmentSettings.PROFILE_RESUME_UPLOAD_LIBRARY); case JobApplicationAttachmentType.ProfileCoverletter: return(JobApplicationAttachmentSettings.PROFILE_COVERLETTER_UPLOAD_LIBRARY); default: return(null); } }
public static string FetchFromAmazonS3(string providerName, JobApplicationAttachmentType attachmentType, string itemTitle) { var libName = FileUploadLibraryGet(attachmentType); LibrariesManager librariesManager = LibrariesManager.GetManager(providerName); var docLibs = librariesManager.GetDocumentLibraries(); foreach (var lib in docLibs) { if (lib.Title.ToLower() == libName) { var items = lib.Items(); var document = lib.Items().Where(item => item.Title.Contains(itemTitle)).FirstOrDefault(); if (document != null && document.Status != ContentLifecycleStatus.Deleted) { return(document.Url); } } } return(null); }
public static string GetAttachmentPath(List <JobApplicationAttachmentUploadItem> attachmentItems, JobApplicationAttachmentType attachmentType) { JobApplicationAttachmentUploadItem item = attachmentItems.Where(c => c.AttachmentType == attachmentType).FirstOrDefault(); Log.Write("In GetAttachmentPath method item", ConfigurationPolicy.ErrorLog); if (item == null) { return(null); } return(item.PathToAttachment); }