diff --git a/API_NetFramework/bin/Database.dll b/API_NetFramework/bin/Database.dll index 38908311..0c3ee5c2 100644 Binary files a/API_NetFramework/bin/Database.dll and b/API_NetFramework/bin/Database.dll differ diff --git a/API_NetFramework/bin/Database.pdb b/API_NetFramework/bin/Database.pdb index b1f3a73e..d8290cd1 100644 Binary files a/API_NetFramework/bin/Database.pdb and b/API_NetFramework/bin/Database.pdb differ diff --git a/API_NetFramework/bin/Model.dll b/API_NetFramework/bin/Model.dll index 10381a11..48ce111f 100644 Binary files a/API_NetFramework/bin/Model.dll and b/API_NetFramework/bin/Model.dll differ diff --git a/API_NetFramework/bin/Model.pdb b/API_NetFramework/bin/Model.pdb index 16123dcf..2a81fe61 100644 Binary files a/API_NetFramework/bin/Model.pdb and b/API_NetFramework/bin/Model.pdb differ diff --git a/API_NetFramework/bin/OnDoc_NetFramework.dll b/API_NetFramework/bin/OnDoc_NetFramework.dll index 1a78d077..b349f754 100644 Binary files a/API_NetFramework/bin/OnDoc_NetFramework.dll and b/API_NetFramework/bin/OnDoc_NetFramework.dll differ diff --git a/API_NetFramework/bin/OnDoc_NetFramework.pdb b/API_NetFramework/bin/OnDoc_NetFramework.pdb index 70e4afd6..bc238d5c 100644 Binary files a/API_NetFramework/bin/OnDoc_NetFramework.pdb and b/API_NetFramework/bin/OnDoc_NetFramework.pdb differ diff --git a/API_NetFramework/obj/Debug/API_NetFramework.csproj.AssemblyReference.cache b/API_NetFramework/obj/Debug/API_NetFramework.csproj.AssemblyReference.cache index 2a8f14ff..6d4e35d0 100644 Binary files a/API_NetFramework/obj/Debug/API_NetFramework.csproj.AssemblyReference.cache and b/API_NetFramework/obj/Debug/API_NetFramework.csproj.AssemblyReference.cache differ diff --git a/API_NetFramework/obj/Debug/OnDoc_NetFramework.dll b/API_NetFramework/obj/Debug/OnDoc_NetFramework.dll index 1a78d077..b349f754 100644 Binary files a/API_NetFramework/obj/Debug/OnDoc_NetFramework.dll and b/API_NetFramework/obj/Debug/OnDoc_NetFramework.dll differ diff --git a/API_NetFramework/obj/Debug/OnDoc_NetFramework.pdb b/API_NetFramework/obj/Debug/OnDoc_NetFramework.pdb index 70e4afd6..bc238d5c 100644 Binary files a/API_NetFramework/obj/Debug/OnDoc_NetFramework.pdb and b/API_NetFramework/obj/Debug/OnDoc_NetFramework.pdb differ diff --git a/BarcodeLib/bin/Debug/Database.dll b/BarcodeLib/bin/Debug/Database.dll index 38908311..0c3ee5c2 100644 Binary files a/BarcodeLib/bin/Debug/Database.dll and b/BarcodeLib/bin/Debug/Database.dll differ diff --git a/BarcodeLib/bin/Debug/Database.pdb b/BarcodeLib/bin/Debug/Database.pdb index b1f3a73e..d8290cd1 100644 Binary files a/BarcodeLib/bin/Debug/Database.pdb and b/BarcodeLib/bin/Debug/Database.pdb differ diff --git a/BarcodeLib/bin/Debug/Model.dll b/BarcodeLib/bin/Debug/Model.dll index 10381a11..48ce111f 100644 Binary files a/BarcodeLib/bin/Debug/Model.dll and b/BarcodeLib/bin/Debug/Model.dll differ diff --git a/BarcodeLib/bin/Debug/Model.pdb b/BarcodeLib/bin/Debug/Model.pdb index 16123dcf..2a81fe61 100644 Binary files a/BarcodeLib/bin/Debug/Model.pdb and b/BarcodeLib/bin/Debug/Model.pdb differ diff --git a/BarcodeLib/obj/Debug/BarcodeLib.csproj.AssemblyReference.cache b/BarcodeLib/obj/Debug/BarcodeLib.csproj.AssemblyReference.cache index 8d442957..dadc10e5 100644 Binary files a/BarcodeLib/obj/Debug/BarcodeLib.csproj.AssemblyReference.cache and b/BarcodeLib/obj/Debug/BarcodeLib.csproj.AssemblyReference.cache differ diff --git a/Client/App.config b/Client/App.config index 25e5acdf..14ef0629 100644 --- a/Client/App.config +++ b/Client/App.config @@ -13,13 +13,12 @@ Data Source=shu01\shu00;Initial Catalog=edoka_dms;Persist Security Info=True;User ID=sa;Password=*shu29; - - Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29; - - - + E:\Software-Projekte\OnDoc\Nativ\ + + Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29; + diff --git a/Client/DocMgmt/Serienbrief.Designer.cs b/Client/DocMgmt/Serienbrief.Designer.cs index 5609fe34..6bdf49cf 100644 --- a/Client/DocMgmt/Serienbrief.Designer.cs +++ b/Client/DocMgmt/Serienbrief.Designer.cs @@ -58,6 +58,7 @@ this.lblVerantwortlich = new System.Windows.Forms.Label(); this.lblPostzustellung = 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.sfDataGridEmpfaenger = new Syncfusion.WinForms.DataGrid.SfDataGrid(); this.treeViewAdv1 = new Syncfusion.Windows.Forms.Tools.TreeViewAdv(); @@ -73,17 +74,17 @@ this.RibbonButtonExcelImport = new System.Windows.Forms.RibbonButton(); this.ribbonPanel4 = new System.Windows.Forms.RibbonPanel(); this.RibbonButtonEditWord = new System.Windows.Forms.RibbonButton(); - this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.ribbonPanel5 = new System.Windows.Forms.RibbonPanel(); this.ribbonbuttonsave = new System.Windows.Forms.RibbonButton(); 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.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.label1 = new System.Windows.Forms.Label(); - this.btnsbloadcancel = new System.Windows.Forms.Button(); - this.sfdatagridsbload = new Syncfusion.WinForms.DataGrid.SfDataGrid(); + this.btnsbloadok = new System.Windows.Forms.Button(); + this.ribbonButton1 = new System.Windows.Forms.RibbonButton(); this.GrpDokumentInhalt.SuspendLayout(); this.groupBox8.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.cbboxteam)).BeginInit(); @@ -100,8 +101,8 @@ ((System.ComponentModel.ISupportInitialize)(this.treeViewAdv1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.GridEmpfänger)).BeginInit(); this.pnlLoad.SuspendLayout(); - this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.sfdatagridsbload)).BeginInit(); + this.panel1.SuspendLayout(); this.SuspendLayout(); // // GrpDokumentInhalt @@ -370,6 +371,13 @@ this.lblBezeichnung.TabIndex = 8; 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 // this.GrpEmpfaenger.Controls.Add(this.sfDataGridEmpfaenger); @@ -604,10 +612,6 @@ this.RibbonButtonEditWord.Text = "Vorlage bearbeiten"; this.RibbonButtonEditWord.ToolTip = "Vorlage bearbeiten"; // - // openFileDialog1 - // - this.openFileDialog1.FileName = "openFileDialog1"; - // // ribbonPanel5 // this.ribbonPanel5.Items.Add(this.ribbonbuttonsave); @@ -625,15 +629,13 @@ // // ribbonPanel6 // + this.ribbonPanel6.Items.Add(this.ribbonButton1); this.ribbonPanel6.Name = "ribbonPanel6"; - this.ribbonPanel6.Text = "ribbonPanel6"; + this.ribbonPanel6.Text = ""; // - // txtbezeichnung + // openFileDialog1 // - 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; + this.openFileDialog1.FileName = "openFileDialog1"; // // pnlLoad // @@ -643,21 +645,33 @@ this.pnlLoad.Controls.Add(this.btnsbloadcancel); this.pnlLoad.Controls.Add(this.panel1); 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.Size = new System.Drawing.Size(965, 637); this.pnlLoad.TabIndex = 4; this.pnlLoad.Visible = false; // - // btnsbloadok + // sfdatagridsbload // - this.btnsbloadok.Location = new System.Drawing.Point(870, 600); - this.btnsbloadok.Name = "btnsbloadok"; - this.btnsbloadok.Size = new System.Drawing.Size(75, 23); - this.btnsbloadok.TabIndex = 0; - this.btnsbloadok.Text = "öffnen"; - this.btnsbloadok.UseVisualStyleBackColor = true; - this.btnsbloadok.Click += new System.EventHandler(this.bntsbloadok_Click); + this.sfdatagridsbload.AccessibleName = "Table"; + this.sfdatagridsbload.Dock = System.Windows.Forms.DockStyle.Top; + this.sfdatagridsbload.Location = new System.Drawing.Point(0, 47); + this.sfdatagridsbload.Name = "sfdatagridsbload"; + this.sfdatagridsbload.Size = new System.Drawing.Size(961, 489); + this.sfdatagridsbload.TabIndex = 3; + 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 // @@ -678,25 +692,24 @@ this.label1.TabIndex = 0; this.label1.Text = "Serienbrief öffnen"; // - // btnsbloadcancel + // btnsbloadok // - 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); + this.btnsbloadok.Location = new System.Drawing.Point(870, 600); + this.btnsbloadok.Name = "btnsbloadok"; + this.btnsbloadok.Size = new System.Drawing.Size(75, 23); + this.btnsbloadok.TabIndex = 0; + this.btnsbloadok.Text = "öffnen"; + this.btnsbloadok.UseVisualStyleBackColor = true; + this.btnsbloadok.Click += new System.EventHandler(this.bntsbloadok_Click); // - // sfdatagridsbload + // ribbonButton1 // - this.sfdatagridsbload.AccessibleName = "Table"; - this.sfdatagridsbload.Dock = System.Windows.Forms.DockStyle.Top; - this.sfdatagridsbload.Location = new System.Drawing.Point(0, 47); - this.sfdatagridsbload.Name = "sfdatagridsbload"; - this.sfdatagridsbload.Size = new System.Drawing.Size(961, 489); - this.sfdatagridsbload.TabIndex = 3; - this.sfdatagridsbload.Text = "sfDataGrid1"; + this.ribbonButton1.Image = global::OnDoc.Properties.Resources.EditDoc_32x32_32; + this.ribbonButton1.LargeImage = global::OnDoc.Properties.Resources.EditDoc_32x32_32; + this.ribbonButton1.Name = "ribbonButton1"; + this.ribbonButton1.SmallImage = global::OnDoc.Properties.Resources.EditDoc_24x24_32; + this.ribbonButton1.Text = "Vorlage bearbeiten"; + this.ribbonButton1.Click += new System.EventHandler(this.ribbonButton1_Click); // // Serienbrief // @@ -733,9 +746,9 @@ ((System.ComponentModel.ISupportInitialize)(this.treeViewAdv1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.GridEmpfänger)).EndInit(); this.pnlLoad.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.sfdatagridsbload)).EndInit(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.sfdatagridsbload)).EndInit(); this.ResumeLayout(false); } @@ -791,5 +804,6 @@ private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label label1; private Syncfusion.WinForms.DataGrid.SfDataGrid sfdatagridsbload; + private System.Windows.Forms.RibbonButton ribbonButton1; } } \ No newline at end of file diff --git a/Client/DocMgmt/Serienbrief.cs b/Client/DocMgmt/Serienbrief.cs index 5e3704d8..8e193c6b 100644 --- a/Client/DocMgmt/Serienbrief.cs +++ b/Client/DocMgmt/Serienbrief.cs @@ -9,9 +9,13 @@ using System.Runtime.Remoting.Messaging; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using System.Xml.Linq; using Database; +using DOCGEN.Klassen; using Helper; using Model; +using NLog; +using OnDoc.DocMgmt; using OnDoc.Klassen; using OnDoc.UIControls.Administrator; using Syncfusion.Windows.Forms.Tools; @@ -24,12 +28,14 @@ namespace OnDoc.UIControls { public partial class Serienbrief : SfForm { - private int dokumenttypnr = 0; + //private int dokumenttypnr = 0; private int officevorlagenr = 0; private int profilnr = 0; private serienbrief sb = new serienbrief(); private int serienbriefnr = 0; - private DataSet dsempfaenger = new DataSet(); + + //private DataSet dsempfaenger = new DataSet(); + private int selectedsbnr = 0; public Serienbrief() { InitializeComponent(); @@ -132,18 +138,18 @@ namespace OnDoc.UIControls return; } 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) { - System.Data.DataRow r1 = dsempfaenger.Tables[0].NewRow(); - foreach (DataColumn col in importdata.Columns) + System.Data.DataRow r1 = sb.dsempfaenger.Tables[0].NewRow(); + foreach (DataColumn col in sb.dsempfaenger.Tables[0].Columns) { try { r1[col.ColumnName] = dr[col.ColumnName]; } - catch { } + catch { r1[col.ColumnName] = ""; } } r1["Status"] = 0; @@ -151,10 +157,10 @@ namespace OnDoc.UIControls 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; 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; - refresh_empfaenger(dsempfaenger.Tables[0]); + refresh_empfaenger(sb.dsempfaenger.Tables[0]); //sfDataGridEmpfaenger.DataSource = importdata; } } @@ -185,17 +191,26 @@ namespace OnDoc.UIControls string xml = bh.DecodeBase64(); string filename = AppParams.tempdir + @"\tmpsb.xml"; System.IO.File.WriteAllText(filename, xml); - dsempfaenger.Tables.Clear(); - dsempfaenger.ReadXml(filename); - dsempfaenger.Tables[0].Columns.Add("Status"); - dsempfaenger.Tables[0].Columns.Add("Error"); - - refresh_empfaenger(dsempfaenger.Tables[0]); + //dsempfaenger.Tables.Clear(); + //dsempfaenger.ReadXml(filename); + //dsempfaenger.Tables[0].Columns.Add("Status"); + //dsempfaenger.Tables[0].Columns.Add("Error"); + sb.dsempfaenger = new DataSet(); + 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); } private void RibbonButtonNew_Click(object sender, EventArgs e) { + OnDoc.DocMgmt.DokTypSelect DokTypSelect = new OnDoc.DocMgmt.DokTypSelect(); DokTypSelect.vorlagentype = 1; DokTypSelect.ShowDialog(this); @@ -203,14 +218,15 @@ namespace OnDoc.UIControls { this.sb = null; this.sb = new serienbrief(); - dokumenttypnr = DokTypSelect.dokumenttypnr; - GrpDokumentInhalt.Enabled = true; - update_serienbrief_details(true, dokumenttypnr, 0); - init_empfaenger(0); - vorlagenfelder(dokumenttypnr); - refresh_empfaenger(dsempfaenger.Tables[0]); + sb.dokumenttypnr = DokTypSelect.dokumenttypnr; + update_serienbrief_details(true, sb.dokumenttypnr, 0); + init_empfaenger(0); + vorlagenfelder(sb.dokumenttypnr); + refresh_empfaenger(sb.dsempfaenger.Tables[0]); + update_screen(); update_serienbriefdaten(true); + vorlage_auslesen_und_speichern(); } else @@ -222,13 +238,18 @@ namespace OnDoc.UIControls 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) { DB db = new DB(AppParams.connectionstring); 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); string s = ""; for (int i = 0, loopTo = db.dsdaten.Tables[0].Rows.Count - 1; i <= loopTo; i++) @@ -236,34 +257,35 @@ namespace OnDoc.UIControls try { 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 { - this.dsempfaenger.Tables[0].Columns.Add(db.dsdaten.Tables[0].Rows[i][0].ToString()); - this.dsempfaenger.Tables[0].Rows[0][i] = ""; - this.dsempfaenger.Tables[1].Columns.Add(db.dsdaten.Tables[0].Rows[i][0].ToString()); + sb.dsempfaenger.Tables[0].Columns.Add(db.dsdaten.Tables[0].Rows[i][0].ToString()); + sb.dsempfaenger.Tables[0].Rows[0][db.dsdaten.Tables[0].Rows[i][0].ToString()] = ""; + sb.dsempfaenger.Tables[1].Columns.Add(db.dsdaten.Tables[0].Rows[i][0].ToString()); try { 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 { - 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 { - 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; } } + 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); } //foreach (System.Data.DataRow dr in db.dsdaten.Tables[0].Rows) @@ -287,9 +309,9 @@ namespace OnDoc.UIControls DB db = new DB(AppParams.connectionstring); if (newsb) { - db.Get_Tabledata("Select bezeichnung,office_vorlagenr from dokumenttyp where dokumenttypnr=" + dokumenttypnr.ToString(), false, true); - this.txtbezeichnung.Text = db.dsdaten.Tables[0].Rows[0][0].ToString(); - officevorlagenr = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0][1]); + db.Get_Tabledata("Select bezeichnung,office_vorlagenr from dokumenttyp where dokumenttypnr=" + sb.dokumenttypnr.ToString(), false, true); + sb.bezeichnung= db.dsdaten.Tables[0].Rows[0][0].ToString(); + sb.officevorlagenr = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0][1]); } @@ -302,13 +324,14 @@ namespace OnDoc.UIControls sb.aktiv = true; sb.mutiert_am = DateTime.Now; 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.unterschriftlinks = Convert.ToInt32(cbboxunterschriftlinks.SelectedValue.ToString()); } catch { sb.unterschriftlinks = 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; } 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 { - DataView dv = new DataView(dsempfaenger.Tables[0]); + DataView dv = new DataView(sb.dsempfaenger.Tables[0]); dv.RowFilter = "Status = 0"; treeViewAdv1.Nodes[0].Text = "In Bearbeitung (" + dv.Count.ToString() + ")"; dv.RowFilter = "Error <> 0"; @@ -341,7 +364,7 @@ namespace OnDoc.UIControls { { 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)) { @@ -385,11 +408,30 @@ namespace OnDoc.UIControls sfdatagridsbload.DataSource = db.dsdaten.Tables[0]; this.pnlLoad.Left = this.Left; this.pnlLoad.Width = this.Width; + Application.DoEvents(); } 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; + 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; } + + 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(); + } } } diff --git a/Client/DocMgmt/SerienbriefBearbeitung.Designer.cs b/Client/DocMgmt/SerienbriefBearbeitung.Designer.cs index 5234263c..21e9a371 100644 --- a/Client/DocMgmt/SerienbriefBearbeitung.Designer.cs +++ b/Client/DocMgmt/SerienbriefBearbeitung.Designer.cs @@ -30,26 +30,80 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SerienbriefBearbeitung)); 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(); // // 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.Size = new System.Drawing.Size(386, 25); + this.toolStrip1.Size = new System.Drawing.Size(382, 25); this.toolStrip1.TabIndex = 0; 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 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(386, 478); + this.Controls.Add(this.groupBox1); this.Controls.Add(this.toolStrip1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 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.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.PerformLayout(); @@ -58,5 +112,9 @@ #endregion 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; } } \ No newline at end of file diff --git a/Client/DocMgmt/SerienbriefBearbeitung.cs b/Client/DocMgmt/SerienbriefBearbeitung.cs index f495f883..a0c3a964 100644 --- a/Client/DocMgmt/SerienbriefBearbeitung.cs +++ b/Client/DocMgmt/SerienbriefBearbeitung.cs @@ -7,11 +7,14 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using Model; using OnDoc.Klassen; +using OnDoc.UIControls; using Syncfusion.Windows.Forms.Tools; using Syncfusion.WinForms.Controls; using Syncfusion.WinForms.DataGrid; using Syncfusion.WinForms.DataGrid.Interactivity; +using Windows.Media.Ocr; namespace OnDoc.DocMgmt { @@ -21,6 +24,7 @@ namespace OnDoc.DocMgmt DataTable IDVFelder = new DataTable(); DataTable UsedFelder = new DataTable(); int dokumenttypnr = 0; + serienbrief sb = new serienbrief(); public SerienbriefBearbeitung() { InitializeComponent(); @@ -28,23 +32,128 @@ namespace OnDoc.DocMgmt 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) { - StdFelder = get_vorlagenfelder(dokumenttypnr, 0); - IDVFelder = get_vorlagenfelder(dokumenttypnr, 1); + StdFelder = get_vorlagenfelder(sb.dokumenttypnr, 0); + + 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) { Database.DB db = new Database.DB(AppParams.connectionstring); db.clear_parameter(); - db.add_parameter("@dokumenttypnr", dokumenttypnr.ToString()); + db.add_parameter("@dokumenttypnr", sb.dokumenttypnr.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]; } + 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() - { return null; } + + { + load_document(); + get_usedfelder(ref UsedFelder); + return null; + } + + } } diff --git a/Client/Properties/Settings.Designer.cs b/Client/Properties/Settings.Designer.cs index a0f6d89c..cec4b4a4 100644 --- a/Client/Properties/Settings.Designer.cs +++ b/Client/Properties/Settings.Designer.cs @@ -47,5 +47,18 @@ namespace OnDoc.Properties { 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; + } + } } } diff --git a/Client/Properties/Settings.settings b/Client/Properties/Settings.settings index c05e14a3..662170cc 100644 --- a/Client/Properties/Settings.settings +++ b/Client/Properties/Settings.settings @@ -8,5 +8,8 @@ E:\Software-Projekte\OnDoc\Nativ\ + + Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29; + \ No newline at end of file diff --git a/Client/bin/Debug/Database.dll b/Client/bin/Debug/Database.dll index 38908311..0c3ee5c2 100644 Binary files a/Client/bin/Debug/Database.dll and b/Client/bin/Debug/Database.dll differ diff --git a/Client/bin/Debug/Database.pdb b/Client/bin/Debug/Database.pdb index b1f3a73e..d8290cd1 100644 Binary files a/Client/bin/Debug/Database.pdb and b/Client/bin/Debug/Database.pdb differ diff --git a/Client/bin/Debug/Model.dll b/Client/bin/Debug/Model.dll index 10381a11..48ce111f 100644 Binary files a/Client/bin/Debug/Model.dll and b/Client/bin/Debug/Model.dll differ diff --git a/Client/bin/Debug/Model.pdb b/Client/bin/Debug/Model.pdb index 16123dcf..2a81fe61 100644 Binary files a/Client/bin/Debug/Model.pdb and b/Client/bin/Debug/Model.pdb differ diff --git a/Client/bin/Debug/OnDoc.exe b/Client/bin/Debug/OnDoc.exe index fa9d274c..c94d61a3 100644 Binary files a/Client/bin/Debug/OnDoc.exe and b/Client/bin/Debug/OnDoc.exe differ diff --git a/Client/bin/Debug/OnDoc.exe.config b/Client/bin/Debug/OnDoc.exe.config index 36eebbfd..6b7d9b2d 100644 --- a/Client/bin/Debug/OnDoc.exe.config +++ b/Client/bin/Debug/OnDoc.exe.config @@ -13,12 +13,12 @@ Data Source=shu01\shu00;Initial Catalog=edoka_dms;Persist Security Info=True;User ID=sa;Password=*shu29; - - Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29; - E:\Software-Projekte\OnDoc\Nativ\ + + Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29; + diff --git a/Client/bin/Debug/OnDoc.pdb b/Client/bin/Debug/OnDoc.pdb index 6f82e2a6..d2ec9955 100644 Binary files a/Client/bin/Debug/OnDoc.pdb and b/Client/bin/Debug/OnDoc.pdb differ diff --git a/Client/bin/Debug/de-DE/OnDoc.resources.dll b/Client/bin/Debug/de-DE/OnDoc.resources.dll index 93744ffc..b2ff9ee4 100644 Binary files a/Client/bin/Debug/de-DE/OnDoc.resources.dll and b/Client/bin/Debug/de-DE/OnDoc.resources.dll differ diff --git a/Client/obj/Debug/Client.csproj.AssemblyReference.cache b/Client/obj/Debug/Client.csproj.AssemblyReference.cache index a8423d7c..95eb0ea6 100644 Binary files a/Client/obj/Debug/Client.csproj.AssemblyReference.cache and b/Client/obj/Debug/Client.csproj.AssemblyReference.cache differ diff --git a/Client/obj/Debug/Client.csproj.GenerateResource.cache b/Client/obj/Debug/Client.csproj.GenerateResource.cache index 13ca0099..07cdc8a6 100644 Binary files a/Client/obj/Debug/Client.csproj.GenerateResource.cache and b/Client/obj/Debug/Client.csproj.GenerateResource.cache differ diff --git a/Client/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/Client/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 81f1ef39..9ad62fd3 100644 Binary files a/Client/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/Client/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Client/obj/Debug/OnDoc.exe b/Client/obj/Debug/OnDoc.exe index fa9d274c..c94d61a3 100644 Binary files a/Client/obj/Debug/OnDoc.exe and b/Client/obj/Debug/OnDoc.exe differ diff --git a/Client/obj/Debug/OnDoc.exe.config b/Client/obj/Debug/OnDoc.exe.config index 36eebbfd..6b7d9b2d 100644 --- a/Client/obj/Debug/OnDoc.exe.config +++ b/Client/obj/Debug/OnDoc.exe.config @@ -13,12 +13,12 @@ Data Source=shu01\shu00;Initial Catalog=edoka_dms;Persist Security Info=True;User ID=sa;Password=*shu29; - - Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29; - E:\Software-Projekte\OnDoc\Nativ\ + + Data Source=shu01\shu00;Initial Catalog=edoka;Persist Security Info=True;User ID=sa;Password=*shu29; + diff --git a/Client/obj/Debug/OnDoc.pdb b/Client/obj/Debug/OnDoc.pdb index 6f82e2a6..d2ec9955 100644 Binary files a/Client/obj/Debug/OnDoc.pdb and b/Client/obj/Debug/OnDoc.pdb differ diff --git a/Client/obj/Debug/de-DE/OnDoc.resources.dll b/Client/obj/Debug/de-DE/OnDoc.resources.dll index 93744ffc..b2ff9ee4 100644 Binary files a/Client/obj/Debug/de-DE/OnDoc.resources.dll and b/Client/obj/Debug/de-DE/OnDoc.resources.dll differ diff --git a/DOCGEN/bin/Debug/Database.dll b/DOCGEN/bin/Debug/Database.dll index 38908311..0c3ee5c2 100644 Binary files a/DOCGEN/bin/Debug/Database.dll and b/DOCGEN/bin/Debug/Database.dll differ diff --git a/DOCGEN/bin/Debug/Database.pdb b/DOCGEN/bin/Debug/Database.pdb index b1f3a73e..d8290cd1 100644 Binary files a/DOCGEN/bin/Debug/Database.pdb and b/DOCGEN/bin/Debug/Database.pdb differ diff --git a/DOCGEN/bin/Debug/Model.dll b/DOCGEN/bin/Debug/Model.dll index 10381a11..48ce111f 100644 Binary files a/DOCGEN/bin/Debug/Model.dll and b/DOCGEN/bin/Debug/Model.dll differ diff --git a/DOCGEN/bin/Debug/Model.pdb b/DOCGEN/bin/Debug/Model.pdb index 16123dcf..2a81fe61 100644 Binary files a/DOCGEN/bin/Debug/Model.pdb and b/DOCGEN/bin/Debug/Model.pdb differ diff --git a/DOCGEN/obj/Debug/DocGen.csproj.AssemblyReference.cache b/DOCGEN/obj/Debug/DocGen.csproj.AssemblyReference.cache index ed711486..e3aac9a7 100644 Binary files a/DOCGEN/obj/Debug/DocGen.csproj.AssemblyReference.cache and b/DOCGEN/obj/Debug/DocGen.csproj.AssemblyReference.cache differ diff --git a/Database/bin/Debug/Database.dll b/Database/bin/Debug/Database.dll index 38908311..0c3ee5c2 100644 Binary files a/Database/bin/Debug/Database.dll and b/Database/bin/Debug/Database.dll differ diff --git a/Database/bin/Debug/Database.pdb b/Database/bin/Debug/Database.pdb index b1f3a73e..d8290cd1 100644 Binary files a/Database/bin/Debug/Database.pdb and b/Database/bin/Debug/Database.pdb differ diff --git a/Database/bin/Debug/Model.dll b/Database/bin/Debug/Model.dll index 10381a11..48ce111f 100644 Binary files a/Database/bin/Debug/Model.dll and b/Database/bin/Debug/Model.dll differ diff --git a/Database/bin/Debug/Model.pdb b/Database/bin/Debug/Model.pdb index 16123dcf..2a81fe61 100644 Binary files a/Database/bin/Debug/Model.pdb and b/Database/bin/Debug/Model.pdb differ diff --git a/Database/db.cs b/Database/db.cs index 5a5487fa..709c6111 100644 --- a/Database/db.cs +++ b/Database/db.cs @@ -14,6 +14,7 @@ using System.Diagnostics.Eventing.Reader; using Logging; using System.Configuration; 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) { - + string filename = ""; 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); conn.Open(); SqlDataReader sqldr = sc.ExecuteReader(); while (sqldr.Read()) { - string filename = tempdir + @"\" + dokumentid; + filename = tempdir + @"\" + dokumentid; byte[] attachment = (byte[])sqldr.GetValue(0); FileStream fs = new FileStream(filename, FileMode.Create); fs.Write(attachment, 0, attachment.Length); @@ -294,7 +295,7 @@ namespace Database } conn.Close(); - return ""; + return filename; } public DataTable Get_ApplicationType_from_Vorlage(int vorlagenr) @@ -1184,7 +1185,52 @@ namespace Database 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(); clsConnectionProvider edoka_conn = new clsConnectionProvider(); @@ -1236,13 +1282,164 @@ namespace Database dbsb.Update(); } + save_empfaengerdata(sb.serienbriefnr,temppath,sb.dsempfaenger); edoka_conn.CloseConnection(true); 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; + + } + } } - -} diff --git a/Database/obj/Debug/Database.csproj.AssemblyReference.cache b/Database/obj/Debug/Database.csproj.AssemblyReference.cache index c982bf92..1ea8b2bc 100644 Binary files a/Database/obj/Debug/Database.csproj.AssemblyReference.cache and b/Database/obj/Debug/Database.csproj.AssemblyReference.cache differ diff --git a/Database/obj/Debug/Database.dll b/Database/obj/Debug/Database.dll index 38908311..0c3ee5c2 100644 Binary files a/Database/obj/Debug/Database.dll and b/Database/obj/Debug/Database.dll differ diff --git a/Database/obj/Debug/Database.pdb b/Database/obj/Debug/Database.pdb index b1f3a73e..d8290cd1 100644 Binary files a/Database/obj/Debug/Database.pdb and b/Database/obj/Debug/Database.pdb differ diff --git a/Model/bin/Debug/Model.dll b/Model/bin/Debug/Model.dll index 10381a11..48ce111f 100644 Binary files a/Model/bin/Debug/Model.dll and b/Model/bin/Debug/Model.dll differ diff --git a/Model/bin/Debug/Model.pdb b/Model/bin/Debug/Model.pdb index 16123dcf..2a81fe61 100644 Binary files a/Model/bin/Debug/Model.pdb and b/Model/bin/Debug/Model.pdb differ diff --git a/Model/clsSerienbrief.cs b/Model/clsSerienbrief.cs index 98d7c154..f9175a51 100644 --- a/Model/clsSerienbrief.cs +++ b/Model/clsSerienbrief.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -38,7 +39,9 @@ namespace Model public int ausgeloest { 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; } } diff --git a/Model/obj/Debug/Model.dll b/Model/obj/Debug/Model.dll index 10381a11..48ce111f 100644 Binary files a/Model/obj/Debug/Model.dll and b/Model/obj/Debug/Model.dll differ diff --git a/Model/obj/Debug/Model.pdb b/Model/obj/Debug/Model.pdb index 16123dcf..2a81fe61 100644 Binary files a/Model/obj/Debug/Model.pdb and b/Model/obj/Debug/Model.pdb differ