diff --git a/SanSystem/Global.cs b/SanSystem/Global.cs index fc7e332..4d1145a 100644 --- a/SanSystem/Global.cs +++ b/SanSystem/Global.cs @@ -1,6 +1,7 @@ using SanShared; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -11,7 +12,16 @@ namespace SanSystem { public static readonly Global instance = new Global(); - public string projektpfad = "temp"; + const string speicherpfad_to_projekts = "projekte"; + string projektpfad = "18-850"; + + public string Projektpfad + { + get + { + return Path.Combine(speicherpfad_to_projekts, projektpfad); + } + } public ILanguage language = null; public static Global Instance diff --git a/SanSystem/SanSystem.csproj b/SanSystem/SanSystem.csproj index 3c3984b..e37dcab 100644 --- a/SanSystem/SanSystem.csproj +++ b/SanSystem/SanSystem.csproj @@ -32,11 +32,15 @@ 4 + + ..\packages\FluentFTP.19.2.2\lib\net45\FluentFTP.dll + ..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll + diff --git a/SanSystem/UCInliner.Designer.cs b/SanSystem/UCInliner.Designer.cs index 4a4687d..cc75f5a 100644 --- a/SanSystem/UCInliner.Designer.cs +++ b/SanSystem/UCInliner.Designer.cs @@ -67,6 +67,8 @@ this.label11 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); + this.btn_transfer_ftp = new System.Windows.Forms.Button(); + this.ftpProgress = new System.Windows.Forms.ProgressBar(); this.tabControl1.SuspendLayout(); this.tabPage2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -88,6 +90,8 @@ // // tabPage2 // + this.tabPage2.Controls.Add(this.ftpProgress); + this.tabPage2.Controls.Add(this.btn_transfer_ftp); this.tabPage2.Controls.Add(this.label1); this.tabPage2.Controls.Add(this.dt_eingebaut); this.tabPage2.Controls.Add(this.cb_fertig); @@ -511,6 +515,23 @@ this.label9.TabIndex = 0; this.label9.Text = "Harz"; // + // btn_transfer_ftp + // + this.btn_transfer_ftp.Location = new System.Drawing.Point(820, 317); + this.btn_transfer_ftp.Name = "btn_transfer_ftp"; + this.btn_transfer_ftp.Size = new System.Drawing.Size(224, 126); + this.btn_transfer_ftp.TabIndex = 28; + this.btn_transfer_ftp.Text = "button1"; + this.btn_transfer_ftp.UseVisualStyleBackColor = true; + this.btn_transfer_ftp.Click += new System.EventHandler(this.btn_transfer_ftp_Click); + // + // ftpProgress + // + this.ftpProgress.Location = new System.Drawing.Point(782, 487); + this.ftpProgress.Name = "ftpProgress"; + this.ftpProgress.Size = new System.Drawing.Size(280, 37); + this.ftpProgress.TabIndex = 29; + // // UCInliner // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); @@ -575,5 +596,7 @@ private System.Windows.Forms.CheckBox cb_fertig; private System.Windows.Forms.Label label1; private System.Windows.Forms.DateTimePicker dt_eingebaut; + private System.Windows.Forms.Button btn_transfer_ftp; + private System.Windows.Forms.ProgressBar ftpProgress; } } diff --git a/SanSystem/UCInliner.cs b/SanSystem/UCInliner.cs index a131af2..0a50db7 100644 --- a/SanSystem/UCInliner.cs +++ b/SanSystem/UCInliner.cs @@ -11,6 +11,7 @@ using KlassenBIB; using System.Diagnostics; using System.IO; using SanShared; +using FluentFTP; namespace SanSystem { @@ -24,6 +25,7 @@ namespace SanSystem } InlinerSanierung inliner = null; string destinationPath = string.Empty; + List filenames = new List(); public UCInliner(InlinerSanierung san) { InitializeComponent(); @@ -101,7 +103,7 @@ namespace SanSystem private void CheckDirectories() { - destinationPath = inliner.CheckVerzeichnisse(Global.Instance.projektpfad); + destinationPath = inliner.CheckVerzeichnisse(Global.Instance.Projektpfad); } private void btn_get_temp_Click(object sender, EventArgs e) @@ -114,5 +116,67 @@ namespace SanSystem txt_temp_aussen.Update(); } + + private void btn_transfer_ftp_Click(object sender, EventArgs e) + { + + Progress progress = new Progress(x => + { + if(x < 0) + { + + } + else + { + ftpProgress.Value = Convert.ToInt32(x); + } + }); + filenames.Clear(); + if (MessageBox.Show("Bitte stellen Sie sicher, dass der Server antwortet und dass nur die Dateien vorhanden sind!", "WARNUNG", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop) == DialogResult.OK) + { + + try + { + + FtpClient client = new FtpClient("192.168.1.2"); + client.Credentials = new System.Net.NetworkCredential("damian", "bodde05"); + client.Connect(); + //client.ListingParser = FtpParser.UnixAlt; + + ListFiles(client, "/"); + + foreach (string file in filenames) + { + string[] _tdateiname = file.Split('/'); + string dateiname = _tdateiname[_tdateiname.Length - 1]; + string ordner = _tdateiname[_tdateiname.Length - 2]; + + client.DownloadFile(Path.Combine(destinationPath, ordner, dateiname), file, true, FluentFTP.FtpVerify.None, progress); + client.DeleteFile(file); + + } + } + catch(TimeoutException ex) + { + MessageBox.Show("Die anlage reagiert nicht!"); + } + } + + } + + private void ListFiles(FtpClient client, string directory) + { + foreach (FtpListItem item in client.GetListing(directory)) + { + if (item.Type == FtpFileSystemObjectType.File) + { + filenames.Add(item.FullName); + } + else if (item.Type == FtpFileSystemObjectType.Directory) + { + ListFiles(client, item.FullName); + } + } + } } } diff --git a/SanSystem/UCSchachtanbindung.cs b/SanSystem/UCSchachtanbindung.cs index 075ac57..8f0ea72 100644 --- a/SanSystem/UCSchachtanbindung.cs +++ b/SanSystem/UCSchachtanbindung.cs @@ -29,13 +29,14 @@ namespace SanSystem cb_erledigt.DataBindings.Add(new Binding("Checked", schacht, "Fertig")); lb_pictures.DataSource = schacht.SavedBilders; - mydestination = schacht.CheckVerzeichnisse(""); + + mydestination = schacht.CheckVerzeichnisse(Global.Instance.Projektpfad); if(schacht.SavedBilders.Count > 0) { //pt_box.Image = Image.FromFile(Path.Combine("temp",schacht.SavedBilders[0].Speicherpfad)); - pt_box.Load(Path.Combine("temp", schacht.SavedBilders[0].Speicherpfad)); + pt_box.Load(Path.Combine(schacht.SavedBilders[0].Speicherpfad)); pt_box.SizeMode = PictureBoxSizeMode.StretchImage; } } @@ -55,11 +56,11 @@ namespace SanSystem { if (pt_box == null) throw new Exception(); string speicherpfad = Path.Combine(mydestination, targetname); - File.Copy(source, Path.Combine("temp",speicherpfad)); + File.Copy(source, speicherpfad); bilder.Bildname = "Anbindung"; bilder.Speicherpfad = speicherpfad; schacht.SavedBilders.Add(bilder); - pt_box.Load(Path.Combine("temp", schacht.SavedBilders[0].Speicherpfad)); + pt_box.Load(schacht.SavedBilders[0].Speicherpfad); pt_box.SizeMode = PictureBoxSizeMode.StretchImage; lb_pictures.DataSource = null; lb_pictures.DataSource = schacht.SavedBilders; @@ -90,7 +91,7 @@ namespace SanSystem schacht.SavedBilders.Remove(bild); pt_box.Image = null; pt_box.Dispose(); - File.Delete(Path.Combine(Global.Instance.projektpfad, bild.Speicherpfad)); + File.Delete(Path.Combine(Global.Instance.Projektpfad, bild.Speicherpfad)); lb_pictures.DataSource = null; lb_pictures.DataSource = schacht.SavedBilders; } diff --git a/SanSystem/frmMain.cs b/SanSystem/frmMain.cs index 5292260..cff0c14 100644 --- a/SanSystem/frmMain.cs +++ b/SanSystem/frmMain.cs @@ -1,10 +1,13 @@ using Database; +using FluentFTP; using KlassenBIB; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; +using System.Diagnostics; using System.Drawing; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -14,12 +17,16 @@ namespace SanSystem { public partial class frmMain : Form { + public frmMain() { InitializeComponent(); - Datenbank.Instance.LoadProjekt("./temp/18-850.xaml"); + if (!Directory.Exists(Global.Instance.Projektpfad)) Directory.CreateDirectory(Global.Instance.Projektpfad); + Datenbank.Instance.LoadProjekt(Path.Combine(Global.Instance.Projektpfad,"18-850.xaml")); + + //Datenbank.Instance.CreateProjekt(""); this.Width = Screen.PrimaryScreen.WorkingArea.Width; this.Height = Screen.PrimaryScreen.WorkingArea.Height; @@ -33,6 +40,8 @@ namespace SanSystem } + + private void frm_main_Load(object sender, EventArgs e) { diff --git a/SanSystem/frmObjektEdit.cs b/SanSystem/frmObjektEdit.cs index d752667..973b945 100644 --- a/SanSystem/frmObjektEdit.cs +++ b/SanSystem/frmObjektEdit.cs @@ -63,6 +63,7 @@ namespace SanSystem txt_dn.DataBindings.Add(new Binding("Text", inspektionsobjekt, "Kanalrohrweite")); txt_pro_nr.DataBindings.Add(new Binding("Text", inspektionsobjekt, "ProjektNummer")); dt_haltunggemessen_datum.DataBindings.Add(new Binding("Value", inspektionsobjekt, "HaltungGemessen")); + } private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) diff --git a/SanSystem/frmObjekteList.Designer.cs b/SanSystem/frmObjekteList.Designer.cs index a978ce2..d3c28a8 100644 --- a/SanSystem/frmObjekteList.Designer.cs +++ b/SanSystem/frmObjekteList.Designer.cs @@ -56,12 +56,12 @@ // this.dGObjekte.AllowUserToOrderColumns = true; this.dGObjekte.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dGObjekte.Location = new System.Drawing.Point(9, 133); + this.dGObjekte.Location = new System.Drawing.Point(10, 77); this.dGObjekte.Margin = new System.Windows.Forms.Padding(2); this.dGObjekte.MultiSelect = false; this.dGObjekte.Name = "dGObjekte"; this.dGObjekte.RowTemplate.Height = 24; - this.dGObjekte.Size = new System.Drawing.Size(957, 238); + this.dGObjekte.Size = new System.Drawing.Size(499, 238); this.dGObjekte.TabIndex = 0; this.dGObjekte.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dGObjekte_CellEndEdit); this.dGObjekte.DataBindingComplete += new System.Windows.Forms.DataGridViewBindingCompleteEventHandler(this.dGObjekte_DataBindingComplete); @@ -69,7 +69,7 @@ // // btn_add // - this.btn_add.Location = new System.Drawing.Point(763, 387); + this.btn_add.Location = new System.Drawing.Point(533, 214); this.btn_add.Margin = new System.Windows.Forms.Padding(2); this.btn_add.Name = "btn_add"; this.btn_add.Size = new System.Drawing.Size(102, 101); @@ -174,15 +174,15 @@ this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.Location = new System.Drawing.Point(15, 25); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(51, 20); + this.label1.Size = new System.Drawing.Size(25, 20); this.label1.TabIndex = 12; - this.label1.Text = "label1"; + this.label1.Text = " "; // // lbl_projwrong // this.lbl_projwrong.AutoSize = true; this.lbl_projwrong.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbl_projwrong.Location = new System.Drawing.Point(75, 25); + this.lbl_projwrong.Location = new System.Drawing.Point(46, 25); this.lbl_projwrong.Name = "lbl_projwrong"; this.lbl_projwrong.Size = new System.Drawing.Size(51, 20); this.lbl_projwrong.TabIndex = 13; @@ -194,15 +194,15 @@ this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label5.Location = new System.Drawing.Point(15, 51); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(51, 20); + this.label5.Size = new System.Drawing.Size(25, 20); this.label5.TabIndex = 14; - this.label5.Text = "label5"; + this.label5.Text = " "; // // lbl_grounddata // this.lbl_grounddata.AutoSize = true; this.lbl_grounddata.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbl_grounddata.Location = new System.Drawing.Point(75, 51); + this.lbl_grounddata.Location = new System.Drawing.Point(46, 51); this.lbl_grounddata.Name = "lbl_grounddata"; this.lbl_grounddata.Size = new System.Drawing.Size(51, 20); this.lbl_grounddata.TabIndex = 15; @@ -214,9 +214,9 @@ this.gb_error_messages.Controls.Add(this.lbl_grounddata); this.gb_error_messages.Controls.Add(this.label1); this.gb_error_messages.Controls.Add(this.label5); - this.gb_error_messages.Location = new System.Drawing.Point(12, 384); + this.gb_error_messages.Location = new System.Drawing.Point(514, 77); this.gb_error_messages.Name = "gb_error_messages"; - this.gb_error_messages.Size = new System.Drawing.Size(518, 103); + this.gb_error_messages.Size = new System.Drawing.Size(351, 103); this.gb_error_messages.TabIndex = 16; this.gb_error_messages.TabStop = false; this.gb_error_messages.Text = "error_messages"; @@ -225,7 +225,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(971, 499); + this.ClientSize = new System.Drawing.Size(879, 338); this.Controls.Add(this.gb_error_messages); this.Controls.Add(this.txt_ort); this.Controls.Add(this.lbl_ort); @@ -241,6 +241,7 @@ this.Controls.Add(this.dGObjekte); this.Margin = new System.Windows.Forms.Padding(2); this.Name = "frmObjekteList"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "frmObjekteList"; this.Load += new System.EventHandler(this.frmObjekteList_Load); ((System.ComponentModel.ISupportInitialize)(this.dGObjekte)).EndInit(); diff --git a/SanSystem/frmObjekteList.cs b/SanSystem/frmObjekteList.cs index 250a447..a698502 100644 --- a/SanSystem/frmObjekteList.cs +++ b/SanSystem/frmObjekteList.cs @@ -184,6 +184,11 @@ namespace SanSystem dGObjekte.Columns["StrasseName"].Visible = false; dGObjekte.Columns["OrtName"].Visible = false; dGObjekte.Columns["Projektnummer"].Visible = false; + dGObjekte.Columns["Rohrmaterial"].Visible = false; + dGObjekte.Columns["Kanalrohrweite"].Visible = false; + dGObjekte.Columns["Schachtlaenge"].Visible = false; + dGObjekte.Columns["Objektbezeichnung"].Visible = false; + dGObjekte.Columns["Haltunggemessen"].Visible = false; //dGObjekte.Columns["Sanierung"].Visible = false; } diff --git a/SanSystem/packages.config b/SanSystem/packages.config index 12e1c83..9351d06 100644 --- a/SanSystem/packages.config +++ b/SanSystem/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/SanVerwaltung.sln b/SanVerwaltung.sln index 79b80c8..5c29beb 100644 --- a/SanVerwaltung.sln +++ b/SanVerwaltung.sln @@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SanShared", "SanShared\SanS EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Language", "Language\Language.csproj", "{BE364E88-92DA-4A6C-97E7-DDD7D887B3D4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestResource", "TestResource\TestResource.csproj", "{FA1E9A66-79EC-4D07-99DE-63FB489E718B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -65,6 +67,10 @@ Global {BE364E88-92DA-4A6C-97E7-DDD7D887B3D4}.Debug|Any CPU.Build.0 = Debug|Any CPU {BE364E88-92DA-4A6C-97E7-DDD7D887B3D4}.Release|Any CPU.ActiveCfg = Release|Any CPU {BE364E88-92DA-4A6C-97E7-DDD7D887B3D4}.Release|Any CPU.Build.0 = Release|Any CPU + {FA1E9A66-79EC-4D07-99DE-63FB489E718B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA1E9A66-79EC-4D07-99DE-63FB489E718B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA1E9A66-79EC-4D07-99DE-63FB489E718B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA1E9A66-79EC-4D07-99DE-63FB489E718B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE