Bug fix - GetHeaderId

This commit is contained in:
Mike Phares 2024-05-22 18:14:13 -07:00
parent 93555ac94a
commit 80150959cc
2 changed files with 20 additions and 8 deletions

View File

@ -78,20 +78,32 @@ public partial class WS
{ {
foreach (Attachment attachment in headerAttachments) foreach (Attachment attachment in headerAttachments)
{ {
directory = Path.GetDirectoryName(attachment.HeaderIdDirectory) ?? throw new Exception(); directory = Path.Combine(Path.GetDirectoryName(attachment.HeaderIdDirectory), attachment.AttachmentId) ?? throw new Exception();
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.AttachmentId, attachment.DestinationFileName), overwrite: true); if (!Directory.Exists(directory))
AttachFile(url, attachment); _ = Directory.CreateDirectory(directory);
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true);
} }
} }
if (dataAttachments is not null) if (dataAttachments is not null)
{ {
foreach (Attachment attachment in dataAttachments) foreach (Attachment attachment in dataAttachments)
{ {
directory = Path.GetDirectoryName(attachment.HeaderIdDirectory) ?? throw new Exception(); directory = Path.Combine(Path.GetDirectoryName(attachment.HeaderIdDirectory.Replace("Header", "Data")), attachment.AttachmentId) ?? throw new Exception();
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.AttachmentId, attachment.DestinationFileName), overwrite: true); if (!Directory.Exists(directory))
AttachFile(url, attachment); _ = Directory.CreateDirectory(directory);
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true);
} }
} }
if (headerAttachments is not null)
{
foreach (Attachment attachment in headerAttachments)
AttachFile(url, attachment);
}
if (dataAttachments is not null)
{
foreach (Attachment attachment in dataAttachments)
AttachFile(url, attachment);
}
//MessageBox.Show(r.ToString()); //MessageBox.Show(r.ToString());
} }
catch (Exception e) catch (Exception e)

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.52.0.0")] [assembly: AssemblyVersion("2.56.0.0")]
[assembly: AssemblyFileVersion("2.52.0.0")] [assembly: AssemblyFileVersion("2.56.0.0")]