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.
287 lines
14 KiB
287 lines
14 KiB
using Database;
|
|
using Syncfusion.Data.Extensions;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Linq.Expressions;
|
|
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 CurrentMitarbeiter { 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;
|
|
|
|
public static string pathNativVorlagen { get; set; } = "";
|
|
|
|
public static int Office_Fill_DocIO { get; set; } = 0;
|
|
|
|
public static bool StartApp { get; set; } = false;
|
|
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 ondoc_appParams where usedbparams=1", false, true);
|
|
if (db.dsdaten.Tables[0].Rows.Count > 0)
|
|
{
|
|
tempdir = db.dsdaten.Tables[0].Rows[0][0].ToString();
|
|
Version = db.dsdaten.Tables[0].Rows[0][1].ToString();
|
|
UseAPI = db.dsdaten.Tables[0].Rows[0][2].ToString();
|
|
RESTURI = db.dsdaten.Tables[0].Rows[0][3].ToString();
|
|
wordprintmacro = db.dsdaten.Tables[0].Rows[0][5].ToString();
|
|
vbvorlagenmanagement = db.dsdaten.Tables[0].Rows[0][6].ToString();
|
|
barcodefont = db.dsdaten.Tables[0].Rows[0][7].ToString();
|
|
barcodefontsize = db.dsdaten.Tables[0].Rows[0][8].ToString();
|
|
barcodetextposition = db.dsdaten.Tables[0].Rows[0][9].ToString();
|
|
ZusatzFont = db.dsdaten.Tables[0].Rows[0][10].ToString();
|
|
ZusatzFontSize = db.dsdaten.Tables[0].Rows[0][11].ToString();
|
|
EDOKAPath = db.dsdaten.Tables[0].Rows[0][12].ToString();
|
|
OfficeSpleep1 = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0][13]);
|
|
OfficeSpleep2 = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0][14]);
|
|
pathNativVorlagen = db.dsdaten.Tables[0].Rows[0][16].ToString();
|
|
Office_Fill_DocIO= Convert.ToInt32(db.dsdaten.Tables[0].Rows[0][17]);
|
|
}
|
|
else
|
|
{
|
|
db.Get_Tabledata("Select * from applikation where applikationsnr = 1", false, true);
|
|
tempdir = db.dsdaten.Tables[0].Rows[0]["pfad_temporaer_dokumente"].ToString();
|
|
StaticValues.UserID = "Stefan Hutter";
|
|
|
|
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;
|
|
pathNativVorlagen = Properties.Settings.Default.NativVorlagen;
|
|
}
|
|
apikey = System.IO.File.ReadAllText(startuppath + @"\apikey.cfg");
|
|
apikey = StringCipher.Decrypt(apikey, "PBod8b%s@c9ib7Lws#na5sGM2trugrx3h!oyB^y!Bc%fHEYUT3QvTVr6sAaAr9FoQWzb");
|
|
db = null;
|
|
EvaluatePath(AppParams.tempdir);
|
|
|
|
}
|
|
private static String EvaluatePath(String path)
|
|
{
|
|
|
|
try
|
|
{
|
|
String folder = Path.GetDirectoryName(path);
|
|
if (!Directory.Exists(folder))
|
|
{
|
|
// Try to create the directory.
|
|
DirectoryInfo di = Directory.CreateDirectory(folder);
|
|
}
|
|
}
|
|
catch (IOException ioex)
|
|
{
|
|
Console.WriteLine(ioex.Message);
|
|
return "";
|
|
}
|
|
return path;
|
|
}
|
|
}
|
|
|
|
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 dokumentid { get; set; } = "";
|
|
|
|
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" && value.ToLower() != "openclient")
|
|
{
|
|
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;
|
|
case "id":
|
|
try
|
|
{
|
|
dokumentid = value;
|
|
if (dokumentid.Length > 9)
|
|
{
|
|
if (dokumentid.Substring(0, 9).ToUpper() == "OFFEDK008")
|
|
{
|
|
DB db2 = new DB(AppParams.connectionstring);
|
|
db2.Get_Tabledata("Select count(*) from doks where dokumentid = '" + dokumentid+"'", false, true);
|
|
if (db2.dsdaten.Tables[0].Rows.Count < 1)
|
|
{
|
|
dokumentid = "";
|
|
break;
|
|
}
|
|
db2.Get_Tabledata("Select * from dokument where dokumentid='" + dokumentid+"'", false, true);
|
|
if (db2.dsdaten.Tables[0].Rows.Count > 0)
|
|
{
|
|
if (MessageBox.Show("Das Dokument "+ Environment.NewLine+Environment.NewLine + dokumentid+Environment.NewLine + db2.dsdaten.Tables[0].Rows[0]["Bezeichnung"].ToString()+ Environment.NewLine+Environment.NewLine + " bearbeiten (Ja) oder ein neues Dokument erstellen (Nein)", "OnDoc", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
{
|
|
dokumentid = "";
|
|
}
|
|
else
|
|
{
|
|
db2.Get_Tabledata("Select * from dokument_trefferliste where dokumentid='"+dokumentid+"'", false, true);
|
|
if (db2.dsdaten.Tables[0].Rows[0]["status_bezeichnungnr"].ToString() == "-1")
|
|
{
|
|
db2.Get_Tabledata("Select * from mitarbeiter where mitarbeiternr=" + db2.dsdaten.Tables[0].Rows[0]["verantwortlich"].ToString(), false, true);
|
|
if (db2.dsdaten.Tables[0].Rows.Count > 0)
|
|
{
|
|
string user = db2.dsdaten.Tables[0].Rows[0]["name"].ToString();
|
|
user = user + db2.dsdaten.Tables[0].Rows[0]["vorname"].ToString();
|
|
user = user + ", "+ db2.dsdaten.Tables[0].Rows[0]["tgnummer"].ToString();
|
|
MessageBox.Show("Das Dokument ist bereits bei " + user + " in Bearbeitung.", "OnDoc", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
dokumentid = "";
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
db = null;
|
|
}
|
|
}
|
|
}
|
|
catch {
|
|
dokumentid = "";
|
|
}
|
|
break;
|
|
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static class Int_Gridsettings
|
|
{
|
|
public static DataTable Grids { get; set; }
|
|
}
|
|
}
|