Update 20250306
This commit is contained in:
@@ -42,6 +42,9 @@ using static BroadcastListener.Classes.Factory;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using Microsoft.SqlServer.Server;
|
||||
using OnDoc.Diverses;
|
||||
using Syncfusion.Windows.Shared;
|
||||
using System.Web.UI.WebControls;
|
||||
using Syncfusion.Windows.Forms.CellGrid.ScrollAxis;
|
||||
|
||||
|
||||
namespace OnDoc.UIControls
|
||||
@@ -79,6 +82,7 @@ namespace OnDoc.UIControls
|
||||
this.profilnr = profilnr;
|
||||
//Broadcaster().AddListener(this);
|
||||
//Closing += Form_Closing;
|
||||
|
||||
}
|
||||
|
||||
private void Serienbrief_Load(object sender, EventArgs e)
|
||||
@@ -493,6 +497,11 @@ namespace OnDoc.UIControls
|
||||
}
|
||||
private void refresh_spalten()
|
||||
{
|
||||
int hasbl = 0;
|
||||
foreach(System.Data.DataRow dr in sb.dsempfaenger.Tables[0].Rows)
|
||||
{
|
||||
if (dr["blkunde"].ToString() == "1") { hasbl = 1; }
|
||||
}
|
||||
try
|
||||
{
|
||||
// sfDataGridEmpfaenger.Columns["IntEintragnr"].Visible = false;
|
||||
@@ -505,8 +514,15 @@ namespace OnDoc.UIControls
|
||||
{
|
||||
sfDataGridEmpfaenger.Columns["IntEintragnr"].Visible = true;
|
||||
//sfDataGridEmpfaenger.Columns["STATUS"].Visible = false;
|
||||
|
||||
sfDataGridEmpfaenger.Columns["FEHLERCODE"].Visible = false;
|
||||
sfDataGridEmpfaenger.Columns["BLKUNDE"].Visible = false;
|
||||
if (hasbl > 0)
|
||||
{
|
||||
sfDataGridEmpfaenger.Columns["BLKUNDE"].Visible = true;
|
||||
sfDataGridEmpfaenger.Columns["BLKUNDE"].Width = 50;
|
||||
}
|
||||
|
||||
sfDataGridEmpfaenger.Columns["DOKUMENT_GEDRUCKT"].Visible = false;
|
||||
sfDataGridEmpfaenger.Columns["DOKUMENTID"].Visible = true;
|
||||
sfDataGridEmpfaenger.Columns["DOKUMENTIDBDR"].Visible = false;
|
||||
@@ -1212,9 +1228,11 @@ namespace OnDoc.UIControls
|
||||
{
|
||||
dr = sb.dsempfaenger.Tables[0].Select("Partnernr=''");
|
||||
}
|
||||
|
||||
|
||||
foreach (var dr1 in dr)
|
||||
{
|
||||
dr1["blkunde"] = dt.Rows[i]["blkunde"].ToString();
|
||||
dr1["Status"] = dt.Rows[i]["status"];
|
||||
// Logging.Logging.Debug("dr1 ", "OnDoc", dr1["Status"].ToString());
|
||||
try
|
||||
@@ -1998,39 +2016,95 @@ namespace OnDoc.UIControls
|
||||
dv.Sort = "Partnernr";
|
||||
PdfDocument finalDoc = new PdfDocument();
|
||||
|
||||
int normalcount = 0;
|
||||
int blcount = 0;
|
||||
foreach (DataRowView rowView in dv)
|
||||
{
|
||||
System.Data.DataRow dr = rowView.Row;
|
||||
if (dr["blkunde"].ToString()=="1") { blcount++; } else { normalcount++; }
|
||||
}
|
||||
|
||||
DB db = new DB(AppParams.connectionstring);
|
||||
int stapelgroesse = 200;
|
||||
int stapel = 1;
|
||||
int i = 0;
|
||||
int anzahl_stapel = (dv.Count / 100) + 1;
|
||||
int anzahl_stapel = (normalcount / 100) + 1;
|
||||
Stream[] streams = null;
|
||||
if (dv.Count > stapelgroesse) { streams = new Stream[stapelgroesse]; } else streams = new Stream[dv.Count];
|
||||
if (normalcount > stapelgroesse) { streams = new Stream[stapelgroesse]; } else streams = new Stream[normalcount];
|
||||
init_progressbar("Druckstapel generieren", dv.Count);
|
||||
foreach (DataRowView rowView in dv)
|
||||
if (normalcount > 0)
|
||||
{
|
||||
add_progress();
|
||||
System.Data.DataRow dr = rowView.Row;
|
||||
db.Get_Tabledata("Select dbo.BinaryToBase64(dokument) from edex_sb_serienbrief_dokument where dokumentid='" + dr["Dokumentid"].ToString() + "'", false, true);
|
||||
var stream = new MemoryStream(Convert.FromBase64String(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
if (stream.Length > 0)
|
||||
foreach (DataRowView rowView in dv)
|
||||
{
|
||||
streams[i] = stream;
|
||||
i++;
|
||||
if (i >= stapelgroesse)
|
||||
add_progress();
|
||||
System.Data.DataRow dr = rowView.Row;
|
||||
if (dr["blkunde"].ToString() != "1")
|
||||
{
|
||||
save_stapel(stapel, ref streams);
|
||||
|
||||
i = 0;
|
||||
if (dv.Count-(stapel * stapelgroesse) >= stapelgroesse) { streams = new Stream[stapelgroesse]; } else
|
||||
|
||||
db.Get_Tabledata("Select dbo.BinaryToBase64(dokument) from edex_sb_serienbrief_dokument where dokumentid='" + dr["Dokumentid"].ToString() + "'", false, true);
|
||||
var stream = new MemoryStream(Convert.FromBase64String(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
if (stream.Length > 0)
|
||||
{
|
||||
streams = new Stream[dv.Count - (stapel * stapelgroesse)];
|
||||
streams[i] = stream;
|
||||
i++;
|
||||
if (i >= stapelgroesse)
|
||||
{
|
||||
save_stapel(stapel, ref streams);
|
||||
|
||||
i = 0;
|
||||
if (dv.Count - (stapel * stapelgroesse) >= stapelgroesse) { streams = new Stream[stapelgroesse]; }
|
||||
else
|
||||
{
|
||||
streams = new Stream[dv.Count - (stapel * stapelgroesse)];
|
||||
}
|
||||
//streams = new Stream[dv.Count - (stapel * stapelgroesse)];
|
||||
stapel++;
|
||||
}
|
||||
}
|
||||
//streams = new Stream[dv.Count - (stapel * stapelgroesse)];
|
||||
stapel++;
|
||||
}
|
||||
}
|
||||
save_stapel(stapel, ref streams);
|
||||
}
|
||||
if (blcount > 0)
|
||||
{
|
||||
i = 0;
|
||||
anzahl_stapel = (blcount / 100) + 1;
|
||||
streams = null;
|
||||
if (blcount > stapelgroesse) { streams = new Stream[stapelgroesse]; } else streams = new Stream[blcount];
|
||||
stapel = stapel + 1;
|
||||
i = 0;
|
||||
foreach (DataRowView rowView in dv)
|
||||
{
|
||||
add_progress();
|
||||
System.Data.DataRow dr = rowView.Row;
|
||||
if (dr["blkunde"].ToString() == "1")
|
||||
{
|
||||
|
||||
db.Get_Tabledata("Select dbo.BinaryToBase64(dokument) from edex_sb_serienbrief_dokument where dokumentid='" + dr["Dokumentid"].ToString() + "'", false, true);
|
||||
var stream = new MemoryStream(Convert.FromBase64String(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
if (stream.Length > 0)
|
||||
{
|
||||
streams[i] = stream;
|
||||
i++;
|
||||
if (i >= stapelgroesse)
|
||||
{
|
||||
save_stapel(stapel, ref streams);
|
||||
|
||||
i = 0;
|
||||
if (dv.Count - (stapel * stapelgroesse) >= stapelgroesse) { streams = new Stream[stapelgroesse]; }
|
||||
else
|
||||
{
|
||||
streams = new Stream[dv.Count - (stapel * stapelgroesse)];
|
||||
}
|
||||
//streams = new Stream[dv.Count - (stapel * stapelgroesse)];
|
||||
stapel++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
save_stapel(stapel, ref streams);
|
||||
|
||||
}
|
||||
save_stapel(stapel, ref streams);
|
||||
//PdfDocumentBase.Merge(finalDoc, streams);
|
||||
//FileStream fs = new FileStream(AppParams.tempdir+sb.serienbriefnr.ToString()+".pdf",FileMode.Create);
|
||||
//finalDoc.Save(fs);
|
||||
@@ -2609,5 +2683,29 @@ namespace OnDoc.UIControls
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DateDokumentDatum_DropDownOpening(object sender, CancelEventArgs e)
|
||||
{
|
||||
DateDokumentDatum.MonthCalendar.FirstDayOfWeek=DayOfWeek.Monday;
|
||||
}
|
||||
|
||||
private void sfDataGridEmpfaenger_DrawCell(object sender, Syncfusion.WinForms.DataGrid.Events.DrawCellEventArgs e)
|
||||
{
|
||||
var selectedItem = e.DataRow;
|
||||
var dataRow = (e.DataRow.RowData as DataRowView).Row;
|
||||
if (e.Column.MappingName == "BLKUNDE")
|
||||
{
|
||||
if (dataRow["blkunde"].ToString() == "1")
|
||||
{
|
||||
|
||||
e.Style.BackColor = Color.Red;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user