Ejemplo n.º 1
0
        public static void ProcessFileUpload(ref JobApplicationAttachmentUploadItem uploadItem)
        {
            var libName = FileUploadLibraryGet(uploadItem.AttachmentType);

            try
            {
                var response = UploadToAmazonS3(Guid.Parse(uploadItem.Id), _siteSettingsHelper.GetAmazonS3ProviderName(), libName, uploadItem.PathToAttachment, uploadItem.FileStream);
                if (response != null && response.Success)
                {
                    uploadItem.FileUrl = null;
                    uploadItem.Status  = "Completed";
                }
                else
                {
                    uploadItem.Status  = "Failed";
                    uploadItem.Message = response?.Errors.FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                uploadItem.Status  = "Failed";
                uploadItem.Message = ex.Message;
                Log.Write($"Unable to upload document to the Bucket folder {libName}. " + ex.Message, ConfigurationPolicy.ErrorLog);
            }
        }
Ejemplo n.º 2
0
        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);
        }