Update 20250618
This commit is contained in:
@@ -21,6 +21,7 @@ namespace OnDoc_ArchivierungBatch
|
||||
private static int total = 0;
|
||||
private static int ok = 0;
|
||||
private static int error = 0;
|
||||
private static int docerror = 0;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
@@ -39,7 +40,7 @@ namespace OnDoc_ArchivierungBatch
|
||||
private static void archivedoc(string documentid)
|
||||
{
|
||||
write_log(documentid);
|
||||
string URL = Properties.Settings.Default.RESTURI + "api/ /ArchiveDocFromDatabase?dokumentid=" + documentid;
|
||||
string URL = Properties.Settings.Default.RESTURI + "api/ArchiveDocFromDatabase?dokumentid=" + documentid;
|
||||
|
||||
HttpWebRequest webRequest = HttpWebRequest.Create(URL) as HttpWebRequest;
|
||||
webRequest.Method = WebRequestMethods.Http.Get;
|
||||
@@ -56,14 +57,17 @@ namespace OnDoc_ArchivierungBatch
|
||||
{
|
||||
write_log("Die Archivierung des Dokumentes " + documentid + " wurde nicht durchgeführt:" + Environment.NewLine + responseContent);
|
||||
error = error + 1;
|
||||
docerror = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
ok = ok + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
write_log("Die Archivierung des Dokumentes " + documentid + " wurde abgebrochen." + Environment.NewLine + "Fehler: " + response.StatusDescription);
|
||||
error = error + 1;
|
||||
docerror = 1;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -72,17 +76,37 @@ namespace OnDoc_ArchivierungBatch
|
||||
{
|
||||
write_log("Die Archivierung des Dokumentes " + documentid + " konnte nicht durchgeführt werden." + Environment.NewLine + "Fehler: " + ex.Message);
|
||||
error = error + 1;
|
||||
docerror = 1;
|
||||
|
||||
}
|
||||
}
|
||||
public static void Exec_SQL(string sql)
|
||||
{
|
||||
SqlConnection sqlconnect = new SqlConnection();
|
||||
SqlCommand sqlcmd = new SqlCommand();
|
||||
sqlcmd.Connection = sqlconnect;
|
||||
sqlconnect.ConnectionString = Properties.Settings.Default.Connectionstring;
|
||||
sqlcmd.CommandType = CommandType.Text;
|
||||
sqlcmd.CommandText = sql;
|
||||
sqlcmd.Connection.Open();
|
||||
sqlcmd.ExecuteNonQuery();
|
||||
sqlcmd.Connection.Close();
|
||||
|
||||
}
|
||||
private static void run()
|
||||
{
|
||||
|
||||
connectionstring = Properties.Settings.Default.Connectionstring;
|
||||
Get_Tabledata("Select dokumentid from dokument where automatischearchivierung=1 and isnull(utomatischarchiviertam,0)=0");
|
||||
Get_Tabledata("Select dokumentid from dokument where automatischearchivierung=1 and dbo.fnkt_check_archived(dokumentid)=0 and dokumentid not in (select dokumentid from dokinbearbeitung where dokumentid=dokument.dokumentid) ",false,true);
|
||||
|
||||
foreach (System.Data.DataRow dr in dsdaten.Tables[0].Rows)
|
||||
{
|
||||
docerror = 0;
|
||||
archivedoc(dr[0].ToString());
|
||||
if (docerror == 0)
|
||||
{
|
||||
Exec_SQL("Update dokument set automatischarchiviertam=getdate() where dokumentid='" + dr[0].ToString() + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user