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.
179 lines
7.7 KiB
179 lines
7.7 KiB
using Database;
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
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 Windows.Media.Streaming.Adaptive;
|
|
using static System.Net.WebRequestMethods;
|
|
namespace OnDoc.Klassen
|
|
{
|
|
public static class AppParams
|
|
{
|
|
public static string connectionstring { get; set; }
|
|
public static string logconnectionstring { 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 CurrentTGNummer { get; set; } = "";
|
|
public static string RESTURI { get; set; } = "";//"http://localhost:2032/";
|
|
public static string apikey { get; set; } = "";
|
|
|
|
public static string wordprintmacro { get; set; } = "";
|
|
public static string vbvorlagenmanagement { get; set; } = "No";
|
|
|
|
public static string barcodefont { get; set; } = "";
|
|
public static string barcodefontsize { get; set; } = "";
|
|
public static string barcodetextposition { get; set; } = "";
|
|
public static bool isSysadmin { get; set; } = false;
|
|
public static string currenttgnummer { get; set; }="";
|
|
|
|
public static string ZusatzFont { get; set; } = "";
|
|
public static string ZusatzFontSize { get; set; } = "";
|
|
|
|
public static string EDOKAPath { get; set; } = "";
|
|
|
|
public static int OfficeSpleep1 { get; set; } = 500;
|
|
public static int OfficeSpleep2 { get; set; } = 1000;
|
|
static AppParams()
|
|
{
|
|
|
|
}
|
|
|
|
public static void init()
|
|
{
|
|
|
|
string startuppath = AppDomain.CurrentDomain.BaseDirectory;
|
|
connectionstring = System.IO.File.ReadAllText(startuppath + @"\ondocconn.cfg");
|
|
connectionstring = StringCipher.Decrypt(connectionstring, "i%!k!7pab%bNLdA5hE4pkR4XaB%E^jB3d9tHuQ4pbF&BZjF7SB#WBWit5#HrbJiLrLVm");
|
|
logconnectionstring = System.IO.File.ReadAllText(startuppath + @"\logconn.cfg");
|
|
logconnectionstring = StringCipher.Decrypt(logconnectionstring, "i%!k!7pab%bNLdA5hE4pkR4XaB%E^jB3d9tHuQ4pbF&BZjF7SB#WBWit5#HrbJiLrLVm");
|
|
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";
|
|
|
|
apikey = System.IO.File.ReadAllText(startuppath + @"\apikey.cfg");
|
|
apikey = StringCipher.Decrypt(apikey, "PBod8b%s@c9ib7Lws#na5sGM2trugrx3h!oyB^y!Bc%fHEYUT3QvTVr6sAaAr9FoQWzb");
|
|
UseAPI = Properties.Settings.Default.UseAPI;
|
|
RESTURI = Properties.Settings.Default.RESTURI;
|
|
//apikey = Properties.Settings.Default.apikey;
|
|
wordprintmacro = Properties.Settings.Default.StandardWordDruckMakro;
|
|
vbvorlagenmanagement = Properties.Settings.Default.VBVorlagenmanagement;
|
|
barcodefont = Properties.Settings.Default.BarcodeFont;
|
|
barcodefontsize=Properties.Settings.Default.BarcodeFontSize;
|
|
barcodetextposition = Properties.Settings.Default.BarodeTextPosition;
|
|
ZusatzFont = Properties.Settings.Default.ZusatzFont;
|
|
ZusatzFontSize = Properties.Settings.Default.ZusatzFontSize;
|
|
EDOKAPath=Properties.Settings.Default.edokapath;
|
|
}
|
|
}
|
|
|
|
public static class ToastMessage
|
|
{
|
|
public static void ShowToast(string title, string message)
|
|
{
|
|
return;
|
|
// 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 string unterschriftenpruefung { get; set; } = "No";
|
|
public static Boolean parseparams()
|
|
{
|
|
if (executed) return false;
|
|
string sparam = sourceparam.Substring(sourceparam.IndexOf('?') + 1, sourceparam.Length - (sourceparam.IndexOf('?') + 1));
|
|
if (sparam.ToLower() == "ucheck")
|
|
{
|
|
unterschriftenpruefung = "Yes";
|
|
return true;
|
|
}
|
|
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" && value.ToLower() != "ucheck")
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
|
|
|
|
}
|