update 20241201
This commit is contained in:
147
Client - Kopie/Klassen/clsAppParams.cs
Normal file
147
Client - Kopie/Klassen/clsAppParams.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using Database;
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
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 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/";
|
||||
public static string apikey { get; set; } = "";
|
||||
|
||||
public static string wordprintmacro { get; set; } = "";
|
||||
public static string vbvorlagenmanagement { get; set; } = "No";
|
||||
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");
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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 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" && 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user