public ErrorBatch(Email email, MailMessage message, MailboxProfile profile) { Documents = new List <Document>(); this.emailID = email.EmailID; this.batchNumber = email.BatchNumber; this.profile = profile; this.errorreason = email.Status == "Rejected" ?string.Join(",", email.Errors.Descendants("Error") .Select(e => (string)e.Attribute("fileName") + " - " + (string)e.Attribute("reason")) .ToList()) : "Unsupported File Type"; var folder = String.Format(String.IsNullOrWhiteSpace(profile.OutputFolderFormat) ? "{0:00000000}" : profile.OutputFolderFormat, emailID); if (profile.BatchStyle == BatchStyle.ImagesOnly || !profile.BatchClassSubfolder) { OutputPath = Path.Combine(profile.ErrorOutputPath, folder); } else { OutputPath = Path.Combine(profile.ErrorOutputPath, String.Format(@"{0}\{1}", profile.BatchClassName, folder)); } FileSystemHelper.CleanDirectory(OutputPath, true); SaveMessage(email); InitialiseFields(message); //ExtractDocuments(message, false); FileSystemHelper.DeleteDirectory(Path.Combine(OutputPath, "temp"), true); }
public Batch(Email email, MailMessage message, MailboxProfile profile) { Documents = new List <Document>(); this.emailID = email.EmailID; this.batchNumber = email.BatchNumber; this.profile = profile; var folder = String.Format(String.IsNullOrWhiteSpace(profile.OutputFolderFormat) ? "{0:00000000}" : profile.OutputFolderFormat, emailID); if (profile.BatchStyle == BatchStyle.ImagesOnly || !profile.BatchClassSubfolder) { OutputPath = Path.Combine(profile.OutputPath, folder); } else { OutputPath = Path.Combine(profile.OutputPath, String.Format(@"{0}\{1}", profile.BatchClassName, folder)); } FileSystemHelper.CleanDirectory(OutputPath, true); SaveMessage(email); InitialiseFields(message); ExtractDocuments(message, false); FileSystemHelper.DeleteDirectory(Path.Combine(OutputPath, "temp"), true); }
private void Reset() { FileSystemHelper.CleanDirectory(saveToPath, true); Pages = null; }