using Database; using Microsoft.Office.Interop.Word; using Microsoft.Toolkit.Uwp.Notifications; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Policy; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using static System.Net.WebRequestMethods; namespace OnDoc.Klassen { public static class AppParams { public static string connectionstring { get; set; } public static string tempdir { get; set; } public static string Version { get; set; } = "6.0"; public static string UseAPI { get; set; } = "FALSE"; public static int CurrentMitarbieter { get; set; } public static string RESTURI { get; set; } = "";//"http://localhost:2032/"; static AppParams() { } public static void init() { string startuppath = AppDomain.CurrentDomain.BaseDirectory; connectionstring = System.IO.File.ReadAllText(startuppath + @"\edokaconn.cfg"); DB db = new DB(connectionstring); db.Get_Tabledata("Select * from applikation where applikationsnr = 1", false, true); tempdir = db.dsdaten.Tables[0].Rows[0]["pfad_temporaer_dokumente"].ToString(); db = null; StaticValues.UserID = "Stefan Hutter"; } } public static class ToastMessage { public static void ShowToast(string title, string message) { new ToastContentBuilder() .AddArgument("Datensicherung", "Datensicherung") .AddText(title) .AddText(message) .Show(); } } public static class ExternalCall { public static bool executed { get; set; } = false; public static string function { get; set; } = ""; public static string partnernr { get; set; } = ""; public static string struktur { get; set; } = ""; public static string sourceparam { get; set; } = ""; public static string dokumenttypnr { get; set; } = "0"; public static string Interaktion { get; set; } = "Yes"; public static string showdoc { get; set; } = "Yes"; public static Boolean parseparams() { if (executed) return false; string sparam = sourceparam.Substring(sourceparam.IndexOf('?') + 1, sourceparam.Length - (sourceparam.IndexOf('?') + 1)); sparam = Uri.UnescapeDataString(sparam); executed = true; sourceparam = ""; string[] istring = sparam.Split('&'); string key = ""; string value = ""; foreach (string s in istring) { key = s; value = key.Substring(key.IndexOf("=") + 1, key.Length - (key.IndexOf("=") + 1)); key = key.Substring(0, key.IndexOf("=")); //MessageBox.Show(key + " " + value); switch (key.ToLower()) { case "partnernr": partnernr = value; DB db = new DB(AppParams.connectionstring); db.Get_Tabledata("Select top 1 nrpar00 from partner where nrpar00=" + partnernr.ToString(), false, true); if (db.dsdaten.Tables[0].Rows.Count < 1) { MessageBox.Show("Partnernr:" + partnernr.ToString() + " ist nicht vorhanden", "Parameterfehler", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } db = null; break; case "funktion": function = value; if (value.ToLower() != "createdoc" && value.ToLower() != "createpac") { MessageBox.Show("Funktion ist ungültig: " + value, "Parameterfehler", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } break; case "vorlagenr": dokumenttypnr = value; DB db1 = new DB(AppParams.connectionstring); db1.Get_Tabledata("Select top 1 dokumenttypnr from dokumenttyp where dokumenttypnr=" + dokumenttypnr.ToString(), false, true); if (db1.dsdaten.Tables[0].Rows.Count < 1) { MessageBox.Show("Dokumenttyp Nr.:" + dokumenttypnr.ToString() + " ist nicht vorhanden", "Parameterfehler", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } db1 = null; break; case "struktur": struktur = value; break; case "interaktion": Interaktion = value; break; case "showdoc": showdoc = value; break; } } return true; } } }