update 20241011

This commit is contained in:
Stefan Hutter
2024-10-11 21:38:02 +02:00
parent b8a392b514
commit 5bea1d4535
202 changed files with 995 additions and 289 deletions

View File

@@ -23,10 +23,13 @@ using Syncfusion.WinForms.ListView;
using OnDoc.UIControls.Administrator;
using System.Diagnostics;
using NLog.LayoutRenderers.Wrappers;
using BroadcastListener.Classes;
using BroadcastListener.Interfaces;
using static BroadcastListener.Classes.Factory;
namespace OnDoc.DocMgmt
{
public partial class Dokumentpaket : SfForm
public partial class Dokumentpaket : SfForm, IMessageListener1
{
private List<UCAllgemeineDokumentParam> doclist = new List<UCAllgemeineDokumentParam>();
private DataTable dokumentpaket = new DataTable();
@@ -40,17 +43,36 @@ namespace OnDoc.DocMgmt
InitializeComponent();
this.Style.TitleBar.BackColor = Theaming.Titelbar();
this.Style.TitleBar.ForeColor = Theaming.TitelFontColor();
Broadcaster().AddListener(this);
Closing += Form_Closing;
}
public Dokumentpaket(int profilnr)
{
InitializeComponent();
this.Style.TitleBar.BackColor = Theaming.Titelbar();
this.Style.TitleBar.ForeColor = Theaming.TitelFontColor();
this.profilnr = profilnr;
Broadcaster().AddListener(this);
Closing += Form_Closing;
}
private void Form_Closing(object sender, CancelEventArgs e)
{
Broadcaster().RemoveListener(this);
}
public void OnListen(string message, SenderInfo sender)
{
if (message == "DokumentPaket")
{
if (sender.Function == "NeuGenerierung")
{
string dokumentid = sender.Details;
dokList1.dokument_loeschen(dokumentid);
Generate_Docs(dokumentid);
}
}
}
private bool NeuesDokumentpaket()
{
DokTypSelect dt = new DokTypSelect();
@@ -352,76 +374,99 @@ namespace OnDoc.DocMgmt
}
return true;
}
private void RibbonButtonGenerieren_Click(object sender, EventArgs e)
{
if (check_all_doks()==false)
if (check_all_doks() == false)
{
return;
}
string filter = "dokumentid in ('";
if (!dokList1.grid_empty())
{
if (MessageBox.Show("Die bereits generierten Dokumente löschen?", "Generierung", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
else
{
dokList1.delete_doks_in_list();
}
}
progressBarAdv1.Minimum = 0;
progressBarAdv1.Maximum = TabControlDokuments.TabPages.Count;
progressBarAdv1.Value = 0;
progressBarAdv1.Visible = true;
Generate_Docs();
}
private void Generate_Docs(string idokumentid="") {
string filter = "dokumentid in ('";
foreach (TabPageAdv tab in TabControlDokuments.TabPages)
{
progressBarAdv1.Value = progressBarAdv1.Value+1;
progressBarAdv1.Value = progressBarAdv1.Value + 1;
Application.DoEvents();
UCAllgemeineDokumentParam uc = (UCAllgemeineDokumentParam)tab.Controls[0];
// uc.partnernr = Convert.ToInt32(txtbpnummer.Text);
uc.Set_Edit_later();
uc.Update_DocGenData();
clsDocData dokdata = new clsDocData();
uc.update_dokdata(ref dokdata);
uc.update_partner();
DOCGEN.DocGen docgen = new DOCGEN.DocGen(AppParams.connectionstring);
string dokumentid = docgen.GenDocID(dokdata);
dokdata.Dokumentid = dokumentid;
filter = filter + dokumentid + "','";
dokumentid = dokdata.Dokumentid;
if (dokumentid != "")
if (idokumentid == "" || uc.genertated_dokumentid == idokumentid)
{
Logging.DocLog.Info("Dokument erstellt", "Dokumentpaket", dokumentid, uc.partnernr.ToString(), "Dokument erstellt");
DOCGEN.Generator.DocGenerator_from_EDOKA Generator = new DOCGEN.Generator.DocGenerator_from_EDOKA(AppParams.connectionstring, AppParams.tempdir);
clsdok dok = new clsdok("", "", "");
dok = Generator.Generate_Doc_EDOKA(dokumentid, ref dokdata);
if (uc.docgendata.erstellungsart == Erstellungsart.DokumentBearbeiten)
uc.Set_Edit_later();
uc.Update_DocGenData();
clsDocData dokdata = new clsDocData();
uc.update_dokdata(ref dokdata);
uc.update_partner();
DOCGEN.DocGen docgen = new DOCGEN.DocGen(AppParams.connectionstring);
string dokumentid = docgen.GenDocID(dokdata);
dokdata.Dokumentid = dokumentid;
uc.genertated_dokumentid = dokumentid;
uc.Show_Neugenerieren();
filter = filter + dokumentid + "','";
dokumentid = dokdata.Dokumentid;
if (dokumentid != "")
{
string filename = AppParams.tempdir + dokumentid + "." + dok.extension;
System.IO.File.WriteAllBytes(filename, Convert.FromBase64String(dok.dokument));
DB db = new DB(AppParams.connectionstring);
db.Save_To_DB(dokdata.Dokumentid, filename);
db = null;
Logging.DocLog.Info("Dokument erstellt", "Dokumentpaket", dokumentid, uc.partnernr.ToString(), "Dokument erstellt");
DOCGEN.Generator.DocGenerator_from_EDOKA Generator = new DOCGEN.Generator.DocGenerator_from_EDOKA(AppParams.connectionstring, AppParams.tempdir);
clsdok dok = new clsdok("", "", "");
dok = Generator.Generate_Doc_EDOKA(dokumentid, ref dokdata);
System.Diagnostics.Process.Start("winword.exe", filename);
clsProcessWatch.AddToList(dokdata.Dokumentid, filename, "Word");
if (uc.docgendata.erstellungsart == Erstellungsart.DokumentBearbeiten)
{
string filename = AppParams.tempdir + dokumentid + "." + dok.extension;
System.IO.File.WriteAllBytes(filename, Convert.FromBase64String(dok.dokument));
DB db = new DB(AppParams.connectionstring);
db.Save_To_DB(dokdata.Dokumentid, filename);
db = null;
System.Diagnostics.Process.Start("winword.exe", filename);
clsProcessWatch.AddToList(dokdata.Dokumentid, filename, "Word");
}
if (uc.docgendata.erstellungsart == Erstellungsart.DokumentAlsPDF)
{
//Generator.DocToPDF(dokumentid, ref dok);
dok.extension = "pdf";
string filename = AppParams.tempdir + dokumentid + "." + dok.extension;
System.IO.File.WriteAllBytes(filename, Convert.FromBase64String(dok.dokument));
DB db = new DB(AppParams.connectionstring);
db.Save_To_DB(dokdata.Dokumentid, filename);
}
if (uc.docgendata.erstellungsart == Erstellungsart.DokumentSpäterBearbeiten)
{
string filename = AppParams.tempdir + dokumentid + "." + dok.extension;
System.IO.File.WriteAllBytes(filename, Convert.FromBase64String(dok.dokument));
DB db = new DB(AppParams.connectionstring);
db.Save_To_DB(dokdata.Dokumentid, filename);
db = null;
}
}
if (uc.docgendata.erstellungsart == Erstellungsart.DokumentAlsPDF)
{
//Generator.DocToPDF(dokumentid, ref dok);
dok.extension = "pdf";
string filename = AppParams.tempdir + dokumentid + "." + dok.extension;
System.IO.File.WriteAllBytes(filename, Convert.FromBase64String(dok.dokument));
DB db = new DB(AppParams.connectionstring);
db.Save_To_DB(dokdata.Dokumentid, filename);
}
if (uc.docgendata.erstellungsart == Erstellungsart.DokumentSpäterBearbeiten)
{
string filename = AppParams.tempdir + dokumentid + "." + dok.extension;
System.IO.File.WriteAllBytes(filename, Convert.FromBase64String(dok.dokument));
DB db = new DB(AppParams.connectionstring);
db.Save_To_DB(dokdata.Dokumentid, filename);
db = null;
}
}
else
{
filter = filter + uc.genertated_dokumentid + "','";
}
}
progressBarAdv1.Visible = false;
filter = filter.Substring(0, filter.Length - 2) + ")";
@@ -433,6 +478,8 @@ namespace OnDoc.DocMgmt
{
if (!NeuesDokumentpaket()) { return; }
Update_PaketDetails();
dokList1.datafilter = "dokumentid in ('n.a.')";
dokList1.refresh_dokumente();
}