You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
3.9 KiB

using Microsoft.Office.Interop.Excel;
using Newtonsoft.Json.Linq;
using Syncfusion.Windows.Forms.Tools.Win32API;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
namespace OnDoc.Klassen
{
public enum EDK_ActionType
{
AnzeigePartnerdossier = 1,
DokumentAnzeige = 2,
DokumentErstellung = 3,
DokumentBearbeitung = 4,
Statusmutation = 5,
HostDokumentAnzeige = 6,
UVMDokumentanzeige = 7,
ZVDokumentanzeige = 8,
DokLoeschung = 9,
AusHyperlink = 10
}
public class EDK_Parameters
{
private string name { get; set; }
private string value { get; set; }
public EDK_Parameters(string name, string value)
{
this.name = name;
this.value = value;
}
}
public class EDK_Dokumentwerte
{
private string name { get; set; }
private string value { get; set; }
public EDK_Dokumentwerte (string name, string value)
{
this.name=name;
this.value=value;
}
}
public static class EDK_Data
{
public static EDK_ActionType action { get; set; }
public static string creatortg { get; set; }
public static string source { get; set; }
public static bool executed { get; set; }
public static bool toexecute { get; set; }
public static List<EDK_Parameters> parameters { get; set; }
public static List<EDK_Dokumentwerte> dokumentwerte { get; set; }
public static void Load_EDK_File(string filename)
{
//XmlSerializer serializer = new XmlSerializer(typeof(Action));
//using (StringReader reader = new StringReader(filename))
//{
// var test = (Action)serializer.Deserialize(reader);
//}
var doc = new XmlDocument();
try
{
doc.Load(filename);
}
catch (Exception ex)
{
}
// read header elements
action = (EDK_ActionType)Enum.Parse(typeof(EDK_ActionType), doc.SelectSingleNode("action/actionId").InnerText, true);
creatortg = doc.SelectSingleNode("action/creatorTg").InnerText;
source = doc.SelectSingleNode("action/sourceApplication").InnerText;
XmlElement RootNode = doc.DocumentElement;
XmlNodeList nodeList = RootNode.ChildNodes;
XmlNodeList dokwerte = RootNode.LastChild.ChildNodes;
List<EDK_Parameters> Params = new List<EDK_Parameters>();
List<EDK_Dokumentwerte> Dokwerte = new List<EDK_Dokumentwerte>();
if (nodeList.Count > 0)
{
string value;
string name;
var loopTo = nodeList.Count - 1;
for (int i = 0; i < nodeList.Count - 1; i++)
{
value = nodeList.Item(i).InnerText;
name = nodeList.Item(i).LocalName;
Params.Add(new EDK_Parameters(name, value));
}
}
parameters = Params;
if (dokwerte.Count > 0)
{
for (int i = 0; i < dokwerte.Count - 1; i++)
{
XmlNodeList XNode = dokwerte[i].ChildNodes;
string value;
string name;
value = XNode[1].InnerText;
name = XNode[0].InnerText;
Dokwerte.Add(new EDK_Dokumentwerte(name, value));
}
dokumentwerte = Dokwerte;
if (parameters.Count > 0)
{
executed = false;
toexecute = true;
}
}
}
}
}