using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using OnDoc.Klassen; using Syncfusion.Windows.Forms.Tools; using Syncfusion.WinForms.Controls; using Database; using System.Security.RightsManagement; namespace OnDoc.DocMgmt { public partial class SerienbriefTemplateLoad : SfForm { private string mitarbeiternr { get; set; } = ""; public string selectedID = ""; public string file = ""; public string usedfelder = ""; public SerienbriefTemplateLoad() { InitializeComponent(); this.Style.TitleBar.BackColor = Theaming.Titelbar(); this.Style.TitleBar.ForeColor = Theaming.TitelFontColor(); this.Style.ShadowOpacity = Theaming.ShadowOpacity; this.Style.InactiveShadowOpacity = Theaming.InactivShadowOpacity; } public SerienbriefTemplateLoad(string mitarbeiternr) { InitializeComponent(); this.Style.TitleBar.BackColor = Theaming.Titelbar(); this.Style.TitleBar.ForeColor = Theaming.TitelFontColor(); this.Style.ShadowOpacity = Theaming.ShadowOpacity; this.Style.InactiveShadowOpacity = Theaming.InactivShadowOpacity; this.mitarbeiternr=mitarbeiternr; } private void SerienbriefTemplateLoad_Load(object sender, EventArgs e) { 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); this.sfDataGrid1.DataSource = db.dsdaten.Tables[0]; this.sfDataGrid1.Columns[0].Visible = false; this.sfDataGrid1.Columns[2].Visible = false; db = null; } private void sfDataGrid1_CellClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellClickEventArgs e) { try { var rowIndex = e.DataRow.RowIndex; //Get the column index value var columnIndex = e.DataColumn.ColumnIndex; var selectedItem = e.DataRow; var dataRow = (e.DataRow.RowData as DataRowView).Row; selectedID = dataRow["id"].ToString(); sfButton1.Enabled=true; sfButton3.Enabled = true; } catch { } } private void sfDataGrid1_CellDoubleClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellClickEventArgs e) { sfDataGrid1_CellClick(sender, e); sfButton1_Click(sender, e); this.Close(); } private void sfButton1_Click(object sender, EventArgs e) { if (selectedID!="") { DialogResult = DialogResult.OK; DB db = new DB(AppParams.connectionstring); db.Get_Tabledata("Select vorlage, usedfelder from ondoc_sb_vorlage where id=" + selectedID, false, true); this.file = db.dsdaten.Tables[0].Rows[0][0].ToString(); this.usedfelder = db.dsdaten.Tables[0].Rows[0][1].ToString(); db = null; this.Close(); } } private void sfButton2_Click(object sender, EventArgs e) { DialogResult=DialogResult.Cancel; this.Close(); } private void sfButton3_Click(object sender, EventArgs e) { if (MessageBox.Show("Vorlagendatei löschen", "Löschen", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DB dB = new DB(AppParams.connectionstring); dB.Exec_SQL("update ondoc_sb_vorlage set aktiv=0, mutiert_am=getdate(), mutierer=" + AppParams.CurrentMitarbeiter.ToString() + " where id=" + selectedID.ToString()); dB = null; sfButton1.Enabled = false; sfButton3.Enabled = false; load_data(); } } } }