diff --git a/BerichtGen/Bericht.cs b/BerichtGen/Bericht.cs index 47bb42a..e7a09d2 100644 --- a/BerichtGen/Bericht.cs +++ b/BerichtGen/Bericht.cs @@ -3,6 +3,7 @@ using Syncfusion.DocIO.DLS; using System; using System.Collections; using System.Collections.Generic; +using System.Data; using System.Diagnostics; using System.Drawing; using System.Linq; @@ -23,17 +24,20 @@ namespace BerichtGen /// Inhalt vom Dokument /// Ein doc datei soll erzeugt werden /// Ein Pdf datei soll erzeugt werden - public void Erzeuge(string firma, string vorlage, string savepath, Hashtable daten,List bilderObjects, bool erzeugeDOC = false , bool erzeugePDF = true) + public void Erzeuge(string source, string savepath, Hashtable daten,List bilderObjects,DataTable tableContents, bool erzeugeDOC = false , bool erzeugePDF = true) { - _listImages = new List(); - foreach(BilderObject current in bilderObjects) + if (bilderObjects != null) { - Image image = Image.FromFile(current.Path); - _listImages.Add(ResizeImage(image, CalculateImageSizeForDocument(image.Height, image.Width))); - image.Dispose(); + _listImages = new List(); + foreach (BilderObject current in bilderObjects) + { + Image image = Image.FromFile(current.Path); + _listImages.Add(ResizeImage(image, CalculateImageSizeForDocument(image.Height, image.Width))); + image.Dispose(); + } } - WordDocument wordDocument = new WordDocument("./documents/JUME/liner_einbau.docx"); + WordDocument wordDocument = new WordDocument(source); string[] fieldnames = null; string[] fieldvalues = null; @@ -66,6 +70,10 @@ namespace BerichtGen //string[] fieldNames = new string[] { "UVImage" }; //string[] fieldValues = new string[] { "test.png" }; + + if (tableContents != null) + wordDocument.MailMerge.ExecuteGroup(tableContents); + wordDocument.MailMerge.Execute(fieldnames, fieldvalues); wordDocument.Save("test.docx", Syncfusion.DocIO.FormatType.Docx); //wordDocument.Close(); diff --git a/BerichtGen/Options.cs b/BerichtGen/Options.cs index 2948f62..bda280b 100644 --- a/BerichtGen/Options.cs +++ b/BerichtGen/Options.cs @@ -6,6 +6,7 @@ using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; +using System.IO; using System.Linq; using System.Text; using System.Threading; @@ -21,10 +22,12 @@ namespace BerichtGen string firma; string vorlage; string speicherpfad; + string source; List bilderObjects; + DataTable tableContent = null; - public Options(string firma, string vorlage, string speicherpfad, Hashtable grunddaten, List bilderObjects) + public Options(string firma, string vorlage, string speicherpfad, Hashtable grunddaten, List bilderObjects, DataTable tableContent = null) { InitializeComponent(); this.firma = firma; @@ -32,12 +35,14 @@ namespace BerichtGen this.speicherpfad = speicherpfad; this.grundDaten = grunddaten; this.bilderObjects = bilderObjects; + this.tableContent = tableContent; + this.source = Path.Combine("documents",firma, vorlage); } void Gen() { Bericht bericht = new Bericht(); - bericht.Erzeuge(firma,vorlage, speicherpfad, grundDaten,bilderObjects); + bericht.Erzeuge(source, speicherpfad, grundDaten,bilderObjects,tableContent); } private void btn_start_Click(object sender, EventArgs e) diff --git a/SanSystem/Einstellungen/ObjecteListSetting.cs b/SanSystem/Einstellungen/ObjecteListSetting.cs index 0b603fd..60f329b 100644 --- a/SanSystem/Einstellungen/ObjecteListSetting.cs +++ b/SanSystem/Einstellungen/ObjecteListSetting.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace SanSystem.Einstellungen { @@ -10,17 +11,39 @@ namespace SanSystem.Einstellungen { public ObjecteListSetting() : base("ObjecteList") { } + public override int GetWidth(DataGridViewColumn dataGridViewColumn) + { + int result = -1; + + try + { + result = getConfiguration(dataGridViewColumn.HeaderText); + } + catch(Exception ) + { + result = 20; + } + + return result; + } + public override void SetWidth(DataGridViewColumn dataGridViewColumn) + { + setConfig(dataGridViewColumn.HeaderText, dataGridViewColumn.Width); + } + public override void InitDevValues() { // Hausnummer // Von punkt // Bis punkt // Haltungslänge - + configuration.Add("Auswahl", 20); configuration.Add("Hausnummer", 40); configuration.Add("VonPunkt", 100); configuration.Add("BisPunkt", 100); configuration.Add("Haltungslaenge", 40); } + + } } diff --git a/SanSystem/Einstellungen/Settings.cs b/SanSystem/Einstellungen/Settings.cs index 2a5fce4..d6b6a42 100644 --- a/SanSystem/Einstellungen/Settings.cs +++ b/SanSystem/Einstellungen/Settings.cs @@ -5,12 +5,13 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace SanSystem.Einstellungen { abstract class Settings : IDisposable { - public Dictionary configuration = new Dictionary(); + protected Dictionary configuration = new Dictionary(); const string pfad = "Settings"; @@ -33,7 +34,33 @@ namespace SanSystem.Einstellungen } } + protected int getConfiguration(string keyName, int retry = 0) + { + if (retry >= 3) + throw new Exception("Fehler, zuviele versuche"); + int result = -1; + if(!configuration.TryGetValue(keyName,out result)) + { + configuration.Add(keyName, 20); + //return -1; + result = getConfiguration(keyName,retry++); + SaveSettings(); + return result; + } + else + { + return result; + } + } + + protected void setConfig(string keyName, int value) + { + configuration[keyName] = value; + } + public abstract void InitDevValues(); + public abstract int GetWidth(DataGridViewColumn dataGridViewColumn); + public abstract void SetWidth(DataGridViewColumn dataGridViewColumn); public virtual void SaveSettings() { diff --git a/SanSystem/SanSystem.csproj b/SanSystem/SanSystem.csproj index cf8257b..0361ac6 100644 --- a/SanSystem/SanSystem.csproj +++ b/SanSystem/SanSystem.csproj @@ -154,6 +154,9 @@ UCSchachtanbindung.cs + + PreserveNewest + PreserveNewest diff --git a/SanSystem/documents/JUME/KalibrierungAuflistung.docx b/SanSystem/documents/JUME/KalibrierungAuflistung.docx new file mode 100644 index 0000000..1558d10 Binary files /dev/null and b/SanSystem/documents/JUME/KalibrierungAuflistung.docx differ diff --git a/SanSystem/frmObjektEdit.Designer.cs b/SanSystem/frmObjektEdit.Designer.cs index 6e20396..8888ac9 100644 --- a/SanSystem/frmObjektEdit.Designer.cs +++ b/SanSystem/frmObjektEdit.Designer.cs @@ -30,6 +30,8 @@ { this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); + this.txt_ort = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); this.txt_bemerkung = new System.Windows.Forms.TextBox(); this.txt_objekt_name = new System.Windows.Forms.TextBox(); this.lbl_objektname = new System.Windows.Forms.Label(); @@ -58,8 +60,6 @@ this.btn_close = new System.Windows.Forms.Button(); this.btn_add_san = new System.Windows.Forms.Button(); this.btn_delete = new System.Windows.Forms.Button(); - this.label7 = new System.Windows.Forms.Label(); - this.txt_ort = new System.Windows.Forms.TextBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.groupBox2.SuspendLayout(); @@ -104,15 +104,33 @@ this.tabPage1.Controls.Add(this.label2); this.tabPage1.Controls.Add(this.label1); this.tabPage1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.tabPage1.Location = new System.Drawing.Point(4, 34); + this.tabPage1.Location = new System.Drawing.Point(4, 29); this.tabPage1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.tabPage1.Size = new System.Drawing.Size(1256, 574); + this.tabPage1.Size = new System.Drawing.Size(1256, 579); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "Grunddaten"; this.tabPage1.UseVisualStyleBackColor = true; // + // txt_ort + // + this.txt_ort.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txt_ort.Location = new System.Drawing.Point(745, 139); + this.txt_ort.Name = "txt_ort"; + this.txt_ort.Size = new System.Drawing.Size(191, 26); + this.txt_ort.TabIndex = 28; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label7.Location = new System.Drawing.Point(584, 136); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(31, 20); + this.label7.TabIndex = 27; + this.label7.Text = "Ort"; + // // txt_bemerkung // this.txt_bemerkung.Location = new System.Drawing.Point(730, 191); @@ -126,7 +144,7 @@ this.txt_objekt_name.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_objekt_name.Location = new System.Drawing.Point(192, 67); this.txt_objekt_name.Name = "txt_objekt_name"; - this.txt_objekt_name.Size = new System.Drawing.Size(330, 30); + this.txt_objekt_name.Size = new System.Drawing.Size(330, 26); this.txt_objekt_name.TabIndex = 2; // // lbl_objektname @@ -135,7 +153,7 @@ this.lbl_objektname.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbl_objektname.Location = new System.Drawing.Point(9, 70); this.lbl_objektname.Name = "lbl_objektname"; - this.lbl_objektname.Size = new System.Drawing.Size(118, 25); + this.lbl_objektname.Size = new System.Drawing.Size(95, 20); this.lbl_objektname.TabIndex = 25; this.lbl_objektname.Text = "Objektname"; // @@ -180,7 +198,7 @@ "Ziegelwerk"}); this.cb_material.Location = new System.Drawing.Point(192, 252); this.cb_material.Name = "cb_material"; - this.cb_material.Size = new System.Drawing.Size(323, 33); + this.cb_material.Size = new System.Drawing.Size(323, 28); this.cb_material.TabIndex = 6; // // groupBox2 @@ -202,7 +220,7 @@ this.txt_haltungslaenge.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_haltungslaenge.Location = new System.Drawing.Point(188, 21); this.txt_haltungslaenge.Name = "txt_haltungslaenge"; - this.txt_haltungslaenge.Size = new System.Drawing.Size(136, 30); + this.txt_haltungslaenge.Size = new System.Drawing.Size(136, 26); this.txt_haltungslaenge.TabIndex = 11; // // txt_laenge_schacht @@ -210,7 +228,7 @@ this.txt_laenge_schacht.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_laenge_schacht.Location = new System.Drawing.Point(188, 112); this.txt_laenge_schacht.Name = "txt_laenge_schacht"; - this.txt_laenge_schacht.Size = new System.Drawing.Size(136, 30); + this.txt_laenge_schacht.Size = new System.Drawing.Size(136, 26); this.txt_laenge_schacht.TabIndex = 13; // // label21 @@ -219,7 +237,7 @@ this.label21.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label21.Location = new System.Drawing.Point(6, 114); this.label21.Name = "label21"; - this.label21.Size = new System.Drawing.Size(132, 25); + this.label21.Size = new System.Drawing.Size(107, 20); this.label21.TabIndex = 21; this.label21.Text = "Schachtlänge"; // @@ -229,7 +247,7 @@ this.checkBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.checkBox1.Location = new System.Drawing.Point(9, 75); this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(210, 29); + this.checkBox1.Size = new System.Drawing.Size(172, 24); this.checkBox1.TabIndex = 12; this.checkBox1.Text = "Geschlossene Ende"; this.checkBox1.UseVisualStyleBackColor = true; @@ -241,7 +259,7 @@ this.label6.Location = new System.Drawing.Point(5, 26); this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(137, 25); + this.label6.Size = new System.Drawing.Size(112, 20); this.label6.TabIndex = 5; this.label6.Text = "Haltungslänge"; // @@ -254,7 +272,7 @@ this.dt_haltunggemessen_datum.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.dt_haltunggemessen_datum.Name = "dt_haltunggemessen_datum"; this.dt_haltunggemessen_datum.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.dt_haltunggemessen_datum.Size = new System.Drawing.Size(354, 30); + this.dt_haltunggemessen_datum.Size = new System.Drawing.Size(354, 26); this.dt_haltunggemessen_datum.TabIndex = 10; // // label20 @@ -264,7 +282,7 @@ this.label20.Location = new System.Drawing.Point(8, 300); this.label20.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label20.Name = "label20"; - this.label20.Size = new System.Drawing.Size(265, 25); + this.label20.Size = new System.Drawing.Size(216, 20); this.label20.TabIndex = 16; this.label20.Text = "Haltungslänge gemessen am"; // @@ -274,7 +292,7 @@ this.txt_hausnummer.Location = new System.Drawing.Point(758, 85); this.txt_hausnummer.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.txt_hausnummer.Name = "txt_hausnummer"; - this.txt_hausnummer.Size = new System.Drawing.Size(148, 30); + this.txt_hausnummer.Size = new System.Drawing.Size(148, 26); this.txt_hausnummer.TabIndex = 8; // // txt_strasse @@ -283,7 +301,7 @@ this.txt_strasse.Location = new System.Drawing.Point(758, 35); this.txt_strasse.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.txt_strasse.Name = "txt_strasse"; - this.txt_strasse.Size = new System.Drawing.Size(320, 30); + this.txt_strasse.Size = new System.Drawing.Size(320, 26); this.txt_strasse.TabIndex = 7; // // label19 @@ -293,7 +311,7 @@ this.label19.Location = new System.Drawing.Point(560, 89); this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label19.Name = "label19"; - this.label19.Size = new System.Drawing.Size(129, 25); + this.label19.Size = new System.Drawing.Size(105, 20); this.label19.TabIndex = 13; this.label19.Text = "Hausnummer"; // @@ -304,7 +322,7 @@ this.label18.Location = new System.Drawing.Point(560, 40); this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label18.Name = "label18"; - this.label18.Size = new System.Drawing.Size(79, 25); + this.label18.Size = new System.Drawing.Size(64, 20); this.label18.TabIndex = 12; this.label18.Text = "Strasse"; // @@ -314,7 +332,7 @@ this.txt_dn.Location = new System.Drawing.Point(192, 201); this.txt_dn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.txt_dn.Name = "txt_dn"; - this.txt_dn.Size = new System.Drawing.Size(330, 30); + this.txt_dn.Size = new System.Drawing.Size(330, 26); this.txt_dn.TabIndex = 5; // // txt_punkt_bis @@ -323,7 +341,7 @@ this.txt_punkt_bis.Location = new System.Drawing.Point(192, 153); this.txt_punkt_bis.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.txt_punkt_bis.Name = "txt_punkt_bis"; - this.txt_punkt_bis.Size = new System.Drawing.Size(330, 30); + this.txt_punkt_bis.Size = new System.Drawing.Size(330, 26); this.txt_punkt_bis.TabIndex = 4; // // txt_punkt_von @@ -332,7 +350,7 @@ this.txt_punkt_von.Location = new System.Drawing.Point(192, 107); this.txt_punkt_von.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.txt_punkt_von.Name = "txt_punkt_von"; - this.txt_punkt_von.Size = new System.Drawing.Size(330, 30); + this.txt_punkt_von.Size = new System.Drawing.Size(330, 26); this.txt_punkt_von.TabIndex = 3; // // txt_pro_nr @@ -341,7 +359,7 @@ this.txt_pro_nr.Location = new System.Drawing.Point(192, 31); this.txt_pro_nr.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.txt_pro_nr.Name = "txt_pro_nr"; - this.txt_pro_nr.Size = new System.Drawing.Size(330, 30); + this.txt_pro_nr.Size = new System.Drawing.Size(330, 26); this.txt_pro_nr.TabIndex = 1; // // label5 @@ -351,7 +369,7 @@ this.label5.Location = new System.Drawing.Point(9, 255); this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(81, 25); + this.label5.Size = new System.Drawing.Size(65, 20); this.label5.TabIndex = 4; this.label5.Text = "Material"; // @@ -362,7 +380,7 @@ this.label4.Location = new System.Drawing.Point(9, 204); this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(128, 25); + this.label4.Size = new System.Drawing.Size(104, 20); this.label4.TabIndex = 3; this.label4.Text = "Durchmesser"; // @@ -373,7 +391,7 @@ this.label3.Location = new System.Drawing.Point(9, 156); this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(94, 25); + this.label3.Size = new System.Drawing.Size(76, 20); this.label3.TabIndex = 2; this.label3.Text = "Bis Punkt"; // @@ -384,7 +402,7 @@ this.label2.Location = new System.Drawing.Point(9, 110); this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(103, 25); + this.label2.Size = new System.Drawing.Size(83, 20); this.label2.TabIndex = 1; this.label2.Text = "Von Punkt"; // @@ -395,7 +413,7 @@ this.label1.Location = new System.Drawing.Point(9, 35); this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(143, 25); + this.label1.Size = new System.Drawing.Size(116, 20); this.label1.TabIndex = 0; this.label1.Text = "Projektnummer"; // @@ -431,27 +449,9 @@ this.btn_delete.UseVisualStyleBackColor = true; this.btn_delete.Click += new System.EventHandler(this.btn_delete_Click); // - // label7 - // - this.label7.AutoSize = true; - this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label7.Location = new System.Drawing.Point(584, 136); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(39, 25); - this.label7.TabIndex = 27; - this.label7.Text = "Ort"; - // - // txt_ort - // - this.txt_ort.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txt_ort.Location = new System.Drawing.Point(745, 139); - this.txt_ort.Name = "txt_ort"; - this.txt_ort.Size = new System.Drawing.Size(191, 30); - this.txt_ort.TabIndex = 28; - // // frmObjektEdit // - this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoSize = true; this.ClientSize = new System.Drawing.Size(1290, 702); @@ -464,7 +464,7 @@ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.Name = "frmObjektEdit"; - this.Text = "FrmObjektEdit"; + this.Text = "Editieren"; this.Load += new System.EventHandler(this.frmObjektEdit_Load); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); diff --git a/SanSystem/frmObjekteList.Designer.cs b/SanSystem/frmObjekteList.Designer.cs index 9bfcc12..5667db4 100644 --- a/SanSystem/frmObjekteList.Designer.cs +++ b/SanSystem/frmObjekteList.Designer.cs @@ -47,6 +47,8 @@ this.label5 = new System.Windows.Forms.Label(); this.lbl_grounddata = new System.Windows.Forms.Label(); this.gb_error_messages = new System.Windows.Forms.GroupBox(); + this.btn_search = new System.Windows.Forms.Button(); + this.btn_make_ausdruck = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dGObjekte)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.strasseBindingSource)).BeginInit(); this.gb_error_messages.SuspendLayout(); @@ -222,11 +224,32 @@ this.gb_error_messages.TabStop = false; this.gb_error_messages.Text = "error_messages"; // + // btn_search + // + this.btn_search.Location = new System.Drawing.Point(640, 214); + this.btn_search.Name = "btn_search"; + this.btn_search.Size = new System.Drawing.Size(119, 101); + this.btn_search.TabIndex = 17; + this.btn_search.Text = "Suchen"; + this.btn_search.UseVisualStyleBackColor = true; + // + // btn_make_ausdruck + // + this.btn_make_ausdruck.Location = new System.Drawing.Point(780, 222); + this.btn_make_ausdruck.Name = "btn_make_ausdruck"; + this.btn_make_ausdruck.Size = new System.Drawing.Size(84, 92); + this.btn_make_ausdruck.TabIndex = 18; + this.btn_make_ausdruck.Text = "Ausdruck für Pregnieren"; + this.btn_make_ausdruck.UseVisualStyleBackColor = true; + this.btn_make_ausdruck.Click += new System.EventHandler(this.btn_make_ausdruck_Click); + // // frmObjekteList // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(879, 338); + this.Controls.Add(this.btn_make_ausdruck); + this.Controls.Add(this.btn_search); this.Controls.Add(this.gb_error_messages); this.Controls.Add(this.txt_ort); this.Controls.Add(this.lbl_ort); @@ -243,7 +266,7 @@ this.Margin = new System.Windows.Forms.Padding(2); this.Name = "frmObjekteList"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "frmObjekteList"; + this.Text = "Objekte List"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmObjekteList_FormClosing); this.Load += new System.EventHandler(this.frmObjekteList_Load); ((System.ComponentModel.ISupportInitialize)(this.dGObjekte)).EndInit(); @@ -275,5 +298,7 @@ private System.Windows.Forms.Label label5; private System.Windows.Forms.Label lbl_grounddata; private System.Windows.Forms.GroupBox gb_error_messages; + private System.Windows.Forms.Button btn_search; + private System.Windows.Forms.Button btn_make_ausdruck; } } \ No newline at end of file diff --git a/SanSystem/frmObjekteList.cs b/SanSystem/frmObjekteList.cs index c1eaa02..8532a75 100644 --- a/SanSystem/frmObjekteList.cs +++ b/SanSystem/frmObjekteList.cs @@ -2,6 +2,7 @@ using KlassenBIB; using SanSystem.Einstellungen; using System; +using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; @@ -22,6 +23,12 @@ namespace SanSystem private void loadObjekte(string streetname) { + DataGridViewCheckBoxColumn checkBoxColumn = new DataGridViewCheckBoxColumn(); + checkBoxColumn.Name = "Auswahl"; + checkBoxColumn.HeaderText = "Auswahl"; + //checkBoxColumn.Width = objecteListSetting.configuration["Auswahl"]; + + dGObjekte.Columns.Add(checkBoxColumn); dGObjekte.DataSource = null; inspektionsobjekte = Datenbank.Instance.loadedProjekt.Objekte.FindAll(x => x.StrasseName.Equals(streetname)); @@ -195,10 +202,15 @@ namespace SanSystem dGObjekte.Columns["Haltunggemessen"].Visible = false; dGObjekte.Columns["Bemerkung"].Visible = false; - dGObjekte.Columns["Hausnummer"].Width = objecteListSetting.configuration["Hausnummer"]; - dGObjekte.Columns["VonPunkt"].Width = objecteListSetting.configuration["VonPunkt"]; - dGObjekte.Columns["BisPunkt"].Width = objecteListSetting.configuration["BisPunkt"]; - dGObjekte.Columns["Haltungslaenge"].Width = objecteListSetting.configuration["Haltungslaenge"]; + + + dGObjekte.Columns["Auswahl"].Width = objecteListSetting.GetWidth(dGObjekte.Columns["Auswahl"]); // objecteListSetting.configuration["Auswahl"]; + dGObjekte.Columns["Hausnummer"].Width = objecteListSetting.GetWidth(dGObjekte.Columns["Hausnummer"]);//objecteListSetting.configuration["Hausnummer"]; + dGObjekte.Columns["VonPunkt"].Width = objecteListSetting.GetWidth(dGObjekte.Columns["VonPunkt"]);//objecteListSetting.configuration["VonPunkt"]; + dGObjekte.Columns["BisPunkt"].Width = objecteListSetting.GetWidth(dGObjekte.Columns["BisPunkt"]);// objecteListSetting.configuration["BisPunkt"]; + dGObjekte.Columns["Haltungslaenge"].Width = objecteListSetting.GetWidth(dGObjekte.Columns["Haltungslaenge"]); //objecteListSetting.configuration["Haltungslaenge"]; + + //dGObjekte.Columns["Sanierung"].Visible = false; } @@ -209,11 +221,71 @@ namespace SanSystem private void frmObjekteList_FormClosing(object sender, FormClosingEventArgs e) { - objecteListSetting.configuration["Hausnummer"] = dGObjekte.Columns["Hausnummer"].Width; - objecteListSetting.configuration["VonPunkt"] = dGObjekte.Columns["VonPunkt"].Width; - objecteListSetting.configuration["BisPunkt"] = dGObjekte.Columns["BisPunkt"].Width; - objecteListSetting.configuration["Haltungslaenge"] = dGObjekte.Columns["Haltungslaenge"].Width; + objecteListSetting.SetWidth(dGObjekte.Columns["Hausnummer"]); + objecteListSetting.SetWidth(dGObjekte.Columns["VonPunkt"]); + objecteListSetting.SetWidth(dGObjekte.Columns["BisPunkt"]); + objecteListSetting.SetWidth(dGObjekte.Columns["Haltungslaenge"]); + objecteListSetting.SetWidth(dGObjekte.Columns["Auswahl"]); + objecteListSetting.SaveSettings(); + + } + + private void btn_make_ausdruck_Click(object sender, EventArgs e) + { + List ausdruck = new List(); + + DataGridViewCheckBoxCell checkBoxCell = null; + + foreach(DataGridViewRow dr in dGObjekte.Rows) + { + checkBoxCell = (DataGridViewCheckBoxCell)dr.Cells["Auswahl"]; + if (checkBoxCell == null) break; + if (checkBoxCell.Value == null) continue; + if ((bool)checkBoxCell.Value) ausdruck.Add((dr.DataBoundItem as Inspektionsobjekt)); + } + + if (ausdruck.Count <= 0) return; + + Hashtable grundDaten = new Hashtable() + { + {"Ausdruck_datum","" }, + {"Strasse","" }, + {"Ort","" } + }; + + grundDaten["Ausdruck_datum"] = DateTime.Now.ToLongDateString(); + + grundDaten["Strasse"] = txt_strasse.Text; + grundDaten["Ort"] = txt_ort.Text; + + DataTable linereintraege = getLinerTable(); + + foreach(Inspektionsobjekt obj in ausdruck) + { + DataRow dr = linereintraege.NewRow(); + dr["hausnummer"] = obj.Hausnummer; + dr["liner_laenge"] = obj.Haltungslaenge; + dr["schacht_laenge"] = obj.Schachtlaenge; + dr["bemerkung"] = obj.Bemerkung; + linereintraege.Rows.Add(dr); + } + BerichtGen.Options options = new BerichtGen.Options("JUME", "KalibrierungAuflistung.docx", "", grundDaten, null, linereintraege); + options.ShowDialog(); + } + + private static DataTable getLinerTable() + { + DataTable dataTable = new DataTable("Liner"); + DataColumn dataColumn = new DataColumn("hausnummer") { MaxLength = 80 }; + dataTable.Columns.Add(dataColumn); + dataColumn = new DataColumn("liner_laenge") { MaxLength = 50 }; + dataTable.Columns.Add(dataColumn); + dataColumn = new DataColumn("schacht_laenge") { MaxLength = 50 }; + dataTable.Columns.Add(dataColumn); + dataColumn = new DataColumn("bemerkung") { MaxLength = 255 }; + dataTable.Columns.Add(dataColumn); + return dataTable; } } } diff --git a/SanSystem/frmStrassenList.Designer.cs b/SanSystem/frmStrassenList.Designer.cs index ed18102..70ed384 100644 --- a/SanSystem/frmStrassenList.Designer.cs +++ b/SanSystem/frmStrassenList.Designer.cs @@ -67,7 +67,7 @@ this.Controls.Add(this.lst_strassen); this.Margin = new System.Windows.Forms.Padding(2); this.Name = "frmStrassenList"; - this.Text = "frmStrassenList"; + this.Text = "Strassen"; this.Load += new System.EventHandler(this.frmStrassenList_Load); this.ResumeLayout(false);