update 20250729

This commit is contained in:
Stefan Hutter
2025-07-29 19:28:12 +02:00
parent e33c7ede5b
commit f700066d6a
104 changed files with 761 additions and 436 deletions

View File

@@ -12,6 +12,8 @@ using Syncfusion.Windows.Forms.Tools;
using Syncfusion.WinForms.Controls;
using Database;
using System.Security.RightsManagement;
using Syncfusion.WinForms.DataGrid.Enums;
using NLog.LayoutRenderers.Wrappers;
namespace OnDoc.DocMgmt
{
@@ -21,6 +23,7 @@ namespace OnDoc.DocMgmt
public string selectedID = "";
public string file = "";
public string usedfelder = "";
string basedokumenttypnr = "";
public SerienbriefTemplateLoad()
{
InitializeComponent();
@@ -30,7 +33,7 @@ namespace OnDoc.DocMgmt
this.Style.InactiveShadowOpacity = Theaming.InactivShadowOpacity;
}
public SerienbriefTemplateLoad(string mitarbeiternr)
public SerienbriefTemplateLoad(string mitarbeiternr, string basedokumenttypnr)
{
InitializeComponent();
this.Style.TitleBar.BackColor = Theaming.Titelbar();
@@ -38,18 +41,36 @@ namespace OnDoc.DocMgmt
this.Style.ShadowOpacity = Theaming.ShadowOpacity;
this.Style.InactiveShadowOpacity = Theaming.InactivShadowOpacity;
this.mitarbeiternr=mitarbeiternr;
this.basedokumenttypnr =basedokumenttypnr;
}
private void SerienbriefTemplateLoad_Load(object sender, EventArgs e)
{
pictureBox1.Visible = false;
this.label1.Visible = false;
load_data();
}
private void load_data() {
DB db = new DB(AppParams.connectionstring);
db.Get_Tabledata("Select ID,Bezeichnung, isnull(usedfelder,'') as UsedFelder from ondoc_sb_vorlage where aktiv=1 and mitarbeiternr="+ mitarbeiternr, false, true);
db.Get_Tabledata("Select '0' as S,ID,Bezeichnung, isnull(usedfelder,'') as UsedFelder, case when isnull(doktyp,'') ='' then 'A' else doktyp end as DokTyp from ondoc_sb_vorlage where aktiv=1 and mitarbeiternr="+ mitarbeiternr, false, true);
foreach (System.Data.DataRow dr in db.dsdaten.Tables[0].Rows)
{
if (dr[4].ToString() != basedokumenttypnr)
{
dr[0] = '1';
}
else
{
dr[0] = '2';
}
}
db.dsdaten.Tables[0].AcceptChanges();
this.sfDataGrid1.DataSource = db.dsdaten.Tables[0];
this.sfDataGrid1.Columns[0].Visible = false;
this.sfDataGrid1.Columns[2].Visible = false;
this.sfDataGrid1.Columns[1].Visible = false;
this.sfDataGrid1.Columns[3].Visible = false;
this.sfDataGrid1.Columns[4].Visible = false;
this.sfDataGrid1.Columns[0].HeaderText = "";
sfDataGrid1.RowHeight = 28;
db = null;
}
@@ -110,5 +131,60 @@ namespace OnDoc.DocMgmt
}
}
private void sfDataGrid1_DrawCell(object sender, Syncfusion.WinForms.DataGrid.Events.DrawCellEventArgs e)
{
try
{
if (e.Column.MappingName == "S")
{
try
{
e.Column.CellStyle.HorizontalAlignment = HorizontalAlignment.Center;
e.Handled = true;
var selectedItem = e.DataRow;
var dataRow = (e.DataRow.RowData as DataRowView).Row;
if (Convert.ToInt32(dataRow["S"]) == 2)
{
e.Graphics.DrawImage(OnDoc.Properties.Resources.OK_24x24_32, e.Bounds.X + 10, e.Bounds.Y+2);
}
if (Convert.ToInt32(dataRow["S"]) == 1)
{
e.Graphics.DrawImage(OnDoc.Properties.Resources.Achtung_24x24_32, e.Bounds.X + 10, e.Bounds.Y+2);
}
Pen borderPen = new Pen(Color.LightGray);
e.Graphics.DrawLine(borderPen, e.Bounds.Right, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom);
e.Graphics.DrawLine(borderPen, e.Bounds.Left-1, e.Bounds.Bottom, e.Bounds.Right, e.Bounds.Bottom);
return;
}
catch { }
e.Handled = false;
}
}
catch { }
}
private void sfDataGrid1_QueryRowStyle(object sender, Syncfusion.WinForms.DataGrid.Events.QueryRowStyleEventArgs e)
{
if (e.RowType == RowType.DefaultRow)
{
var dataRowView = e.RowData as DataRowView;
var dataRow = dataRowView.Row;
var cellValue = dataRow[4].ToString();
if (cellValue != basedokumenttypnr)
{
//e.Style.TextColor = Color.Gray;
pictureBox1.Visible = true;
label1.Visible = true;
label1.Text = "Die Vorlage entspricht nicht dem Vorlagentyp des Serienbriefes." + Environment.NewLine;
label1.Text = label1.Text + "Das kann sich auf Einstellungen für Versandstrasse, Archivierung usw. auswirken.";
}
}
}
}
}