Update 20250222

This commit is contained in:
Stefan Hutter
2025-02-22 19:17:38 +01:00
parent 986e225bd9
commit 794e577f22
170 changed files with 99313 additions and 87 deletions

View File

@@ -56,8 +56,10 @@ namespace OnDoc.Klassen
bool excel = false;
bool pdf = false;
bool found = false;
watchtimer.Enabled = false;
found= false;
//watchtimer.Enabled = false;
found = false;
Logging.Logging.Debug("Start Watch_Process:"+ DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), "OnDoc.Processwatch","" );
foreach (FileToCheck fc in FilestoCheck)
{
if (fc.filedatetime < DateTime.Now.AddSeconds(-5))
@@ -76,31 +78,34 @@ namespace OnDoc.Klassen
{
Thread.Sleep(200);
Process[] localByName = Process.GetProcessesByName("WINWORD");
foreach (Process p in localByName)
{
foreach (Process p in localByName)
{
Logging.Logging.Debug(fc.dokumentid + "/" + p.MainWindowTitle, "", "");
if (p.MainWindowTitle.IndexOf(fc.dokumentid) > -1)
if (p.MainWindowTitle.IndexOf(fc.dokumentid) > -1 || p.MainWindowTitle.Trim() == "")
{
found = true;
save_to_db(fc);
break;
}
{
if (p.MainWindowTitle.Trim() != "") { fc.Lastfound = DateTime.Now; }
found = true;
save_to_db(fc);
break;
}
}
}
if (excel)
{
Process[] localByName = Process.GetProcessesByName("EXCEL");
foreach (Process p in localByName)
{
if (p.MainWindowTitle.IndexOf(fc.dokumentid) > -1) {
if (p.MainWindowTitle.IndexOf(fc.dokumentid) > -1 || p.MainWindowTitle.Trim() == "")
{
found = true;
save_to_db(fc);
}
}
}
if (!found)
@@ -127,7 +132,7 @@ namespace OnDoc.Klassen
}
}
watchtimer.Enabled = true;
//watchtimer.Enabled = true;
}
private static void Remove_Dok_in_Bearbeitung(string dokumentid)
@@ -146,7 +151,7 @@ namespace OnDoc.Klassen
private static void Remove_Approvals(string dokumentid)
{
DB db = new DB(AppParams.connectionstring);
db.Exec_SQL("Update dokument_bewilligung set aktiv=0, mutiert_am=getdate(), mutierer="+AppParams.CurrentMitarbeiter.ToString()+" where dokumentid='" + dokumentid + "'");
db.Exec_SQL("Update dokument_bewilligung set aktiv=0, mutiert_am=getdate(), mutierer=" + AppParams.CurrentMitarbeiter.ToString() + " where dokumentid='" + dokumentid + "'");
db = null;
}
@@ -161,12 +166,12 @@ namespace OnDoc.Klassen
Save_File(fc.dokumentid, fc.filename + ".tmp");
fc.filedatetime = DateTime.Now;
System.IO.File.Delete(fc.filename + ".tmp");
Logging.Logging.Debug(fc.application + " / save_to_db " + fc.filename + " / " + fc.filedatetime.ToString("yyyy-MM-dd hh:mm:ss") + "/"+DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), "OnDoc.Processwatch", fc.dokumentid);
Logging.Logging.Debug(fc.application + " / save_to_db " + fc.filename + " / " + fc.filedatetime.ToString("yyyy-MM-dd hh:mm:ss") + "/" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), "OnDoc.Processwatch", fc.dokumentid);
}
catch
{
Logging.Logging.Debug(fc.application + " / save_to_db faild " + fc.filename + " / " + fc.filedatetime.ToString("yyyy-MM-dd hh:mm:ss") +"/"+ DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), "OnDoc.Processwatch", fc.dokumentid);
Logging.Logging.Debug(fc.application + " / save_to_db faild " + fc.filename + " / " + fc.filedatetime.ToString("yyyy-MM-dd hh:mm:ss") + "/" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), "OnDoc.Processwatch", fc.dokumentid);
}
@@ -176,10 +181,10 @@ namespace OnDoc.Klassen
{
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);
db.Exec_SQL("Update dokument set mutiertam = getdate(), mutierer="+AppParams.CurrentMitarbeiter+" where dokumentid='"+dokumentid+"'");
db.Exec_SQL("Update dokument set mutiertam = getdate(), mutierer=" + AppParams.CurrentMitarbeiter + " where dokumentid='" + dokumentid + "'");
Logging.DocLog.Info("Dokument gespeichert", "Processwatch", dokumentid, "", filename);
db = null;
}
@@ -191,7 +196,7 @@ namespace OnDoc.Klassen
Logging.Logging.Debug("Prozesswatch - Check Modified: " + lwt.ToString() + "," + fc.filedatetime.ToString(), "OnDoc", fc.dokumentid);
//Logging.DocLog.Debug("Prozesswatch - Check Modified: " + lwt.ToString() + "," + fc.filedatetime.ToString(), "Processwatch", fc.dokumentid, "", fc.filename);
//if ((lwt- fc.filedatetime).Seconds > 2)
if (secdiff > 2)
if (secdiff > 2)
{
return true;
}
@@ -213,6 +218,9 @@ namespace OnDoc.Klassen
public string filename { get; set; }
public string application { get; set; }
public int counter { get; set; } = 0;
public DateTime Lastfound { get; set; } = DateTime.Now;
public DateTime filedatetime { get; set; }
public FileToCheck(string dokumentid, string filename, string application)
@@ -222,7 +230,7 @@ namespace OnDoc.Klassen
this.application = application;
this.filedatetime = DateTime.Now;
//Logging.DocLog.Debug("Add Processwatch: " + DateTime.Now.ToString(), "New FileToCheck", dokumentid, "", "Add Processwatch");
Logging.Logging.Debug("Add Processwatch: " + DateTime.Now.ToString(),"OnDoc",this.dokumentid);
Logging.Logging.Debug("Add Processwatch: " + DateTime.Now.ToString(), "OnDoc", this.dokumentid);
}
}