update 20241029

master
Stefan Hutter 1 year ago
parent 6da124508d
commit 4b85e91ed9

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -13,13 +13,12 @@
<setting name="Connectionstring" serializeAs="String"> <setting name="Connectionstring" serializeAs="String">
<value>Data Source=shu01\shu00;Initial Catalog=edoka_dms;Persist Security Info=True;User ID=sa;Password=*shu29;</value> <value>Data Source=shu01\shu00;Initial Catalog=edoka_dms;Persist Security Info=True;User ID=sa;Password=*shu29;</value>
</setting> </setting>
<setting name="Connectionstring_Prod" serializeAs="String"> <setting name="NativVorlagen" serializeAs="String">
<value>Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29;</value>
</setting>
<setting name="NativVorlagen" serializeAs="String">
<value>E:\Software-Projekte\OnDoc\Nativ\</value> <value>E:\Software-Projekte\OnDoc\Nativ\</value>
</setting> </setting>
<setting name="Connectionstring_Prod" serializeAs="String">
<value>Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29;</value>
</setting>
</OnDoc.Properties.Settings> </OnDoc.Properties.Settings>
</userSettings> </userSettings>
<runtime> <runtime>

@ -58,6 +58,7 @@
this.lblVerantwortlich = new System.Windows.Forms.Label(); this.lblVerantwortlich = new System.Windows.Forms.Label();
this.lblPostzustellung = new System.Windows.Forms.Label(); this.lblPostzustellung = new System.Windows.Forms.Label();
this.lblBezeichnung = new System.Windows.Forms.Label(); this.lblBezeichnung = new System.Windows.Forms.Label();
this.txtbezeichnung = new System.Windows.Forms.TextBox();
this.GrpEmpfaenger = new System.Windows.Forms.GroupBox(); this.GrpEmpfaenger = new System.Windows.Forms.GroupBox();
this.sfDataGridEmpfaenger = new Syncfusion.WinForms.DataGrid.SfDataGrid(); this.sfDataGridEmpfaenger = new Syncfusion.WinForms.DataGrid.SfDataGrid();
this.treeViewAdv1 = new Syncfusion.Windows.Forms.Tools.TreeViewAdv(); this.treeViewAdv1 = new Syncfusion.Windows.Forms.Tools.TreeViewAdv();
@ -73,17 +74,17 @@
this.RibbonButtonExcelImport = new System.Windows.Forms.RibbonButton(); this.RibbonButtonExcelImport = new System.Windows.Forms.RibbonButton();
this.ribbonPanel4 = new System.Windows.Forms.RibbonPanel(); this.ribbonPanel4 = new System.Windows.Forms.RibbonPanel();
this.RibbonButtonEditWord = new System.Windows.Forms.RibbonButton(); this.RibbonButtonEditWord = new System.Windows.Forms.RibbonButton();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.ribbonPanel5 = new System.Windows.Forms.RibbonPanel(); this.ribbonPanel5 = new System.Windows.Forms.RibbonPanel();
this.ribbonbuttonsave = new System.Windows.Forms.RibbonButton(); this.ribbonbuttonsave = new System.Windows.Forms.RibbonButton();
this.ribbonPanel6 = new System.Windows.Forms.RibbonPanel(); this.ribbonPanel6 = new System.Windows.Forms.RibbonPanel();
this.txtbezeichnung = new System.Windows.Forms.TextBox(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.pnlLoad = new System.Windows.Forms.Panel(); this.pnlLoad = new System.Windows.Forms.Panel();
this.btnsbloadok = new System.Windows.Forms.Button(); this.sfdatagridsbload = new Syncfusion.WinForms.DataGrid.SfDataGrid();
this.btnsbloadcancel = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.btnsbloadcancel = new System.Windows.Forms.Button(); this.btnsbloadok = new System.Windows.Forms.Button();
this.sfdatagridsbload = new Syncfusion.WinForms.DataGrid.SfDataGrid(); this.ribbonButton1 = new System.Windows.Forms.RibbonButton();
this.GrpDokumentInhalt.SuspendLayout(); this.GrpDokumentInhalt.SuspendLayout();
this.groupBox8.SuspendLayout(); this.groupBox8.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cbboxteam)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cbboxteam)).BeginInit();
@ -100,8 +101,8 @@
((System.ComponentModel.ISupportInitialize)(this.treeViewAdv1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.treeViewAdv1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.GridEmpfänger)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.GridEmpfänger)).BeginInit();
this.pnlLoad.SuspendLayout(); this.pnlLoad.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.sfdatagridsbload)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.sfdatagridsbload)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// GrpDokumentInhalt // GrpDokumentInhalt
@ -370,6 +371,13 @@
this.lblBezeichnung.TabIndex = 8; this.lblBezeichnung.TabIndex = 8;
this.lblBezeichnung.Text = "Bezeichnung"; this.lblBezeichnung.Text = "Bezeichnung";
// //
// txtbezeichnung
//
this.txtbezeichnung.Location = new System.Drawing.Point(120, 20);
this.txtbezeichnung.Name = "txtbezeichnung";
this.txtbezeichnung.Size = new System.Drawing.Size(354, 20);
this.txtbezeichnung.TabIndex = 9;
//
// GrpEmpfaenger // GrpEmpfaenger
// //
this.GrpEmpfaenger.Controls.Add(this.sfDataGridEmpfaenger); this.GrpEmpfaenger.Controls.Add(this.sfDataGridEmpfaenger);
@ -604,10 +612,6 @@
this.RibbonButtonEditWord.Text = "Vorlage bearbeiten"; this.RibbonButtonEditWord.Text = "Vorlage bearbeiten";
this.RibbonButtonEditWord.ToolTip = "Vorlage bearbeiten"; this.RibbonButtonEditWord.ToolTip = "Vorlage bearbeiten";
// //
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// ribbonPanel5 // ribbonPanel5
// //
this.ribbonPanel5.Items.Add(this.ribbonbuttonsave); this.ribbonPanel5.Items.Add(this.ribbonbuttonsave);
@ -625,15 +629,13 @@
// //
// ribbonPanel6 // ribbonPanel6
// //
this.ribbonPanel6.Items.Add(this.ribbonButton1);
this.ribbonPanel6.Name = "ribbonPanel6"; this.ribbonPanel6.Name = "ribbonPanel6";
this.ribbonPanel6.Text = "ribbonPanel6"; this.ribbonPanel6.Text = "";
// //
// txtbezeichnung // openFileDialog1
// //
this.txtbezeichnung.Location = new System.Drawing.Point(120, 20); this.openFileDialog1.FileName = "openFileDialog1";
this.txtbezeichnung.Name = "txtbezeichnung";
this.txtbezeichnung.Size = new System.Drawing.Size(354, 20);
this.txtbezeichnung.TabIndex = 9;
// //
// pnlLoad // pnlLoad
// //
@ -643,21 +645,33 @@
this.pnlLoad.Controls.Add(this.btnsbloadcancel); this.pnlLoad.Controls.Add(this.btnsbloadcancel);
this.pnlLoad.Controls.Add(this.panel1); this.pnlLoad.Controls.Add(this.panel1);
this.pnlLoad.Controls.Add(this.btnsbloadok); this.pnlLoad.Controls.Add(this.btnsbloadok);
this.pnlLoad.Location = new System.Drawing.Point(117, 52); this.pnlLoad.Location = new System.Drawing.Point(148, 85);
this.pnlLoad.Name = "pnlLoad"; this.pnlLoad.Name = "pnlLoad";
this.pnlLoad.Size = new System.Drawing.Size(965, 637); this.pnlLoad.Size = new System.Drawing.Size(965, 637);
this.pnlLoad.TabIndex = 4; this.pnlLoad.TabIndex = 4;
this.pnlLoad.Visible = false; this.pnlLoad.Visible = false;
// //
// btnsbloadok // sfdatagridsbload
// //
this.btnsbloadok.Location = new System.Drawing.Point(870, 600); this.sfdatagridsbload.AccessibleName = "Table";
this.btnsbloadok.Name = "btnsbloadok"; this.sfdatagridsbload.Dock = System.Windows.Forms.DockStyle.Top;
this.btnsbloadok.Size = new System.Drawing.Size(75, 23); this.sfdatagridsbload.Location = new System.Drawing.Point(0, 47);
this.btnsbloadok.TabIndex = 0; this.sfdatagridsbload.Name = "sfdatagridsbload";
this.btnsbloadok.Text = "öffnen"; this.sfdatagridsbload.Size = new System.Drawing.Size(961, 489);
this.btnsbloadok.UseVisualStyleBackColor = true; this.sfdatagridsbload.TabIndex = 3;
this.btnsbloadok.Click += new System.EventHandler(this.bntsbloadok_Click); this.sfdatagridsbload.Text = "sfDataGrid1";
this.sfdatagridsbload.CellClick += new Syncfusion.WinForms.DataGrid.Events.CellClickEventHandler(this.sfdatagridsbload_CellClick);
this.sfdatagridsbload.Click += new System.EventHandler(this.Serienbrief_Load);
//
// btnsbloadcancel
//
this.btnsbloadcancel.Location = new System.Drawing.Point(9, 600);
this.btnsbloadcancel.Name = "btnsbloadcancel";
this.btnsbloadcancel.Size = new System.Drawing.Size(75, 23);
this.btnsbloadcancel.TabIndex = 2;
this.btnsbloadcancel.Text = "abbruch";
this.btnsbloadcancel.UseVisualStyleBackColor = true;
this.btnsbloadcancel.Click += new System.EventHandler(this.btnsbloadcancel_Click);
// //
// panel1 // panel1
// //
@ -678,25 +692,24 @@
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.Text = "Serienbrief öffnen"; this.label1.Text = "Serienbrief öffnen";
// //
// btnsbloadcancel // btnsbloadok
// //
this.btnsbloadcancel.Location = new System.Drawing.Point(9, 600); this.btnsbloadok.Location = new System.Drawing.Point(870, 600);
this.btnsbloadcancel.Name = "btnsbloadcancel"; this.btnsbloadok.Name = "btnsbloadok";
this.btnsbloadcancel.Size = new System.Drawing.Size(75, 23); this.btnsbloadok.Size = new System.Drawing.Size(75, 23);
this.btnsbloadcancel.TabIndex = 2; this.btnsbloadok.TabIndex = 0;
this.btnsbloadcancel.Text = "abbruch"; this.btnsbloadok.Text = "öffnen";
this.btnsbloadcancel.UseVisualStyleBackColor = true; this.btnsbloadok.UseVisualStyleBackColor = true;
this.btnsbloadcancel.Click += new System.EventHandler(this.btnsbloadcancel_Click); this.btnsbloadok.Click += new System.EventHandler(this.bntsbloadok_Click);
// //
// sfdatagridsbload // ribbonButton1
// //
this.sfdatagridsbload.AccessibleName = "Table"; this.ribbonButton1.Image = global::OnDoc.Properties.Resources.EditDoc_32x32_32;
this.sfdatagridsbload.Dock = System.Windows.Forms.DockStyle.Top; this.ribbonButton1.LargeImage = global::OnDoc.Properties.Resources.EditDoc_32x32_32;
this.sfdatagridsbload.Location = new System.Drawing.Point(0, 47); this.ribbonButton1.Name = "ribbonButton1";
this.sfdatagridsbload.Name = "sfdatagridsbload"; this.ribbonButton1.SmallImage = global::OnDoc.Properties.Resources.EditDoc_24x24_32;
this.sfdatagridsbload.Size = new System.Drawing.Size(961, 489); this.ribbonButton1.Text = "Vorlage bearbeiten";
this.sfdatagridsbload.TabIndex = 3; this.ribbonButton1.Click += new System.EventHandler(this.ribbonButton1_Click);
this.sfdatagridsbload.Text = "sfDataGrid1";
// //
// Serienbrief // Serienbrief
// //
@ -733,9 +746,9 @@
((System.ComponentModel.ISupportInitialize)(this.treeViewAdv1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.treeViewAdv1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.GridEmpfänger)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.GridEmpfänger)).EndInit();
this.pnlLoad.ResumeLayout(false); this.pnlLoad.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.sfdatagridsbload)).EndInit();
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.panel1.PerformLayout(); this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.sfdatagridsbload)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -791,5 +804,6 @@
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private Syncfusion.WinForms.DataGrid.SfDataGrid sfdatagridsbload; private Syncfusion.WinForms.DataGrid.SfDataGrid sfdatagridsbload;
private System.Windows.Forms.RibbonButton ribbonButton1;
} }
} }

@ -9,9 +9,13 @@ using System.Runtime.Remoting.Messaging;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Linq;
using Database; using Database;
using DOCGEN.Klassen;
using Helper; using Helper;
using Model; using Model;
using NLog;
using OnDoc.DocMgmt;
using OnDoc.Klassen; using OnDoc.Klassen;
using OnDoc.UIControls.Administrator; using OnDoc.UIControls.Administrator;
using Syncfusion.Windows.Forms.Tools; using Syncfusion.Windows.Forms.Tools;
@ -24,12 +28,14 @@ namespace OnDoc.UIControls
{ {
public partial class Serienbrief : SfForm public partial class Serienbrief : SfForm
{ {
private int dokumenttypnr = 0; //private int dokumenttypnr = 0;
private int officevorlagenr = 0; private int officevorlagenr = 0;
private int profilnr = 0; private int profilnr = 0;
private serienbrief sb = new serienbrief(); private serienbrief sb = new serienbrief();
private int serienbriefnr = 0; private int serienbriefnr = 0;
private DataSet dsempfaenger = new DataSet();
//private DataSet dsempfaenger = new DataSet();
private int selectedsbnr = 0;
public Serienbrief() public Serienbrief()
{ {
InitializeComponent(); InitializeComponent();
@ -132,18 +138,18 @@ namespace OnDoc.UIControls
return; return;
} }
DB dB = new DB(AppParams.connectionstring); DB dB = new DB(AppParams.connectionstring);
dsempfaenger.Tables[0].Rows.Clear(); sb.dsempfaenger.Tables[0].Rows.Clear();
foreach (System.Data.DataRow dr in importdata.Rows) foreach (System.Data.DataRow dr in importdata.Rows)
{ {
System.Data.DataRow r1 = dsempfaenger.Tables[0].NewRow(); System.Data.DataRow r1 = sb.dsempfaenger.Tables[0].NewRow();
foreach (DataColumn col in importdata.Columns) foreach (DataColumn col in sb.dsempfaenger.Tables[0].Columns)
{ {
try try
{ {
r1[col.ColumnName] = dr[col.ColumnName]; r1[col.ColumnName] = dr[col.ColumnName];
} }
catch { } catch { r1[col.ColumnName] = ""; }
} }
r1["Status"] = 0; r1["Status"] = 0;
@ -151,10 +157,10 @@ namespace OnDoc.UIControls
dB.Get_Tabledata("Select bkpar00 from partner where nrpar00=" + r1[0].ToString(), false, true); dB.Get_Tabledata("Select bkpar00 from partner where nrpar00=" + r1[0].ToString(), false, true);
if (dB.dsdaten.Tables[0].Rows.Count < 1) r1["Error"] = 1; else r1["Error"] = 0; if (dB.dsdaten.Tables[0].Rows.Count < 1) r1["Error"] = 1; else r1["Error"] = 0;
r1[1] = dB.dsdaten.Tables[0].Rows[0][0].ToString(); r1[1] = dB.dsdaten.Tables[0].Rows[0][0].ToString();
dsempfaenger.Tables[0].Rows.Add(r1); sb.dsempfaenger.Tables[0].Rows.Add(r1);
} }
dB = null; dB = null;
refresh_empfaenger(dsempfaenger.Tables[0]); refresh_empfaenger(sb.dsempfaenger.Tables[0]);
//sfDataGridEmpfaenger.DataSource = importdata; //sfDataGridEmpfaenger.DataSource = importdata;
} }
} }
@ -185,17 +191,26 @@ namespace OnDoc.UIControls
string xml = bh.DecodeBase64(); string xml = bh.DecodeBase64();
string filename = AppParams.tempdir + @"\tmpsb.xml"; string filename = AppParams.tempdir + @"\tmpsb.xml";
System.IO.File.WriteAllText(filename, xml); System.IO.File.WriteAllText(filename, xml);
dsempfaenger.Tables.Clear(); //dsempfaenger.Tables.Clear();
dsempfaenger.ReadXml(filename); //dsempfaenger.ReadXml(filename);
dsempfaenger.Tables[0].Columns.Add("Status"); //dsempfaenger.Tables[0].Columns.Add("Status");
dsempfaenger.Tables[0].Columns.Add("Error"); //dsempfaenger.Tables[0].Columns.Add("Error");
sb.dsempfaenger = new DataSet();
refresh_empfaenger(dsempfaenger.Tables[0]); sb.dsempfaenger.Tables.Clear();
sb.dsempfaenger.ReadXml(filename);
sb.dsempfaenger.Tables[0].Columns.Add("Status");
sb.dsempfaenger.Tables[0].Rows[0]["Status"] = "0";
sb.dsempfaenger.Tables[0].Columns.Add("Error");
sb.dsempfaenger.Tables[0].Rows[0]["Error"] = "0";
sb.dsempfaenger.AcceptChanges();
refresh_empfaenger(sb.dsempfaenger.Tables[0]);
System.IO.File.Delete(filename); System.IO.File.Delete(filename);
} }
private void RibbonButtonNew_Click(object sender, EventArgs e) private void RibbonButtonNew_Click(object sender, EventArgs e)
{ {
OnDoc.DocMgmt.DokTypSelect DokTypSelect = new OnDoc.DocMgmt.DokTypSelect(); OnDoc.DocMgmt.DokTypSelect DokTypSelect = new OnDoc.DocMgmt.DokTypSelect();
DokTypSelect.vorlagentype = 1; DokTypSelect.vorlagentype = 1;
DokTypSelect.ShowDialog(this); DokTypSelect.ShowDialog(this);
@ -203,14 +218,15 @@ namespace OnDoc.UIControls
{ {
this.sb = null; this.sb = null;
this.sb = new serienbrief(); this.sb = new serienbrief();
dokumenttypnr = DokTypSelect.dokumenttypnr; sb.dokumenttypnr = DokTypSelect.dokumenttypnr;
GrpDokumentInhalt.Enabled = true;
update_serienbrief_details(true, dokumenttypnr, 0);
init_empfaenger(0);
vorlagenfelder(dokumenttypnr);
refresh_empfaenger(dsempfaenger.Tables[0]);
update_serienbrief_details(true, sb.dokumenttypnr, 0);
init_empfaenger(0);
vorlagenfelder(sb.dokumenttypnr);
refresh_empfaenger(sb.dsempfaenger.Tables[0]);
update_screen();
update_serienbriefdaten(true); update_serienbriefdaten(true);
vorlage_auslesen_und_speichern(); vorlage_auslesen_und_speichern();
} }
else else
@ -222,13 +238,18 @@ namespace OnDoc.UIControls
private void vorlage_auslesen_und_speichern() private void vorlage_auslesen_und_speichern()
{ {
DB dB = new DB(AppParams.connectionstring);
} dB.Get_ApplicationType_from_Vorlage(sb.officevorlagenr);
string Apptype = "";
Apptype = dB.dsdaten.Tables[0].Rows[0][1].ToString();
string filename = dB.get_vorlage_to_file(sb.officevorlagenr.ToString(),AppParams.tempdir,sb.serienbriefnr.ToString()+"."+Apptype);
sb.filename = dB.save_sb_vorlage_to_db(filename,Apptype,sb.serienbriefnr);
}
private void vorlagenfelder(int dokumenttypnr) private void vorlagenfelder(int dokumenttypnr)
{ {
DB db = new DB(AppParams.connectionstring); DB db = new DB(AppParams.connectionstring);
db.clear_parameter(); db.clear_parameter();
db.add_parameter("@dokumenttypnr", dokumenttypnr.ToString()); db.add_parameter("@dokumenttypnr", sb.dokumenttypnr.ToString());
db.Get_Tabledata("sp_edex_sb_get_vorlagenfelder", true, false); db.Get_Tabledata("sp_edex_sb_get_vorlagenfelder", true, false);
string s = ""; string s = "";
for (int i = 0, loopTo = db.dsdaten.Tables[0].Rows.Count - 1; i <= loopTo; i++) for (int i = 0, loopTo = db.dsdaten.Tables[0].Rows.Count - 1; i <= loopTo; i++)
@ -236,34 +257,35 @@ namespace OnDoc.UIControls
try try
{ {
string X; string X;
X = this.dsempfaenger.Tables[0].Rows[0][db.dsdaten.Tables[0].Rows[i][0].ToString()].ToString(); X = sb.dsempfaenger.Tables[0].Rows[0][db.dsdaten.Tables[0].Rows[i][0].ToString()].ToString();
} }
catch catch
{ {
this.dsempfaenger.Tables[0].Columns.Add(db.dsdaten.Tables[0].Rows[i][0].ToString()); sb.dsempfaenger.Tables[0].Columns.Add(db.dsdaten.Tables[0].Rows[i][0].ToString());
this.dsempfaenger.Tables[0].Rows[0][i] = ""; sb.dsempfaenger.Tables[0].Rows[0][db.dsdaten.Tables[0].Rows[i][0].ToString()] = "";
this.dsempfaenger.Tables[1].Columns.Add(db.dsdaten.Tables[0].Rows[i][0].ToString()); sb.dsempfaenger.Tables[1].Columns.Add(db.dsdaten.Tables[0].Rows[i][0].ToString());
try try
{ {
if (Convert.ToBoolean(db.dsdaten.Tables[0].Rows[i][1])==true) if (Convert.ToBoolean(db.dsdaten.Tables[0].Rows[i][1])==true)
{ {
this.dsempfaenger.Tables[1].Rows[0][db.dsdaten.Tables[0].Rows[i][0].ToString()] = 1; sb.dsempfaenger.Tables[1].Rows[0][db.dsdaten.Tables[0].Rows[i][0].ToString()] = 1;
} }
else else
{ {
this.dsempfaenger.Tables[1].Rows[0][db.dsdaten.Tables[0].Rows[i][0].ToString()] = 0; sb.dsempfaenger.Tables[1].Rows[0][db.dsdaten.Tables[0].Rows[i][0].ToString()] = 0;
} }
} }
catch catch
{ {
this.dsempfaenger.Tables[1].Rows[0][db.dsdaten.Tables[0].Rows[i][0].ToString()] = 0; sb.dsempfaenger.Tables[1].Rows[0][db.dsdaten.Tables[0].Rows[i][0].ToString()] = 0;
} }
s = s + "- " + db.dsdaten.Tables[0].Rows[i][0].ToString() + System.Environment.NewLine; s = s + "- " + db.dsdaten.Tables[0].Rows[i][0].ToString() + System.Environment.NewLine;
} }
} }
sb.dsempfaenger.AcceptChanges();
if (s !="") { MessageBox.Show("Folgende Spalten wurden aufgrund der gewählten Vorlage zur Liste hinzugefügt"+System.Environment.NewLine+ s,"Serienbrief",MessageBoxButtons.OK,MessageBoxIcon.Information); } if (s !="") { MessageBox.Show("Folgende Spalten wurden aufgrund der gewählten Vorlage zur Liste hinzugefügt"+System.Environment.NewLine+ s,"Serienbrief",MessageBoxButtons.OK,MessageBoxIcon.Information); }
//foreach (System.Data.DataRow dr in db.dsdaten.Tables[0].Rows) //foreach (System.Data.DataRow dr in db.dsdaten.Tables[0].Rows)
@ -287,9 +309,9 @@ namespace OnDoc.UIControls
DB db = new DB(AppParams.connectionstring); DB db = new DB(AppParams.connectionstring);
if (newsb) if (newsb)
{ {
db.Get_Tabledata("Select bezeichnung,office_vorlagenr from dokumenttyp where dokumenttypnr=" + dokumenttypnr.ToString(), false, true); db.Get_Tabledata("Select bezeichnung,office_vorlagenr from dokumenttyp where dokumenttypnr=" + sb.dokumenttypnr.ToString(), false, true);
this.txtbezeichnung.Text = db.dsdaten.Tables[0].Rows[0][0].ToString(); sb.bezeichnung= db.dsdaten.Tables[0].Rows[0][0].ToString();
officevorlagenr = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0][1]); sb.officevorlagenr = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0][1]);
} }
@ -302,13 +324,14 @@ namespace OnDoc.UIControls
sb.aktiv = true; sb.aktiv = true;
sb.mutiert_am = DateTime.Now; sb.mutiert_am = DateTime.Now;
sb.mutierer = AppParams.CurrentMitarbieter; sb.mutierer = AppParams.CurrentMitarbieter;
sb.dokumenttypnr=this.dokumenttypnr; sb.verantwortlich=AppParams.CurrentMitarbieter;
try {sb.postzustellung = Convert.ToInt32(cbboxpostzustellung.SelectedValue.ToString());} catch { sb.postzustellung = 0; } try {sb.postzustellung = Convert.ToInt32(cbboxpostzustellung.SelectedValue.ToString());} catch { sb.postzustellung = 0; }
try { sb.unterschriftlinks = Convert.ToInt32(cbboxunterschriftlinks.SelectedValue.ToString()); } catch { sb.unterschriftlinks = 0; } try { sb.unterschriftlinks = Convert.ToInt32(cbboxunterschriftlinks.SelectedValue.ToString()); } catch { sb.unterschriftlinks = 0; }
try { sb.unterschriftrechts = Convert.ToInt32(cbboxunterschriftrechts.SelectedValue.ToString()); } catch { sb.unterschriftrechts = 0;} try { sb.unterschriftrechts = Convert.ToInt32(cbboxunterschriftrechts.SelectedValue.ToString()); } catch { sb.unterschriftrechts = 0;}
try { sb.team = Convert.ToInt32(cbboxteam.SelectedValue.ToString()); } catch { sb.team = 0; } try { sb.team = Convert.ToInt32(cbboxteam.SelectedValue.ToString()); } catch { sb.team = 0; }
DB db = new DB(AppParams.connectionstring); DB db = new DB(AppParams.connectionstring);
this.serienbriefnr=db.Save_Serienbrief(sb); sb.serienbriefnr=db.Save_Serienbrief(sb,AppParams.tempdir);
db.save_sb_vorlage_to_db(sb.filename, "", sb.serienbriefnr);
} }
@ -322,7 +345,7 @@ namespace OnDoc.UIControls
{ {
try try
{ {
DataView dv = new DataView(dsempfaenger.Tables[0]); DataView dv = new DataView(sb.dsempfaenger.Tables[0]);
dv.RowFilter = "Status = 0"; dv.RowFilter = "Status = 0";
treeViewAdv1.Nodes[0].Text = "In Bearbeitung (" + dv.Count.ToString() + ")"; treeViewAdv1.Nodes[0].Text = "In Bearbeitung (" + dv.Count.ToString() + ")";
dv.RowFilter = "Error <> 0"; dv.RowFilter = "Error <> 0";
@ -341,7 +364,7 @@ namespace OnDoc.UIControls
{ {
{ {
string nodetext = treeViewAdv1.SelectedNode.Text; string nodetext = treeViewAdv1.SelectedNode.Text;
DataView dv = new DataView(dsempfaenger.Tables[0]); DataView dv = new DataView(sb.dsempfaenger.Tables[0]);
switch (nodetext.Substring(0, 5)) switch (nodetext.Substring(0, 5))
{ {
@ -385,11 +408,30 @@ namespace OnDoc.UIControls
sfdatagridsbload.DataSource = db.dsdaten.Tables[0]; sfdatagridsbload.DataSource = db.dsdaten.Tables[0];
this.pnlLoad.Left = this.Left; this.pnlLoad.Left = this.Left;
this.pnlLoad.Width = this.Width; this.pnlLoad.Width = this.Width;
Application.DoEvents();
} }
private void bntsbloadok_Click(object sender, EventArgs e) private void bntsbloadok_Click(object sender, EventArgs e)
{ {
DB db = new DB(AppParams.connectionstring);
sb = new serienbrief();
sb.dsempfaenger = new DataSet();
sb.serienbriefnr = selectedsbnr;
sb = db.Load_Serienbrief(sb,AppParams.tempdir);
sb.filename= db.get_sb_vorlage(sb.serienbriefnr,AppParams.tempdir);
pnlLoad.Visible = false; pnlLoad.Visible = false;
update_screen();
refresh_empfaenger(sb.dsempfaenger.Tables[0]);
db = null;
}
private void update_screen() {
txtbezeichnung.Text = sb.bezeichnung;
cbboxpostzustellung.SelectedValue = sb.postzustellung;
cbboxunterschriftlinks.SelectedValue = sb.unterschriftlinks;
cbboxunterschriftrechts.SelectedValue=sb.unterschriftrechts;
cbboxverantwortlich.SelectedValue = sb.verantwortlich;
update_zahlen();
GrpDokumentInhalt.Enabled = true;
} }
@ -397,5 +439,20 @@ namespace OnDoc.UIControls
{ {
pnlLoad.Visible = false; pnlLoad.Visible = false;
} }
private void sfdatagridsbload_CellClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellClickEventArgs e)
{
var selectedItem = e.DataRow;
var dataRow = (e.DataRow.RowData as DataRowView).Row;
selectedsbnr = Convert.ToInt32( dataRow["serienbriefnr"].ToString());
}
private void ribbonButton1_Click(object sender, EventArgs e)
{
SerienbriefBearbeitung sbedit = new SerienbriefBearbeitung(this.sb);
sbedit.Show();
}
} }
} }

@ -30,26 +30,80 @@
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SerienbriefBearbeitung)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SerienbriefBearbeitung));
this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.sfdatagridstandard = new Syncfusion.WinForms.DataGrid.SfDataGrid();
this.sfdatagridDokspezifisch = new Syncfusion.WinForms.DataGrid.SfDataGrid();
this.sfdatagridUsed = new Syncfusion.WinForms.DataGrid.SfDataGrid();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.sfdatagridstandard)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sfdatagridDokspezifisch)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sfdatagridUsed)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// toolStrip1 // toolStrip1
// //
this.toolStrip1.Location = new System.Drawing.Point(0, 0); this.toolStrip1.Location = new System.Drawing.Point(2, 2);
this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(386, 25); this.toolStrip1.Size = new System.Drawing.Size(382, 25);
this.toolStrip1.TabIndex = 0; this.toolStrip1.TabIndex = 0;
this.toolStrip1.Text = "toolStrip1"; this.toolStrip1.Text = "toolStrip1";
// //
// groupBox1
//
this.groupBox1.Controls.Add(this.sfdatagridUsed);
this.groupBox1.Controls.Add(this.sfdatagridDokspezifisch);
this.groupBox1.Controls.Add(this.sfdatagridstandard);
this.groupBox1.Location = new System.Drawing.Point(5, 30);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(379, 435);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "groupBox1";
//
// sfdatagridstandard
//
this.sfdatagridstandard.AccessibleName = "Table";
this.sfdatagridstandard.Location = new System.Drawing.Point(6, 19);
this.sfdatagridstandard.Name = "sfdatagridstandard";
this.sfdatagridstandard.Size = new System.Drawing.Size(367, 101);
this.sfdatagridstandard.TabIndex = 0;
this.sfdatagridstandard.Text = "sfDataGrid1";
//
// sfdatagridDokspezifisch
//
this.sfdatagridDokspezifisch.AccessibleName = "Table";
this.sfdatagridDokspezifisch.Location = new System.Drawing.Point(6, 135);
this.sfdatagridDokspezifisch.Name = "sfdatagridDokspezifisch";
this.sfdatagridDokspezifisch.Size = new System.Drawing.Size(367, 101);
this.sfdatagridDokspezifisch.TabIndex = 1;
this.sfdatagridDokspezifisch.Text = "sfDataGrid1";
//
// sfdatagridUsed
//
this.sfdatagridUsed.AccessibleName = "Table";
this.sfdatagridUsed.Location = new System.Drawing.Point(6, 255);
this.sfdatagridUsed.Name = "sfdatagridUsed";
this.sfdatagridUsed.Size = new System.Drawing.Size(367, 101);
this.sfdatagridUsed.TabIndex = 2;
this.sfdatagridUsed.Text = "sfDataGrid1";
//
// SerienbriefBearbeitung // SerienbriefBearbeitung
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(386, 478); this.ClientSize = new System.Drawing.Size(386, 478);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.toolStrip1); this.Controls.Add(this.toolStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "SerienbriefBearbeitung"; this.Name = "SerienbriefBearbeitung";
this.Style.MdiChild.IconHorizontalAlignment = System.Windows.Forms.HorizontalAlignment.Center;
this.Style.MdiChild.IconVerticalAlignment = System.Windows.Forms.VisualStyles.VerticalAlignment.Center;
this.Text = "SerienbriefBearbeitung"; this.Text = "SerienbriefBearbeitung";
this.Load += new System.EventHandler(this.SerienbriefBearbeitung_Load); this.Load += new System.EventHandler(this.SerienbriefBearbeitung_Load);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.sfdatagridstandard)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.sfdatagridDokspezifisch)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.sfdatagridUsed)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -58,5 +112,9 @@
#endregion #endregion
private System.Windows.Forms.ToolStrip toolStrip1; private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.GroupBox groupBox1;
private Syncfusion.WinForms.DataGrid.SfDataGrid sfdatagridUsed;
private Syncfusion.WinForms.DataGrid.SfDataGrid sfdatagridDokspezifisch;
private Syncfusion.WinForms.DataGrid.SfDataGrid sfdatagridstandard;
} }
} }

@ -7,11 +7,14 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Model;
using OnDoc.Klassen; using OnDoc.Klassen;
using OnDoc.UIControls;
using Syncfusion.Windows.Forms.Tools; using Syncfusion.Windows.Forms.Tools;
using Syncfusion.WinForms.Controls; using Syncfusion.WinForms.Controls;
using Syncfusion.WinForms.DataGrid; using Syncfusion.WinForms.DataGrid;
using Syncfusion.WinForms.DataGrid.Interactivity; using Syncfusion.WinForms.DataGrid.Interactivity;
using Windows.Media.Ocr;
namespace OnDoc.DocMgmt namespace OnDoc.DocMgmt
{ {
@ -21,6 +24,7 @@ namespace OnDoc.DocMgmt
DataTable IDVFelder = new DataTable(); DataTable IDVFelder = new DataTable();
DataTable UsedFelder = new DataTable(); DataTable UsedFelder = new DataTable();
int dokumenttypnr = 0; int dokumenttypnr = 0;
serienbrief sb = new serienbrief();
public SerienbriefBearbeitung() public SerienbriefBearbeitung()
{ {
InitializeComponent(); InitializeComponent();
@ -28,23 +32,128 @@ namespace OnDoc.DocMgmt
this.Style.TitleBar.ForeColor = Theaming.TitelFontColor(); this.Style.TitleBar.ForeColor = Theaming.TitelFontColor();
} }
public SerienbriefBearbeitung(serienbrief sb)
{
InitializeComponent();
this.Style.TitleBar.BackColor = Theaming.Titelbar();
this.Style.TitleBar.ForeColor = Theaming.TitelFontColor();
this.sb = sb;
}
private void SerienbriefBearbeitung_Load(object sender, EventArgs e) private void SerienbriefBearbeitung_Load(object sender, EventArgs e)
{ {
StdFelder = get_vorlagenfelder(dokumenttypnr, 0); StdFelder = get_vorlagenfelder(sb.dokumenttypnr, 0);
IDVFelder = get_vorlagenfelder(dokumenttypnr, 1);
foreach (System.Data.DataRow dr in StdFelder.Rows)
{
dr[1] = dr[1].ToString().Replace(System.Environment.NewLine, " ");
}
StdFelder.AcceptChanges();
sfdatagridstandard.RowHeight = 17;
sfdatagridstandard.DataSource = StdFelder;
IDVFelder = get_vorlagenfelder(sb.dokumenttypnr, 1);
foreach (System.Data.DataRow dr in IDVFelder.Rows)
{
dr[1] = dr[1].ToString().Replace(System.Environment.NewLine, " ");
}
IDVFelder.AcceptChanges();
sfdatagridDokspezifisch.DataSource = IDVFelder;
sfdatagridDokspezifisch.RowHeight= 17;
init_used_felder();
} }
private DataTable get_vorlagenfelder(int dokumenttypnr, int type) { private DataTable get_vorlagenfelder(int dokumenttypnr, int type) {
Database.DB db = new Database.DB(AppParams.connectionstring); Database.DB db = new Database.DB(AppParams.connectionstring);
db.clear_parameter(); db.clear_parameter();
db.add_parameter("@dokumenttypnr", dokumenttypnr.ToString()); db.add_parameter("@dokumenttypnr", sb.dokumenttypnr.ToString());
db.add_parameter("@type", type.ToString()); db.add_parameter("@type", type.ToString());
db.Get_Tabledata("sp_edex_sp_get_standardvorlagenfelder",true,false); db.Get_Tabledata("sp_edex_sb_get_standardvorlagenfelder",true,false);
return db.dsdaten.Tables[0]; return db.dsdaten.Tables[0];
} }
private Microsoft.Office.Interop.Word.Application word;
private Microsoft.Office.Interop.Word.Document doc;
public void load_document()
{
word = new Microsoft.Office.Interop.Word.Application();
doc = new Microsoft.Office.Interop.Word.Document();
word.Documents.Open(sb.filename);
doc = word.ActiveDocument;
word.Visible= true;
word.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMaximize;
}
private void get_usedfelder(ref System.Data.DataTable list)
{
list = get_vorlagenfelder(sb.dokumenttypnr, 1);
int i;
string s;
bool dodelete = false;
foreach (System.Data.DataRow row in list.Rows)
{
dodelete = false;
if (row["Feldname"] != "")
{
// ContentControls
try
{
if (row["Feldname"].ToString().Substring(0, 3) == "cc_")
{
s = row["Feldname"].ToString(); ;
}
else
{
s = word.ActiveDocument.FormFields[row["feldname"].ToString()].Name.ToString();
}
}
catch
{
dodelete = true;
}
}
if (row["Beginntextmarke"] != "")
{
try
{
s = word.ActiveDocument.Bookmarks[row["beginntextmarke"].ToString()].Name.ToString();
}
catch
{
dodelete = true;
}
}
if (row["endetextmarke"] != "")
{
try
{
s = word.ActiveDocument.Bookmarks[row["endetextmarke"].ToString()].Name.ToString();
}
catch
{
dodelete = true;
}
}
if (dodelete)
row.Delete();
}
list.AcceptChanges();
sfdatagridUsed.DataSource= list;
}
public DataTable init_used_felder() public DataTable init_used_felder()
{ return null; }
{
load_document();
get_usedfelder(ref UsedFelder);
return null;
}
} }
} }

@ -47,5 +47,18 @@ namespace OnDoc.Properties {
this["NativVorlagen"] = value; this["NativVorlagen"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=shu01\\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=" +
"sa;Password=*shu29;")]
public string Connectionstring_Prod {
get {
return ((string)(this["Connectionstring_Prod"]));
}
set {
this["Connectionstring_Prod"] = value;
}
}
} }
} }

@ -8,5 +8,8 @@
<Setting Name="NativVorlagen" Type="System.String" Scope="User"> <Setting Name="NativVorlagen" Type="System.String" Scope="User">
<Value Profile="(Default)">E:\Software-Projekte\OnDoc\Nativ\</Value> <Value Profile="(Default)">E:\Software-Projekte\OnDoc\Nativ\</Value>
</Setting> </Setting>
<Setting Name="Connectionstring_Prod" Type="System.String" Scope="User">
<Value Profile="(Default)">Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29;</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -13,12 +13,12 @@
<setting name="Connectionstring" serializeAs="String"> <setting name="Connectionstring" serializeAs="String">
<value>Data Source=shu01\shu00;Initial Catalog=edoka_dms;Persist Security Info=True;User ID=sa;Password=*shu29;</value> <value>Data Source=shu01\shu00;Initial Catalog=edoka_dms;Persist Security Info=True;User ID=sa;Password=*shu29;</value>
</setting> </setting>
<setting name="Connectionstring_Prod" serializeAs="String">
<value>Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29;</value>
</setting>
<setting name="NativVorlagen" serializeAs="String"> <setting name="NativVorlagen" serializeAs="String">
<value>E:\Software-Projekte\OnDoc\Nativ\</value> <value>E:\Software-Projekte\OnDoc\Nativ\</value>
</setting> </setting>
<setting name="Connectionstring_Prod" serializeAs="String">
<value>Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29;</value>
</setting>
</OnDoc.Properties.Settings> </OnDoc.Properties.Settings>
</userSettings> </userSettings>
<runtime> <runtime>

Binary file not shown.

Binary file not shown.

@ -13,12 +13,12 @@
<setting name="Connectionstring" serializeAs="String"> <setting name="Connectionstring" serializeAs="String">
<value>Data Source=shu01\shu00;Initial Catalog=edoka_dms;Persist Security Info=True;User ID=sa;Password=*shu29;</value> <value>Data Source=shu01\shu00;Initial Catalog=edoka_dms;Persist Security Info=True;User ID=sa;Password=*shu29;</value>
</setting> </setting>
<setting name="Connectionstring_Prod" serializeAs="String">
<value>Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29;</value>
</setting>
<setting name="NativVorlagen" serializeAs="String"> <setting name="NativVorlagen" serializeAs="String">
<value>E:\Software-Projekte\OnDoc\Nativ\</value> <value>E:\Software-Projekte\OnDoc\Nativ\</value>
</setting> </setting>
<setting name="Connectionstring_Prod" serializeAs="String">
<value>Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29;</value>
</setting>
</OnDoc.Properties.Settings> </OnDoc.Properties.Settings>
</userSettings> </userSettings>
<runtime> <runtime>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -14,6 +14,7 @@ using System.Diagnostics.Eventing.Reader;
using Logging; using Logging;
using System.Configuration; using System.Configuration;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using NLog.LayoutRenderers;
@ -279,14 +280,14 @@ namespace Database
} }
public string get_vorlage_to_file(string nr, string tempdir, string dokumentid) public string get_vorlage_to_file(string nr, string tempdir, string dokumentid)
{ {
string filename = "";
SqlConnection conn = new SqlConnection(connectionstring); SqlConnection conn = new SqlConnection(connectionstring);
SqlCommand sc = new SqlCommand("Select vorlage from office_vorlage_datei where dbo.office_vorlage_datei.office_vorlage_dateinr=" + nr, conn); SqlCommand sc = new SqlCommand("Select vorlage from office_vorlage_datei where dbo.office_vorlage_datei.office_vorlage_dateinr=" + nr, conn);
conn.Open(); conn.Open();
SqlDataReader sqldr = sc.ExecuteReader(); SqlDataReader sqldr = sc.ExecuteReader();
while (sqldr.Read()) while (sqldr.Read())
{ {
string filename = tempdir + @"\" + dokumentid; filename = tempdir + @"\" + dokumentid;
byte[] attachment = (byte[])sqldr.GetValue(0); byte[] attachment = (byte[])sqldr.GetValue(0);
FileStream fs = new FileStream(filename, FileMode.Create); FileStream fs = new FileStream(filename, FileMode.Create);
fs.Write(attachment, 0, attachment.Length); fs.Write(attachment, 0, attachment.Length);
@ -294,7 +295,7 @@ namespace Database
} }
conn.Close(); conn.Close();
return ""; return filename;
} }
public DataTable Get_ApplicationType_from_Vorlage(int vorlagenr) public DataTable Get_ApplicationType_from_Vorlage(int vorlagenr)
@ -1184,7 +1185,52 @@ namespace Database
scmCmdToExecute.Dispose(); scmCmdToExecute.Dispose();
} }
public int Save_Serienbrief(serienbrief sb) public serienbrief Load_Serienbrief(serienbrief sb, string temppath)
{
clsEdex_sb_serienbrief dbsb = new clsEdex_sb_serienbrief();
clsConnectionProvider edoka_conn = new clsConnectionProvider();
edoka_conn.sConnectionString = this.connectionstring;
dbsb.cpMainConnectionProvider = edoka_conn;
dbsb.iSerienbriefnr=sb.serienbriefnr;
dbsb.SelectOne();
sb.bezeichnung = dbsb.sBezeichnung.ToString();
sb.serienbriefnr = Convert.ToInt32(dbsb.iSerienbriefnr.Value);
sb.verantwortlich = Convert.ToInt32(dbsb.iVerantwortlich.Value);
sb.postzustellung = Convert.ToInt32(dbsb.iPostzustellung.Value);
sb.dokumentdatum = Convert.ToDateTime(dbsb.daDokumentdatum.Value);
sb.zustaendig = Convert.ToInt32(dbsb.iZustaendig.Value);
sb.unterschriftlinks = Convert.ToInt32(dbsb.iUnterschriftlinks.Value);
sb.unterschriftrechts = Convert.ToInt32(dbsb.iUnterschriftrechts.Value);
sb.team = Convert.ToInt32(dbsb.iTeam.Value);
sb.archivdatum = Convert.ToDateTime(dbsb.daArchivdatum.Value);
try { sb.termin = Convert.ToDateTime(dbsb.daTermin.Value); } catch { }
sb.bemerkung = dbsb.sBemerkung.ToString();
sb.erstellt_am = Convert.ToDateTime(dbsb.daErstellt_am.Value);
sb.mutiert_am = Convert.ToDateTime(dbsb.daMutiert_am.Value);
sb.team = Convert.ToInt32(dbsb.iMutierer.Value);
sb.aktiv = Convert.ToBoolean(dbsb.bAktiv.Value);
sb.status = Convert.ToInt32( dbsb.iStatus.Value);
sb.dokumenttypnr = Convert.ToInt32(dbsb.iDokumenttypnr.Value);
sb.windowwidth = Convert.ToInt32(dbsb.iWindowwidth.Value);
sb.windowheight = Convert.ToInt32(dbsb.iWindowwidth.Value);
sb.treewidth = Convert.ToInt32(dbsb.iTreewidth.Value);
sb.inBearbeitung = Convert.ToInt32(dbsb.iInBearbeitung.Value);
sb.fehlerhaft = Convert.ToInt32(dbsb.iFehlerhaft.Value);
sb.erstellt = Convert.ToInt32(dbsb.iErstellt.Value);
sb.gedruckt = Convert.ToInt32(dbsb.iGedruckt.Value);
sb.bestaetigt = Convert.ToInt32(dbsb.iBestaetigt.Value);
sb.ausgeloest = Convert.ToInt32(dbsb.iAusgeloest.Value);
try {sb.bldossier = Convert.ToInt32(dbsb.iBldossier.Value); } catch { };
string fn = read_empfaengerdata(sb.serienbriefnr, temppath);
if (fn != "") {
sb.dsempfaenger.Tables.Clear();
sb.dsempfaenger.ReadXml(fn);
System.IO.File.Delete(fn);
}
return sb;
}
public int Save_Serienbrief(serienbrief sb, string temppath)
{ {
clsEdex_sb_serienbrief dbsb = new clsEdex_sb_serienbrief(); clsEdex_sb_serienbrief dbsb = new clsEdex_sb_serienbrief();
clsConnectionProvider edoka_conn = new clsConnectionProvider(); clsConnectionProvider edoka_conn = new clsConnectionProvider();
@ -1236,13 +1282,164 @@ namespace Database
dbsb.Update(); dbsb.Update();
} }
save_empfaengerdata(sb.serienbriefnr,temppath,sb.dsempfaenger);
edoka_conn.CloseConnection(true); edoka_conn.CloseConnection(true);
return sb.serienbriefnr; return sb.serienbriefnr;
} }
public string read_empfaengerdata(int serienbriefnr, string temppath)
{
string filename = temppath + serienbriefnr.ToString() + ".xml";
Get_Tabledata("Select dbo.BinaryToBase64(xmldata) from edex_sb_empfaenger where serienbriefnr=" + serienbriefnr.ToString(), false, true);
try
{
File.WriteAllBytes(filename, Convert.FromBase64String(dsdaten.Tables[0].Rows[0][0].ToString()));
}
catch
{
filename = "";
}
return filename;
}
public Boolean save_empfaengerdata(int serienbriefnr, string temppath, DataSet empf)
{
try
{
string filename = temppath + serienbriefnr.ToString() + ".xml";
empf.WriteXml(filename);
SqlConnection Connection = new SqlConnection();
SqlDataAdapter DA = new SqlDataAdapter("select top 1 * from edex_sb_empfaenger where serienbriefnr=" + serienbriefnr.ToString() + "", Connection);
SqlCommandBuilder cb = new SqlCommandBuilder(DA);
DataSet ds = new DataSet();
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
byte[] mydata = new byte[fs.Length];
try
{
fs.Read(mydata, 0, Convert.ToInt32(fs.Length));
fs.Close();
Connection.ConnectionString = connectionstring;
Connection.Open();
DA.Fill(ds, "empfaenger");
DataRow myRow;
if (ds.Tables[0].Rows.Count == 0)
{
myRow = ds.Tables[0].NewRow();
myRow[1] = serienbriefnr.ToString();
myRow[2] = mydata;
ds.Tables[0].Rows.Add(myRow);
DA.Update(ds, "empfaenger");
}
else
{
myRow = ds.Tables[0].Rows[0];
myRow[2] = mydata;
DA.Update(ds, "empfaenger");
}
}
catch (Exception ex)
{
return false;
}
finally
{
fs = null;
cb = null;
ds = null;
DA = null;
Connection.Close();
Connection = null;
System.IO.File.Delete(filename);
}
return true;
}
catch (Exception EX)
{
return false;
}
return true;
}
public string save_sb_vorlage_to_db(string filename, string doctype, int serienbriefnr)
{
try
{
SqlConnection Connection = new SqlConnection();
SqlDataAdapter DA = new SqlDataAdapter("select top 1 * from edex_sb_vorlage where serienbriefnr=" + serienbriefnr.ToString() , Connection);
SqlCommandBuilder cb = new SqlCommandBuilder(DA);
DataSet ds = new DataSet();
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
byte[] mydata = new byte[fs.Length];
try
{
fs.Read(mydata, 0, Convert.ToInt32(fs.Length));
fs.Close();
Connection.ConnectionString = connectionstring;
Connection.Open();
DA.Fill(ds, "vorlage");
DataRow myRow;
if (ds.Tables[0].Rows.Count == 0)
{
myRow = ds.Tables[0].NewRow();
myRow[0] = serienbriefnr.ToString();
myRow[1] = mydata;
myRow[2] = doctype;
ds.Tables[0].Rows.Add(myRow);
DA.Update(ds, "vorlage");
}
else
{
myRow = ds.Tables[0].Rows[0];
myRow[1] = mydata;
DA.Update(ds, "vorlage");
}
}
catch (Exception ex)
{
return filename;
}
finally
{
fs = null;
cb = null;
ds = null;
DA = null;
Connection.Close();
Connection = null;
}
return filename;
}
catch (Exception EX)
{
return "";
}
return "";
}
public string get_sb_vorlage(int serienbriefnr, string temppath)
{
string filename = temppath + serienbriefnr.ToString() + ".xml";
Get_Tabledata("Select dbo.BinaryToBase64(vorlage), doctype from edex_sb_vorlage where serienbriefnr=" + serienbriefnr.ToString(), false, true);
try
{
filename = temppath + serienbriefnr.ToString() + "." + dsdaten.Tables[0].Rows[0][1].ToString();
File.WriteAllBytes(filename, Convert.FromBase64String(dsdaten.Tables[0].Rows[0][0].ToString()));
}
catch
{
filename = "";
}
return filename;
}
}
} }
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -38,7 +39,9 @@ namespace Model
public int ausgeloest { get; set; } = 0; public int ausgeloest { get; set; } = 0;
public int bldossier { get; set; } = 0; public int bldossier { get; set; } = 0;
public int officevorlagenr { get; set; } = 0;
public string filename { get; set; }
public DataSet dsempfaenger { get; set; }
} }

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save