From de0b84076f50e961100c202c062459306a6fb2ea Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Tue, 8 Dec 2020 08:51:07 +0100 Subject: [PATCH] UpgradeSelectionDlg : Cutom button with an action that is commented out, ver. 2.26.1555 --- TBF/Properties/AssemblyInfo.cs | 4 +- .../Settings/UpgradeSelectionDlg.Designer.cs | 13 +++++ TBF/UI/Settings/UpgradeSelectionDlg.cs | 52 +++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index f417accf5..add100822 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.26.1554.0")] -[assembly: AssemblyFileVersion("2.26.1554.0")] +[assembly: AssemblyVersion("2.26.1555.0")] +[assembly: AssemblyFileVersion("2.26.1555.0")] diff --git a/TBF/UI/Settings/UpgradeSelectionDlg.Designer.cs b/TBF/UI/Settings/UpgradeSelectionDlg.Designer.cs index 266c53c19..3c9d45cdb 100644 --- a/TBF/UI/Settings/UpgradeSelectionDlg.Designer.cs +++ b/TBF/UI/Settings/UpgradeSelectionDlg.Designer.cs @@ -48,6 +48,7 @@ this.errorFlagsComponentsTextBox = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.upgradeDb_225_226_Button = new System.Windows.Forms.Button(); + this.customButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // upgradeDb_215_216_Button @@ -248,11 +249,22 @@ this.upgradeDb_225_226_Button.UseVisualStyleBackColor = true; this.upgradeDb_225_226_Button.Click += new System.EventHandler(this.upgradeDb_225_226_Button_Click); // + // customButton + // + this.customButton.Location = new System.Drawing.Point(216, 14); + this.customButton.Name = "customButton"; + this.customButton.Size = new System.Drawing.Size(56, 37); + this.customButton.TabIndex = 20; + this.customButton.Text = "Custom"; + this.customButton.UseVisualStyleBackColor = true; + this.customButton.Click += new System.EventHandler(this.customButton_Click); + // // UpgradeSelectionDlg // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(284, 597); + this.Controls.Add(this.customButton); this.Controls.Add(this.upgradeDb_225_226_Button); this.Controls.Add(this.label3); this.Controls.Add(this.errorFlagsComponentsTextBox); @@ -302,6 +314,7 @@ private System.Windows.Forms.TextBox errorFlagsComponentsTextBox; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button upgradeDb_225_226_Button; + private System.Windows.Forms.Button customButton; } } \ No newline at end of file diff --git a/TBF/UI/Settings/UpgradeSelectionDlg.cs b/TBF/UI/Settings/UpgradeSelectionDlg.cs index 2335db716..ae126404f 100644 --- a/TBF/UI/Settings/UpgradeSelectionDlg.cs +++ b/TBF/UI/Settings/UpgradeSelectionDlg.cs @@ -11,6 +11,7 @@ using NHibernate; using Results; using Results.Entities; using TBF.Resources; +using System.Text; namespace TBF.UI.Settings { @@ -1041,5 +1042,56 @@ namespace TBF.UI.Settings "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } + + private void customButton_Click(object sender, EventArgs e) + { + ActivityStart(); + + try + { + //ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + + //var proceduresToModify = session.QueryOver() + // .Where(x => (x.ProcedureState == Config.Entities.ProcedureState.Active)) + // .OrderBy(x => x.ItemNr).Asc + // .List(); + + //foreach (var proc in proceduresToModify) + //{ + // if (!string.IsNullOrEmpty(proc.ResultsWriter) && proc.ResultsWriter.Contains("IperlLogger")) + // { + // Console.WriteLine("{0} ... {1}", proc.Name, proc.ResultsWriter); + // string[] writers = proc.ResultsWriter.Split(new char[] { '~' }); + // StringBuilder sb = new StringBuilder(); + // for (int i = 0; i < writers.Length; i++) + // { + // if (writers[i].Contains("IperlLogger")) + // { + // sb.Append("IperlLogger"); + // } + // else + // { + // sb.Append(writers[i]); + // } + + // if (i != writers.Length - 1) sb.Append("~"); + // } + // proc.ResultsWriter = sb.ToString(); + + // session.SaveOrUpdate(proc); + // } + //} + + //session.Flush(); + ActivityEnd(); + MessageBox.Show("Upgrade completed", "", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception exc) + { + ActivityEnd(); + MessageBox.Show(string.Format("Upgrade failed:\r\n{0}", exc.Message), + "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } } }