temp
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DakotaSystemFile.cs" />
|
||||
<Compile Include="FehlerXml.cs" />
|
||||
<Compile Include="ResultXml.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="XmlFileConverter.cs" />
|
||||
|
||||
@@ -198,7 +198,12 @@ namespace DakotaSender
|
||||
error = e.ToString();
|
||||
}
|
||||
|
||||
if (error is string)
|
||||
if (error == string.Empty)
|
||||
{
|
||||
// Dakota läuft bereits.
|
||||
// Nächster Run
|
||||
}
|
||||
else if (error is string)
|
||||
{
|
||||
PrintLine(error);
|
||||
MoveQueueToFailed(file);
|
||||
@@ -206,8 +211,12 @@ namespace DakotaSender
|
||||
if (copied)
|
||||
DeleteDakotaFile(file);
|
||||
|
||||
CreateResultXmlFile(file, error);
|
||||
CreateResultFehlerXmlFile(file, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateResultSuccessXmlFile(file);
|
||||
}
|
||||
}
|
||||
static string ProcessFile(DakotaSystemFile file, out bool copied)
|
||||
{
|
||||
@@ -233,7 +242,7 @@ namespace DakotaSender
|
||||
|
||||
DeleteDakotaFile(file);
|
||||
|
||||
return null;
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
if (!AcceptSendCodes.Contains(code))
|
||||
@@ -243,24 +252,29 @@ namespace DakotaSender
|
||||
DeleteQueueFile(file);
|
||||
return null;
|
||||
}
|
||||
static void CreateResultXmlFile(DakotaSystemFile file, string error)
|
||||
{
|
||||
Print("Speichere Fehler als Xml. ");
|
||||
|
||||
var fehler = new FehlerXml();
|
||||
static void CreateResultSuccessXmlFile(DakotaSystemFile file)
|
||||
=> CreateResultXmlFile(file, "Dakota Erfolg", "", 0);
|
||||
static void CreateResultFehlerXmlFile(DakotaSystemFile file, string error)
|
||||
=> CreateResultXmlFile(file, "Dakota Fehler", error, 1);
|
||||
static void CreateResultXmlFile(DakotaSystemFile file, string title, string nachricht, int fehler_level)
|
||||
{
|
||||
Print($"Speichere {title} als Xml. ");
|
||||
|
||||
fehler.Datum = DateTime.Now;
|
||||
fehler.Titel = "Dakota Fehler";
|
||||
fehler.Nachricht = error;
|
||||
fehler.Level = 1;
|
||||
fehler.Oid = file.ProtokollOid;
|
||||
var result = new ResultXml();
|
||||
|
||||
result.Datum = DateTime.Now;
|
||||
result.Titel = title;
|
||||
result.Nachricht = nachricht;
|
||||
result.Level = fehler_level;
|
||||
result.Oid = file.ProtokollOid;
|
||||
|
||||
var folder = GetResultFolderTenant(file.Tenant).FullName;
|
||||
var path = Path.Combine(folder, $"P{file.ProtokollOid}.xml");
|
||||
|
||||
Print($"Path: {path}");
|
||||
Print($"Path: {path}. ");
|
||||
|
||||
XmlFileConverter.Save(fehler, path);
|
||||
XmlFileConverter.Save(result, path);
|
||||
|
||||
PrintLine("Ok.");
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ using System.Xml.Serialization;
|
||||
namespace DakotaSender
|
||||
{
|
||||
[Serializable()]
|
||||
[XmlRoot("Fehler")]
|
||||
public class FehlerXml
|
||||
[XmlRoot("Result")]
|
||||
public class ResultXml
|
||||
{
|
||||
[XmlAttribute("Oid")]
|
||||
public long Oid { get; set; }
|
||||
@@ -12,10 +12,10 @@ namespace DakotaSender
|
||||
/// <summary>
|
||||
/// Saves to an xml file
|
||||
/// </summary>
|
||||
/// <param name="FileName">File path of the new xml file</param>
|
||||
public static void Save<T>(T obj, string FileName) where T : class
|
||||
/// <param name="fileName">File path of the new xml file</param>
|
||||
public static void Save<T>(T obj, string fileName) where T : class
|
||||
{
|
||||
using (var writer = new System.IO.StreamWriter(FileName))
|
||||
using (var writer = new System.IO.StreamWriter(fileName))
|
||||
{
|
||||
var serializer = new XmlSerializer(obj.GetType());
|
||||
serializer.Serialize(writer, obj);
|
||||
|
||||
Reference in New Issue
Block a user