update 20241201
This commit is contained in:
67
Client - Kopie/Klassen/Broadcaster.cs
Normal file
67
Client - Kopie/Klassen/Broadcaster.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using BroadcastListener.Interfaces;
|
||||
|
||||
namespace BroadcastListener.Classes
|
||||
{
|
||||
public class Broadcaster
|
||||
{
|
||||
private readonly Collection<IMessageListener1> _listeners =
|
||||
new Collection<IMessageListener1>();
|
||||
|
||||
/// <summary>
|
||||
/// Send message
|
||||
/// </summary>
|
||||
/// <param name="message">Message</param>
|
||||
/// <param name="sender"></param>
|
||||
/// <remarks></remarks>
|
||||
[DebuggerStepThrough()]
|
||||
public void Broadcast(string message, SenderInfo sender)
|
||||
{
|
||||
foreach (IMessageListener1 listener in _listeners)
|
||||
{
|
||||
listener.OnListen(message, sender);
|
||||
}
|
||||
}
|
||||
[DebuggerStepThrough()]
|
||||
|
||||
/// <summary>
|
||||
/// Add a Listener to the Collection of Listeners
|
||||
/// </summary>
|
||||
/// <param name="listener"></param>
|
||||
public void AddListener(IMessageListener1 listener)
|
||||
{
|
||||
_listeners.Add(listener);
|
||||
}
|
||||
/// <summary>
|
||||
/// Remove a Listener from the collection
|
||||
/// </summary>
|
||||
/// <param name="listener"></param>
|
||||
public void RemoveListener(IMessageListener1 listener)
|
||||
{
|
||||
|
||||
for (int index = 0; index < _listeners.Count; index++)
|
||||
{
|
||||
if ( _listeners[index].Equals(listener) )
|
||||
{
|
||||
_listeners.Remove(_listeners[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SenderInfo
|
||||
{
|
||||
public string SenderName { get; set; }
|
||||
public string Function { get; set; }
|
||||
public string Details { get; set; }
|
||||
|
||||
public SenderInfo(string SenderName, string Funtion, string Details)
|
||||
{
|
||||
this.SenderName= SenderName;
|
||||
this.Function= Funtion;
|
||||
this.Details= Details;
|
||||
}
|
||||
}
|
||||
}
|
||||
162
Client - Kopie/Klassen/EDKFile.cs
Normal file
162
Client - Kopie/Klassen/EDKFile.cs
Normal file
@@ -0,0 +1,162 @@
|
||||
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.Windows.Forms;
|
||||
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
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string value { get; set; }
|
||||
|
||||
public EDK_Parameters(string name, string value)
|
||||
{
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public class EDK_Dokumentwerte
|
||||
{
|
||||
public string name { get; set; }
|
||||
public 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)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetAVQ_Value(string name, string techname)
|
||||
{
|
||||
for (int i = 0; i < dokumentwerte.Count; i++)
|
||||
{
|
||||
EDK_Dokumentwerte d = dokumentwerte[i];
|
||||
if (dokumentwerte[i].name == name || dokumentwerte[i].name == techname)
|
||||
{
|
||||
return dokumentwerte[i].value;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static string GetAVQ_Parameter(string name)
|
||||
{
|
||||
for (int i = 0; i < parameters.Count; i++) {
|
||||
if (parameters[i].name.ToUpper() == name.ToUpper())
|
||||
{
|
||||
return parameters[i].value;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
39
Client - Kopie/Klassen/EventHandler.cs
Normal file
39
Client - Kopie/Klassen/EventHandler.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OnDoc.Klassen;
|
||||
|
||||
namespace OnDoc.Klassen
|
||||
{
|
||||
public class StrukturArgs: EventArgs
|
||||
{
|
||||
private string message;
|
||||
private int dokumentartnr;
|
||||
private int partnernr;
|
||||
|
||||
public StrukturArgs(string message, int dokumentartnr, int partnernr)
|
||||
{
|
||||
this.message=message;
|
||||
this.dokumentartnr=dokumentartnr;
|
||||
this.partnernr=partnernr;
|
||||
|
||||
}
|
||||
public string Message
|
||||
{
|
||||
get
|
||||
{
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
public int Dokumentartnr
|
||||
{ get { return dokumentartnr;} }
|
||||
|
||||
public int Partnernr
|
||||
{ get { return partnernr; } }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
13
Client - Kopie/Klassen/Factory.cs
Normal file
13
Client - Kopie/Klassen/Factory.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace BroadcastListener.Classes
|
||||
{
|
||||
public static class Factory
|
||||
{
|
||||
private static Broadcaster _broadcaster;
|
||||
|
||||
public static Broadcaster Broadcaster()
|
||||
{
|
||||
return _broadcaster ?? ( _broadcaster = new Broadcaster() );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
103
Client - Kopie/Klassen/StringCipher.cs
Normal file
103
Client - Kopie/Klassen/StringCipher.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OnDoc.Klassen
|
||||
{
|
||||
public static class StringCipher
|
||||
{// This constant is used to determine the keysize of the encryption algorithm in bits.
|
||||
// We divide this by 8 within the code below to get the equivalent number of bytes.
|
||||
private const int Keysize = 256;
|
||||
|
||||
// This constant determines the number of iterations for the password bytes generation function.
|
||||
private const int DerivationIterations = 1000;
|
||||
|
||||
public static string Encrypt(string plainText, string passPhrase)
|
||||
{
|
||||
// Salt and IV is randomly generated each time, but is preprended to encrypted cipher text
|
||||
// so that the same Salt and IV values can be used when decrypting.
|
||||
var saltStringBytes = Generate256BitsOfRandomEntropy();
|
||||
var ivStringBytes = Generate256BitsOfRandomEntropy();
|
||||
var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
|
||||
using (var password = new Rfc2898DeriveBytes(passPhrase, saltStringBytes, DerivationIterations))
|
||||
{
|
||||
var keyBytes = password.GetBytes(Keysize / 8);
|
||||
using (var symmetricKey = new RijndaelManaged())
|
||||
{
|
||||
symmetricKey.BlockSize = 256;
|
||||
symmetricKey.Mode = CipherMode.CBC;
|
||||
symmetricKey.Padding = PaddingMode.PKCS7;
|
||||
using (var encryptor = symmetricKey.CreateEncryptor(keyBytes, ivStringBytes))
|
||||
{
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
using (var cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write))
|
||||
{
|
||||
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
|
||||
cryptoStream.FlushFinalBlock();
|
||||
// Create the final bytes as a concatenation of the random salt bytes, the random iv bytes and the cipher bytes.
|
||||
var cipherTextBytes = saltStringBytes;
|
||||
cipherTextBytes = cipherTextBytes.Concat(ivStringBytes).ToArray();
|
||||
cipherTextBytes = cipherTextBytes.Concat(memoryStream.ToArray()).ToArray();
|
||||
memoryStream.Close();
|
||||
cryptoStream.Close();
|
||||
return Convert.ToBase64String(cipherTextBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string Decrypt(string cipherText, string passPhrase)
|
||||
{
|
||||
// Get the complete stream of bytes that represent:
|
||||
// [32 bytes of Salt] + [32 bytes of IV] + [n bytes of CipherText]
|
||||
var cipherTextBytesWithSaltAndIv = Convert.FromBase64String(cipherText);
|
||||
// Get the saltbytes by extracting the first 32 bytes from the supplied cipherText bytes.
|
||||
var saltStringBytes = cipherTextBytesWithSaltAndIv.Take(Keysize / 8).ToArray();
|
||||
// Get the IV bytes by extracting the next 32 bytes from the supplied cipherText bytes.
|
||||
var ivStringBytes = cipherTextBytesWithSaltAndIv.Skip(Keysize / 8).Take(Keysize / 8).ToArray();
|
||||
// Get the actual cipher text bytes by removing the first 64 bytes from the cipherText string.
|
||||
var cipherTextBytes = cipherTextBytesWithSaltAndIv.Skip((Keysize / 8) * 2).Take(cipherTextBytesWithSaltAndIv.Length - ((Keysize / 8) * 2)).ToArray();
|
||||
|
||||
using (var password = new Rfc2898DeriveBytes(passPhrase, saltStringBytes, DerivationIterations))
|
||||
{
|
||||
var keyBytes = password.GetBytes(Keysize / 8);
|
||||
using (var symmetricKey = new RijndaelManaged())
|
||||
{
|
||||
symmetricKey.BlockSize = 256;
|
||||
symmetricKey.Mode = CipherMode.CBC;
|
||||
symmetricKey.Padding = PaddingMode.PKCS7;
|
||||
using (var decryptor = symmetricKey.CreateDecryptor(keyBytes, ivStringBytes))
|
||||
{
|
||||
using (var memoryStream = new MemoryStream(cipherTextBytes))
|
||||
{
|
||||
using (var cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read))
|
||||
using (var streamReader = new StreamReader(cryptoStream, Encoding.UTF8))
|
||||
{
|
||||
return streamReader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] Generate256BitsOfRandomEntropy()
|
||||
{
|
||||
var randomBytes = new byte[32]; // 32 Bytes will give us 256 bits.
|
||||
using (var rngCsp = new RNGCryptoServiceProvider())
|
||||
{
|
||||
// Fill the array with cryptographically secure random bytes.
|
||||
rngCsp.GetBytes(randomBytes);
|
||||
}
|
||||
return randomBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
12
Client - Kopie/Klassen/clsExcelEdit.cs
Normal file
12
Client - Kopie/Klassen/clsExcelEdit.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OnDoc.Klassen
|
||||
{
|
||||
internal class clsExcelEdit
|
||||
{
|
||||
}
|
||||
}
|
||||
41
Client - Kopie/Klassen/clsPartner.cs
Normal file
41
Client - Kopie/Klassen/clsPartner.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Syncfusion.WinForms.DataGrid.Interactivity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using Syncfusion.Styles;
|
||||
using Syncfusion.Windows.Forms.Tools;
|
||||
using Database;
|
||||
|
||||
namespace OnDoc.Klassen
|
||||
{
|
||||
public static class clsPartner
|
||||
{
|
||||
private static string Connectionstring = "";
|
||||
public static DataTable partnerliste;
|
||||
public static void set_connectionstring(string connectionstring)
|
||||
{
|
||||
Connectionstring = connectionstring;
|
||||
}
|
||||
|
||||
public static DataTable search_partner(string query, int anzahl, int fnkt)
|
||||
{
|
||||
DB db = new DB(Connectionstring);
|
||||
try
|
||||
{
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@query", query);
|
||||
db.add_parameter("@table", "dbo.partner");
|
||||
db.add_parameter("@anz", anzahl.ToString());
|
||||
db.add_parameter("@fnkt", fnkt.ToString());
|
||||
partnerliste = db.Get_Tabledata("sp_partner_search", true, false);
|
||||
return partnerliste;
|
||||
}
|
||||
finally { db = null; }
|
||||
}
|
||||
public static DataTable get_partnerliste() { return partnerliste; }
|
||||
}
|
||||
}
|
||||
146
Client - Kopie/Klassen/clsProcessWatch.cs
Normal file
146
Client - Kopie/Klassen/clsProcessWatch.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using Database;
|
||||
using Syncfusion.Windows.Forms.Tools;
|
||||
|
||||
namespace OnDoc.Klassen
|
||||
{
|
||||
public static class clsProcessWatch
|
||||
{
|
||||
|
||||
public static System.Timers.Timer watchtimer = new System.Timers.Timer(2000);
|
||||
|
||||
static List<FileToCheck> FilestoCheck = new List<FileToCheck>();
|
||||
|
||||
public static void AddToList(string dokumentid, string filename, string applicatoin)
|
||||
{
|
||||
FilestoCheck.Add(new FileToCheck(dokumentid, filename, applicatoin));
|
||||
if (watchtimer.Enabled == false) { watchtimer.Enabled = true; }
|
||||
watchtimer.Elapsed += WatchProcesses;
|
||||
}
|
||||
|
||||
public static void RemoveFromList(string dokumentid)
|
||||
{
|
||||
foreach (FileToCheck fc in FilestoCheck)
|
||||
{
|
||||
if (fc.dokumentid == dokumentid)
|
||||
{
|
||||
FilestoCheck.Remove(fc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (FilestoCheck.Count == 0)
|
||||
{
|
||||
watchtimer.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void WatchProcesses(object source, ElapsedEventArgs e)
|
||||
{
|
||||
bool word = false;
|
||||
bool excel = false;
|
||||
bool pdf = false;
|
||||
bool found = false;
|
||||
|
||||
found= false;
|
||||
foreach (FileToCheck fc in FilestoCheck)
|
||||
{
|
||||
if (fc.application == "Word") { word = true; }
|
||||
if (fc.application == "Excel") { excel = true; }
|
||||
if (fc.application == "PDF") { pdf = true; }
|
||||
|
||||
if (word)
|
||||
{
|
||||
Process[] localByName = Process.GetProcessesByName("WINWORD");
|
||||
foreach (Process p in localByName)
|
||||
{
|
||||
if (p.MainWindowTitle.IndexOf(fc.dokumentid) > 0) { found = true; }
|
||||
}
|
||||
}
|
||||
if (excel)
|
||||
{
|
||||
Process[] localByName = Process.GetProcessesByName("EXCEL");
|
||||
foreach (Process p in localByName)
|
||||
{
|
||||
if (p.MainWindowTitle.IndexOf(fc.dokumentid) > 0) { found = true; }
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
if (Check_Modified(fc) == true)
|
||||
{
|
||||
Save_File(fc.dokumentid, fc.filename);
|
||||
Logging.DocLog.Info("Dokument gespeichert und geschlossen", "Processwatch", fc.dokumentid, "", fc.filename);
|
||||
RemoveFromList(fc.dokumentid);
|
||||
Remove_Dok_in_Bearbeitung(fc.dokumentid);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.DocLog.Info("Dokument ohne speichern geschlossen", "Processwatch", fc.dokumentid, "", fc.filename);
|
||||
RemoveFromList(fc.dokumentid);
|
||||
Remove_Dok_in_Bearbeitung(fc.dokumentid);
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private static void Remove_Dok_in_Bearbeitung(string dokumentid)
|
||||
{
|
||||
DB db = new DB(AppParams.connectionstring);
|
||||
db.Dok_in_Bearbeietung(2, dokumentid, AppParams.CurrentMitarbieter);
|
||||
db = null;
|
||||
}
|
||||
private static void Save_File(string dokumentid, string filename)
|
||||
{
|
||||
DB db = new DB(AppParams.connectionstring);
|
||||
db.Get_Tabledata("Select * from dokument where dokumentid='" + dokumentid + "'", false, true);
|
||||
|
||||
db.Save_To_DB(dokumentid, filename);
|
||||
db.set_approvalstate(dokumentid, false);
|
||||
Logging.DocLog.Info("Dokument gespeichert", "Processwatch", dokumentid, "", filename);
|
||||
db = null;
|
||||
}
|
||||
|
||||
private static bool Check_Modified(FileToCheck fc)
|
||||
{
|
||||
DateTime lwt = System.IO.File.GetLastWriteTime(fc.filename);
|
||||
if ((lwt- fc.filedatetime).Seconds > 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public class FileToCheck
|
||||
{
|
||||
public string dokumentid { get; set; }
|
||||
public string filename { get; set; }
|
||||
public string application { get; set; }
|
||||
|
||||
public DateTime filedatetime { get; set; }
|
||||
|
||||
public FileToCheck(string dokumentid, string filename, string application)
|
||||
{
|
||||
this.dokumentid = dokumentid;
|
||||
this.filename = filename;
|
||||
this.application = application;
|
||||
this.filedatetime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
17
Client - Kopie/Klassen/clsStaticValues.cs
Normal file
17
Client - Kopie/Klassen/clsStaticValues.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Syncfusion.Windows.Forms.Tools;
|
||||
using Syncfusion.Windows.Forms.Tools.MultiColumnTreeView;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OnDoc.Klassen
|
||||
{
|
||||
public static class StaticValues
|
||||
{
|
||||
public static string UserID { get; set; } = "";
|
||||
public static TreeViewAdv vorlagen { get; set; } = new TreeViewAdv();
|
||||
}
|
||||
}
|
||||
76
Client - Kopie/Klassen/clsWordEdit.cs
Normal file
76
Client - Kopie/Klassen/clsWordEdit.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using Microsoft.Office.Interop.Word;
|
||||
using OnDoc.UIControls.Administrator;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace OnDoc.Klassen
|
||||
{
|
||||
public class clsWordEdit
|
||||
{
|
||||
public string connectstring { get;set; }
|
||||
public string filename { get; set; }
|
||||
public string dokumentid { get; set; }
|
||||
public
|
||||
Microsoft.Office.Interop.Word.Application word;
|
||||
Document doc = null;
|
||||
|
||||
|
||||
public clsWordEdit(string connectstring, string filename, string dokumentid)
|
||||
{
|
||||
this.connectstring = connectstring;
|
||||
this.filename = filename;
|
||||
this.dokumentid = dokumentid;
|
||||
|
||||
}
|
||||
|
||||
public bool Start_Application()
|
||||
{
|
||||
try
|
||||
{
|
||||
word = new Microsoft.Office.Interop.Word.Application();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Edit_Document()
|
||||
{
|
||||
Start_Application();
|
||||
doc = word.Documents.Open(filename);
|
||||
word.Visible= true;
|
||||
clsProcessWatch.AddToList(dokumentid, filename, "Word");
|
||||
bool isClosed = IsDocumentClosed(word, doc);
|
||||
}
|
||||
|
||||
public void Control_Word(string dokumentid, string filename, string application)
|
||||
{
|
||||
clsProcessWatch.AddToList(dokumentid, filename, application);
|
||||
}
|
||||
|
||||
static bool IsDocumentClosed(Application wordApp, Document doc)
|
||||
{
|
||||
// Check if the document is still listed in the Documents collection
|
||||
foreach (Document openDoc in wordApp.Documents)
|
||||
{
|
||||
if (openDoc.FullName == doc.FullName)
|
||||
{
|
||||
return false; // Document is still open
|
||||
}
|
||||
}
|
||||
return true; // Document is closed
|
||||
}
|
||||
|
||||
public void run_macros()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
Client - Kopie/Klassen/clstheming.cs
Normal file
45
Client - Kopie/Klassen/clstheming.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Syncfusion.Styles;
|
||||
using Syncfusion.WinForms.Controls;
|
||||
using Syncfusion.WinForms.Controls.Styles;
|
||||
using Syncfusion.WinForms.DataGrid.RowFilter;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace OnDoc.Klassen
|
||||
{
|
||||
public static class Theaming
|
||||
{
|
||||
//public static string FormTitleColor = "77,79,83";
|
||||
//public static string FormTitleFont = "Arial 11";
|
||||
//public static string FormTitleFontColor = "191,192,195";
|
||||
public static string FormTitleColor = "154,155,156";
|
||||
public static string FormTitleFont = "Arial 11";
|
||||
public static string FormTitleFontColor = "12,12,12";
|
||||
private static int r;
|
||||
private static int b;
|
||||
private static int g;
|
||||
|
||||
public static Color Titelbar()
|
||||
{
|
||||
return parseColor(FormTitleColor);
|
||||
}
|
||||
public static Color TitelFontColor()
|
||||
{
|
||||
return parseColor(FormTitleFontColor);
|
||||
//return Color.FromArgb(77, 79, 83);
|
||||
}
|
||||
|
||||
static public Color parseColor(string inputcode)
|
||||
{
|
||||
string[] colors = inputcode.Split(',');
|
||||
return Color.FromArgb(Convert.ToInt32(colors[0]), Convert.ToInt32(colors[1]), Convert.ToInt32(colors[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user