diff --git a/Statistics/LocalSettings.cs b/Statistics/LocalSettings.cs index ae171325f..82b337bde 100644 --- a/Statistics/LocalSettings.cs +++ b/Statistics/LocalSettings.cs @@ -18,7 +18,6 @@ namespace Statistics [XmlRootAttribute("Statistics")] public class LocalSettings { - public const int BenchesCount = 6; public const int FlowsCount = 5; @@ -47,115 +46,166 @@ namespace Statistics return ((ConnectionStrings != null) && (i >= 0) && (i < ConnectionStrings.Length)) ? ConnectionStrings[i] : string.Empty; } + /// + /// MID-s + /// + public string[] MidNames; + /// /// Flow settings /// - public bool[] FlowEnabledWMs; public bool[] FlowEnabledI1; public bool[] FlowEnabledI2; public bool[] FlowEnabledI3; public bool[] FlowEnabledI4; - /// - public bool GetFlowEnabled(UserControls.MidId midId, int i) + public bool[] FlowEnabledI5; + public bool[] FlowEnabledI6; + public bool[] FlowEnabledI7; + + + /// + /// Get flow enabled info + /// + /// 1-based MID id + /// 0-based flow id + /// true = enabled + public bool GetFlowEnabled(int midId, int i) { switch (midId) { - case UserControls.MidId.WaterMeters: - return ((FlowEnabledWMs != null) && (i >= 0) && (i < FlowEnabledWMs.Length)) ? FlowEnabledWMs[i] : false; - case UserControls.MidId.I1: return ((FlowEnabledI1 != null) && (i >= 0) && (i < FlowEnabledI1.Length)) ? FlowEnabledI1[i] : false; - case UserControls.MidId.I2: return ((FlowEnabledI2 != null) && (i >= 0) && (i < FlowEnabledI2.Length)) ? FlowEnabledI2[i] : false; - case UserControls.MidId.I3: return ((FlowEnabledI3 != null) && (i >= 0) && (i < FlowEnabledI3.Length)) ? FlowEnabledI3[i] : false; - case UserControls.MidId.I4: return ((FlowEnabledI4 != null) && (i >= 0) && (i < FlowEnabledI4.Length)) ? FlowEnabledI4[i] : false; + case 1: return ((FlowEnabledI1 != null) && (i >= 0) && (i < FlowEnabledI1.Length)) ? FlowEnabledI1[i] : false; + case 2: return ((FlowEnabledI2 != null) && (i >= 0) && (i < FlowEnabledI2.Length)) ? FlowEnabledI2[i] : false; + case 3: return ((FlowEnabledI3 != null) && (i >= 0) && (i < FlowEnabledI3.Length)) ? FlowEnabledI3[i] : false; + case 4: return ((FlowEnabledI4 != null) && (i >= 0) && (i < FlowEnabledI4.Length)) ? FlowEnabledI4[i] : false; + case 5: return ((FlowEnabledI5 != null) && (i >= 0) && (i < FlowEnabledI5.Length)) ? FlowEnabledI5[i] : false; + case 6: return ((FlowEnabledI6 != null) && (i >= 0) && (i < FlowEnabledI6.Length)) ? FlowEnabledI6[i] : false; + case 7: return ((FlowEnabledI7 != null) && (i >= 0) && (i < FlowEnabledI7.Length)) ? FlowEnabledI7[i] : false; default: return false; } } - /// - public void SetFlowEnabled(UserControls.MidId midId, int i, bool value) + + /// + /// Set flow enabled info + /// + /// 1-based MID id + /// 0-based flow id + /// true = enabled + public void SetFlowEnabled(int midId, int i, bool value) { switch (midId) { - case UserControls.MidId.WaterMeters: - if ((FlowEnabledWMs != null) && (i >= 0) && (i < FlowEnabledWMs.Length)) { FlowEnabledWMs[i] = value; }; - break; - case UserControls.MidId.I1: if ((FlowEnabledI1 != null) && (i >= 0) && (i < FlowEnabledI1.Length)) { FlowEnabledI1[i] = value; }; break; - case UserControls.MidId.I2: if ((FlowEnabledI2 != null) && (i >= 0) && (i < FlowEnabledI2.Length)) { FlowEnabledI2[i] = value; }; break; - case UserControls.MidId.I3: if ((FlowEnabledI3 != null) && (i >= 0) && (i < FlowEnabledI3.Length)) { FlowEnabledI3[i] = value; }; break; - case UserControls.MidId.I4: if ((FlowEnabledI4 != null) && (i >= 0) && (i < FlowEnabledI4.Length)) { FlowEnabledI4[i] = value; }; break; + case 1: if ((FlowEnabledI1 != null) && (i >= 0) && (i < FlowEnabledI1.Length)) { FlowEnabledI1[i] = value; }; break; + case 2: if ((FlowEnabledI2 != null) && (i >= 0) && (i < FlowEnabledI2.Length)) { FlowEnabledI2[i] = value; }; break; + case 3: if ((FlowEnabledI3 != null) && (i >= 0) && (i < FlowEnabledI3.Length)) { FlowEnabledI3[i] = value; }; break; + case 4: if ((FlowEnabledI4 != null) && (i >= 0) && (i < FlowEnabledI4.Length)) { FlowEnabledI4[i] = value; }; break; + case 5: if ((FlowEnabledI5 != null) && (i >= 0) && (i < FlowEnabledI5.Length)) { FlowEnabledI5[i] = value; }; break; + case 6: if ((FlowEnabledI6 != null) && (i >= 0) && (i < FlowEnabledI6.Length)) { FlowEnabledI6[i] = value; }; break; + case 7: if ((FlowEnabledI7 != null) && (i >= 0) && (i < FlowEnabledI7.Length)) { FlowEnabledI7[i] = value; }; break; default: break; } } - public double[] FlowFromWMs; public double[] FlowFromI1; public double[] FlowFromI2; public double[] FlowFromI3; public double[] FlowFromI4; - /// - public double GetFlowFrom(UserControls.MidId midId, int i) + public double[] FlowFromI5; + public double[] FlowFromI6; + public double[] FlowFromI7; + + /// + /// Get lower limit of the flow + /// + /// 1-based MID id + /// 0-based flow id + /// Flow in m3/h + public double GetFlowFrom(int midId, int i) { switch (midId) { - case UserControls.MidId.WaterMeters: - return ((FlowFromWMs != null) && (i >= 0) && (i < FlowFromWMs.Length)) ? FlowFromWMs[i] : 0; - case UserControls.MidId.I1: return ((FlowFromI1 != null) && (i >= 0) && (i < FlowFromI1.Length)) ? FlowFromI1[i] : 0; - case UserControls.MidId.I2: return ((FlowFromI2 != null) && (i >= 0) && (i < FlowFromI2.Length)) ? FlowFromI2[i] : 0; - case UserControls.MidId.I3: return ((FlowFromI3 != null) && (i >= 0) && (i < FlowFromI3.Length)) ? FlowFromI3[i] : 0; - case UserControls.MidId.I4: return ((FlowFromI4 != null) && (i >= 0) && (i < FlowFromI4.Length)) ? FlowFromI4[i] : 0; + case 1: return ((FlowFromI1 != null) && (i >= 0) && (i < FlowFromI1.Length)) ? FlowFromI1[i] : 0; + case 2: return ((FlowFromI2 != null) && (i >= 0) && (i < FlowFromI2.Length)) ? FlowFromI2[i] : 0; + case 3: return ((FlowFromI3 != null) && (i >= 0) && (i < FlowFromI3.Length)) ? FlowFromI3[i] : 0; + case 4: return ((FlowFromI4 != null) && (i >= 0) && (i < FlowFromI4.Length)) ? FlowFromI4[i] : 0; + case 5: return ((FlowFromI5 != null) && (i >= 0) && (i < FlowFromI5.Length)) ? FlowFromI5[i] : 0; + case 6: return ((FlowFromI6 != null) && (i >= 0) && (i < FlowFromI6.Length)) ? FlowFromI6[i] : 0; + case 7: return ((FlowFromI7 != null) && (i >= 0) && (i < FlowFromI7.Length)) ? FlowFromI7[i] : 0; default: return 0; } } - /// - public void SetFlowFrom(UserControls.MidId midId, int i, double value) + + /// + /// Set lower limit of the flow + /// + /// 1-based MID id + /// 0-based flow id + /// Flow in m3/h + public void SetFlowFrom(int midId, int i, double value) { switch (midId) { - case UserControls.MidId.WaterMeters: - if ((FlowFromWMs != null) && (i >= 0) && (i < FlowFromWMs.Length)) { FlowFromWMs[i] = value; }; - break; - case UserControls.MidId.I1: if ((FlowFromI1 != null) && (i >= 0) && (i < FlowFromI1.Length)) { FlowFromI1[i] = value; }; break; - case UserControls.MidId.I2: if ((FlowFromI2 != null) && (i >= 0) && (i < FlowFromI2.Length)) { FlowFromI2[i] = value; }; break; - case UserControls.MidId.I3: if ((FlowFromI3 != null) && (i >= 0) && (i < FlowFromI3.Length)) { FlowFromI3[i] = value; }; break; - case UserControls.MidId.I4: if ((FlowFromI4 != null) && (i >= 0) && (i < FlowFromI4.Length)) { FlowFromI4[i] = value; }; break; + case 1: if ((FlowFromI1 != null) && (i >= 0) && (i < FlowFromI1.Length)) { FlowFromI1[i] = value; }; break; + case 2: if ((FlowFromI2 != null) && (i >= 0) && (i < FlowFromI2.Length)) { FlowFromI2[i] = value; }; break; + case 3: if ((FlowFromI3 != null) && (i >= 0) && (i < FlowFromI3.Length)) { FlowFromI3[i] = value; }; break; + case 4: if ((FlowFromI4 != null) && (i >= 0) && (i < FlowFromI4.Length)) { FlowFromI4[i] = value; }; break; + case 5: if ((FlowFromI5 != null) && (i >= 0) && (i < FlowFromI5.Length)) { FlowFromI5[i] = value; }; break; + case 6: if ((FlowFromI6 != null) && (i >= 0) && (i < FlowFromI6.Length)) { FlowFromI6[i] = value; }; break; + case 7: if ((FlowFromI7 != null) && (i >= 0) && (i < FlowFromI7.Length)) { FlowFromI7[i] = value; }; break; default: break; } } - public double[] FlowToWMs; public double[] FlowToI1; public double[] FlowToI2; public double[] FlowToI3; public double[] FlowToI4; - /// - public double GetFlowTo(UserControls.MidId midId, int i) + public double[] FlowToI5; + public double[] FlowToI6; + public double[] FlowToI7; + + /// + /// Get upper limit of the flow + /// + /// 1-based MID id + /// 0-based flow id + /// Flow in m3/h + public double GetFlowTo(int midId, int i) { switch (midId) { - case UserControls.MidId.WaterMeters: - return ((FlowToWMs != null) && (i >= 0) && (i < FlowToWMs.Length)) ? FlowToWMs[i] : 0; - case UserControls.MidId.I1: return ((FlowToI1 != null) && (i >= 0) && (i < FlowToI1.Length)) ? FlowToI1[i] : 0; - case UserControls.MidId.I2: return ((FlowToI2 != null) && (i >= 0) && (i < FlowToI2.Length)) ? FlowToI2[i] : 0; - case UserControls.MidId.I3: return ((FlowToI3 != null) && (i >= 0) && (i < FlowToI3.Length)) ? FlowToI3[i] : 0; - case UserControls.MidId.I4: return ((FlowToI4 != null) && (i >= 0) && (i < FlowToI4.Length)) ? FlowToI4[i] : 0; + case 1: return ((FlowToI1 != null) && (i >= 0) && (i < FlowToI1.Length)) ? FlowToI1[i] : 0; + case 2: return ((FlowToI2 != null) && (i >= 0) && (i < FlowToI2.Length)) ? FlowToI2[i] : 0; + case 3: return ((FlowToI3 != null) && (i >= 0) && (i < FlowToI3.Length)) ? FlowToI3[i] : 0; + case 4: return ((FlowToI4 != null) && (i >= 0) && (i < FlowToI4.Length)) ? FlowToI4[i] : 0; + case 5: return ((FlowToI5 != null) && (i >= 0) && (i < FlowToI5.Length)) ? FlowToI5[i] : 0; + case 6: return ((FlowToI6 != null) && (i >= 0) && (i < FlowToI6.Length)) ? FlowToI6[i] : 0; + case 7: return ((FlowToI7 != null) && (i >= 0) && (i < FlowToI7.Length)) ? FlowToI7[i] : 0; default: return 0; } } - /// - public void SetFlowTo(UserControls.MidId midId, int i, double value) + + /// + /// Set upper limit of the flow + /// + /// 1-based MID id + /// 0-based flow id + /// Flow in m3/h + public void SetFlowTo(int midId, int i, double value) { switch (midId) { - case UserControls.MidId.WaterMeters: - if ((FlowToWMs != null) && (i >= 0) && (i < FlowToWMs.Length)) { FlowToWMs[i] = value; }; - break; - case UserControls.MidId.I1: if ((FlowToI1 != null) && (i >= 0) && (i < FlowToI1.Length)) { FlowToI1[i] = value; }; break; - case UserControls.MidId.I2: if ((FlowToI2 != null) && (i >= 0) && (i < FlowToI2.Length)) { FlowToI2[i] = value; }; break; - case UserControls.MidId.I3: if ((FlowToI3 != null) && (i >= 0) && (i < FlowToI3.Length)) { FlowToI3[i] = value; }; break; - case UserControls.MidId.I4: if ((FlowToI4 != null) && (i >= 0) && (i < FlowToI4.Length)) { FlowToI4[i] = value; }; break; + case 1: if ((FlowToI1 != null) && (i >= 0) && (i < FlowToI1.Length)) { FlowToI1[i] = value; }; break; + case 2: if ((FlowToI2 != null) && (i >= 0) && (i < FlowToI2.Length)) { FlowToI2[i] = value; }; break; + case 3: if ((FlowToI3 != null) && (i >= 0) && (i < FlowToI3.Length)) { FlowToI3[i] = value; }; break; + case 4: if ((FlowToI4 != null) && (i >= 0) && (i < FlowToI4.Length)) { FlowToI4[i] = value; }; break; + case 5: if ((FlowToI5 != null) && (i >= 0) && (i < FlowToI5.Length)) { FlowToI5[i] = value; }; break; + case 6: if ((FlowToI6 != null) && (i >= 0) && (i < FlowToI6.Length)) { FlowToI6[i] = value; }; break; + case 7: if ((FlowToI7 != null) && (i >= 0) && (i < FlowToI7.Length)) { FlowToI7[i] = value; }; break; default: break; } @@ -180,6 +230,18 @@ namespace Statistics /// public LocalSettings() { +#if GENESIS + Language = "DE"; + + BenchNames = new string[] { "Genesis" }; + + ConnectionStrings = new string[] + { + "SERVER=localhost; DATABASE=genesis-r; UID=root; PASSWORD=; CHARSET=utf8;", + }; + + MidNames = new string[] { string.Empty, "I11", "I12", "I2", "I3", "I4", "I5" }; /// Index is MID-id +#else Language = "SK"; BenchNames = new string[] { "WR10", "WR11", "WR13", "WR14", "WR15", "PT7" }; @@ -194,23 +256,31 @@ namespace Statistics "SERVER=10.42.129.26; DATABASE=iperlspecial-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;", }; - FlowEnabledWMs = new bool[FlowsCount]; + MidNames = new string[] { string.Empty, "I1", "I2", "I3", "I4" }; /// Index is MID-id +#endif FlowEnabledI1 = new bool[FlowsCount]; FlowEnabledI2 = new bool[FlowsCount]; FlowEnabledI3 = new bool[FlowsCount]; FlowEnabledI4 = new bool[FlowsCount]; + FlowEnabledI5 = new bool[FlowsCount]; + FlowEnabledI6 = new bool[FlowsCount]; + FlowEnabledI7 = new bool[FlowsCount]; - FlowFromWMs = new double[FlowsCount]; FlowFromI1 = new double[FlowsCount]; FlowFromI2 = new double[FlowsCount]; FlowFromI3 = new double[FlowsCount]; FlowFromI4 = new double[FlowsCount]; + FlowFromI5 = new double[FlowsCount]; + FlowFromI6 = new double[FlowsCount]; + FlowFromI7 = new double[FlowsCount]; - FlowToWMs = new double[FlowsCount]; FlowToI1 = new double[FlowsCount]; FlowToI2 = new double[FlowsCount]; FlowToI3 = new double[FlowsCount]; FlowToI4 = new double[FlowsCount]; + FlowToI5 = new double[FlowsCount]; + FlowToI6 = new double[FlowsCount]; + FlowToI7 = new double[FlowsCount]; SelectedRadioButtonNumber = 1; } diff --git a/Statistics/Properties/AssemblyInfo.cs b/Statistics/Properties/AssemblyInfo.cs index 1ffd7db3e..fc68d9206 100644 --- a/Statistics/Properties/AssemblyInfo.cs +++ b/Statistics/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.18.1108.0")] -[assembly: AssemblyFileVersion("2.18.1108.0")] +[assembly: AssemblyVersion("2.18.1154.0")] +[assembly: AssemblyFileVersion("2.18.1154.0")] diff --git a/Statistics/Statistics.csproj b/Statistics/Statistics.csproj index 6ae3eb7ef..18e34a551 100644 --- a/Statistics/Statistics.csproj +++ b/Statistics/Statistics.csproj @@ -80,7 +80,6 @@ - UserControl diff --git a/Statistics/StatisticsDlg.Designer.cs b/Statistics/StatisticsDlg.Designer.cs index 6473356ad..12fede154 100644 --- a/Statistics/StatisticsDlg.Designer.cs +++ b/Statistics/StatisticsDlg.Designer.cs @@ -39,27 +39,11 @@ this.dateTimeFromPicker = new System.Windows.Forms.DateTimePicker(); this.dateTimeToPicker = new System.Windows.Forms.DateTimePicker(); this.midsTabControl = new System.Windows.Forms.TabControl(); - this.wr10TabPage = new System.Windows.Forms.TabPage(); - this.wmsBenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl(); - this.wr11TabPage = new System.Windows.Forms.TabPage(); - this.i1BenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl(); - this.wr13TabPage = new System.Windows.Forms.TabPage(); - this.i2BbenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl(); - this.wr14TabPage = new System.Windows.Forms.TabPage(); - this.i3BenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl(); - this.wr15TabPage = new System.Windows.Forms.TabPage(); - this.i4BenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); this.timePeriodGroupBox.SuspendLayout(); - this.midsTabControl.SuspendLayout(); - this.wr10TabPage.SuspendLayout(); - this.wr11TabPage.SuspendLayout(); - this.wr13TabPage.SuspendLayout(); - this.wr14TabPage.SuspendLayout(); - this.wr15TabPage.SuspendLayout(); this.SuspendLayout(); // // splitContainer1 @@ -177,11 +161,6 @@ // // midsTabControl // - this.midsTabControl.Controls.Add(this.wr10TabPage); - this.midsTabControl.Controls.Add(this.wr11TabPage); - this.midsTabControl.Controls.Add(this.wr13TabPage); - this.midsTabControl.Controls.Add(this.wr14TabPage); - this.midsTabControl.Controls.Add(this.wr15TabPage); this.midsTabControl.Dock = System.Windows.Forms.DockStyle.Fill; this.midsTabControl.Location = new System.Drawing.Point(0, 0); this.midsTabControl.Name = "midsTabControl"; @@ -189,101 +168,6 @@ this.midsTabControl.Size = new System.Drawing.Size(1368, 732); this.midsTabControl.TabIndex = 0; // - // wr10TabPage - // - this.wr10TabPage.Controls.Add(this.wmsBenchesControl); - this.wr10TabPage.Location = new System.Drawing.Point(4, 22); - this.wr10TabPage.Name = "wr10TabPage"; - this.wr10TabPage.Padding = new System.Windows.Forms.Padding(3); - this.wr10TabPage.Size = new System.Drawing.Size(1360, 706); - this.wr10TabPage.TabIndex = 0; - this.wr10TabPage.Text = "Water meters"; - this.wr10TabPage.UseVisualStyleBackColor = true; - // - // wmsBenchesControl - // - this.wmsBenchesControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.wmsBenchesControl.Location = new System.Drawing.Point(3, 3); - this.wmsBenchesControl.Name = "wmsBenchesControl"; - this.wmsBenchesControl.Size = new System.Drawing.Size(1354, 700); - this.wmsBenchesControl.TabIndex = 0; - // - // wr11TabPage - // - this.wr11TabPage.Controls.Add(this.i1BenchesControl); - this.wr11TabPage.Location = new System.Drawing.Point(4, 22); - this.wr11TabPage.Name = "wr11TabPage"; - this.wr11TabPage.Padding = new System.Windows.Forms.Padding(3); - this.wr11TabPage.Size = new System.Drawing.Size(1360, 706); - this.wr11TabPage.TabIndex = 1; - this.wr11TabPage.Text = "I1"; - this.wr11TabPage.UseVisualStyleBackColor = true; - // - // i1BenchesControl - // - this.i1BenchesControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.i1BenchesControl.Location = new System.Drawing.Point(3, 3); - this.i1BenchesControl.Name = "i1BenchesControl"; - this.i1BenchesControl.Size = new System.Drawing.Size(1354, 700); - this.i1BenchesControl.TabIndex = 0; - // - // wr13TabPage - // - this.wr13TabPage.Controls.Add(this.i2BbenchesControl); - this.wr13TabPage.Location = new System.Drawing.Point(4, 22); - this.wr13TabPage.Name = "wr13TabPage"; - this.wr13TabPage.Padding = new System.Windows.Forms.Padding(3); - this.wr13TabPage.Size = new System.Drawing.Size(1360, 706); - this.wr13TabPage.TabIndex = 2; - this.wr13TabPage.Text = "I2"; - this.wr13TabPage.UseVisualStyleBackColor = true; - // - // i2BbenchesControl - // - this.i2BbenchesControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.i2BbenchesControl.Location = new System.Drawing.Point(3, 3); - this.i2BbenchesControl.Name = "i2BbenchesControl"; - this.i2BbenchesControl.Size = new System.Drawing.Size(1354, 700); - this.i2BbenchesControl.TabIndex = 0; - // - // wr14TabPage - // - this.wr14TabPage.Controls.Add(this.i3BenchesControl); - this.wr14TabPage.Location = new System.Drawing.Point(4, 22); - this.wr14TabPage.Name = "wr14TabPage"; - this.wr14TabPage.Padding = new System.Windows.Forms.Padding(3); - this.wr14TabPage.Size = new System.Drawing.Size(1360, 706); - this.wr14TabPage.TabIndex = 3; - this.wr14TabPage.Text = "I3"; - this.wr14TabPage.UseVisualStyleBackColor = true; - // - // i3BenchesControl - // - this.i3BenchesControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.i3BenchesControl.Location = new System.Drawing.Point(3, 3); - this.i3BenchesControl.Name = "i3BenchesControl"; - this.i3BenchesControl.Size = new System.Drawing.Size(1354, 700); - this.i3BenchesControl.TabIndex = 0; - // - // wr15TabPage - // - this.wr15TabPage.Controls.Add(this.i4BenchesControl); - this.wr15TabPage.Location = new System.Drawing.Point(4, 22); - this.wr15TabPage.Name = "wr15TabPage"; - this.wr15TabPage.Padding = new System.Windows.Forms.Padding(3); - this.wr15TabPage.Size = new System.Drawing.Size(1360, 706); - this.wr15TabPage.TabIndex = 4; - this.wr15TabPage.Text = "I4"; - this.wr15TabPage.UseVisualStyleBackColor = true; - // - // i4BenchesControl - // - this.i4BenchesControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.i4BenchesControl.Location = new System.Drawing.Point(3, 3); - this.i4BenchesControl.Name = "i4BenchesControl"; - this.i4BenchesControl.Size = new System.Drawing.Size(1354, 700); - this.i4BenchesControl.TabIndex = 0; - // // StatisticsDlg // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -291,7 +175,7 @@ this.ClientSize = new System.Drawing.Size(1368, 826); this.Controls.Add(this.splitContainer1); this.Name = "StatisticsDlg"; - this.Text = "Statistics"; + this.Text = "MID Statistics"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.StatisticsDlg_FormClosing); this.Load += new System.EventHandler(this.StatisticsDlg_Load); this.splitContainer1.Panel1.ResumeLayout(false); @@ -301,12 +185,6 @@ this.splitContainer1.ResumeLayout(false); this.timePeriodGroupBox.ResumeLayout(false); this.timePeriodGroupBox.PerformLayout(); - this.midsTabControl.ResumeLayout(false); - this.wr10TabPage.ResumeLayout(false); - this.wr11TabPage.ResumeLayout(false); - this.wr13TabPage.ResumeLayout(false); - this.wr14TabPage.ResumeLayout(false); - this.wr15TabPage.ResumeLayout(false); this.ResumeLayout(false); } @@ -314,26 +192,16 @@ #endregion private System.Windows.Forms.SplitContainer splitContainer1; - private System.Windows.Forms.TabControl midsTabControl; - private System.Windows.Forms.TabPage wr10TabPage; - private System.Windows.Forms.TabPage wr11TabPage; - private System.Windows.Forms.TabPage wr13TabPage; - private System.Windows.Forms.TabPage wr14TabPage; - private System.Windows.Forms.TabPage wr15TabPage; private System.Windows.Forms.GroupBox timePeriodGroupBox; private System.Windows.Forms.DateTimePicker dateTimeFromPicker; private System.Windows.Forms.DateTimePicker dateTimeToPicker; private System.Windows.Forms.Label toLabel1; private System.Windows.Forms.Label fromLabel1; - private UserControls.MidOrWaterMetersCtrl wmsBenchesControl; - private UserControls.MidOrWaterMetersCtrl i1BenchesControl; - private UserControls.MidOrWaterMetersCtrl i2BbenchesControl; - private UserControls.MidOrWaterMetersCtrl i3BenchesControl; - private UserControls.MidOrWaterMetersCtrl i4BenchesControl; private System.Windows.Forms.RadioButton radioButton3; private System.Windows.Forms.RadioButton radioButton2; private System.Windows.Forms.RadioButton radioButton1; private System.Windows.Forms.RadioButton radioButton4; + private System.Windows.Forms.TabControl midsTabControl; } } diff --git a/Statistics/StatisticsDlg.cs b/Statistics/StatisticsDlg.cs index 6bd47530b..4d89f5a41 100644 --- a/Statistics/StatisticsDlg.cs +++ b/Statistics/StatisticsDlg.cs @@ -24,7 +24,7 @@ namespace Statistics { public partial class StatisticsDlg : Form { - static ISessionFactory[] sessionFactories = new ISessionFactory[LocalSettings.BenchesCount]; + static ISessionFactory[] sessionFactories = new ISessionFactory[Program.LocalSettings.ConnectionStrings.Length]; public StatisticsDlg() @@ -33,14 +33,19 @@ namespace Statistics ///ManageCheckGroupBox(timePeriodCheckBox, timePeriodGroupBox); - for (MidId midId = 0; midId < MidId.Count; midId++) + for (int midId = 1; midId < Program.LocalSettings.MidNames.Length; midId++) { - int i = (int)midId; - midsTabControl.TabPages[i].Text = midId.ToString(); - (midsTabControl.TabPages[i].Controls[0] as MidOrWaterMetersCtrl).MidId = midId; - (midsTabControl.TabPages[i].Controls[0] as MidOrWaterMetersCtrl).Parent = this; + TabPage tp = new TabPage(); + tp.Text = Program.LocalSettings.MidNames[midId]; + + MidOrWaterMetersCtrl ctrl = new MidOrWaterMetersCtrl(); + ctrl.MidId = midId; + ctrl.Parent = this; + ctrl.Dock = DockStyle.Fill; + + tp.Controls.Add(ctrl); + midsTabControl.TabPages.Add(tp); } - midsTabControl.TabPages[0].Text = Strings.Water_meters; radioButton1.Checked = true; timePeriodGroupBox.Enabled = false; @@ -50,7 +55,7 @@ namespace Statistics void Localize() { - Text = Strings.Statistics; + Text = string.Format("MID {0}", Strings.Statistics); //timePeriodCheckBox.Text = Strings.Time_period; fromLabel1.Text = Strings.From; toLabel1.Text = Strings.To; @@ -76,12 +81,12 @@ namespace Statistics case 4: radioButton4.Checked = true; break; } - for (int i = 0; i < (int)MidId.Count; i++) + for (int i = 1; i < Program.LocalSettings.MidNames.Length; i++) { - (midsTabControl.TabPages[i].Controls[0] as MidOrWaterMetersCtrl).Data2UI(); + (midsTabControl.TabPages[i - 1].Controls[0] as MidOrWaterMetersCtrl).Data2UI(); } - for (int i = 0; i < LocalSettings.BenchesCount; i++) + for (int i = 0; i < Program.LocalSettings.ConnectionStrings.Length; i++) { if (!string.IsNullOrEmpty(Program.LocalSettings.GetConnectionString(i))) { @@ -128,18 +133,18 @@ namespace Statistics //} - public IList UpdateRequest(int benchId, MidId midId) + /// + /// Called by a child form. + /// Reads and returns results from DB required by the child form to update it's content. + /// + /// 0-based bench Id. + /// 1-based MID Id. + /// Required test results + public IList UpdateRequest(int benchId, int midId) { - if ((benchId < 0) || (benchId >= LocalSettings.BenchesCount) || (sessionFactories[benchId] == null) || (midId == MidId.WaterMeters)) + if ((benchId < 0) || (benchId >= Program.LocalSettings.BenchNames.Length) || (sessionFactories[benchId] == null)) { - if (midId == MidId.WaterMeters) - { - MessageBox.Show("Loading statistics of water meters is not implemented yet"); - } - else - { - MessageBox.Show(string.Format("Cannot load statistics of {0}", Program.LocalSettings.GetBenchName(benchId))); - } + MessageBox.Show(string.Format("Cannot load statistics of {0}", Program.LocalSettings.GetBenchName(benchId))); return null; } @@ -164,7 +169,7 @@ namespace Statistics { ISession session = sessionFactories[benchId].OpenSession(); var listOfComponentsWithFlowmeter = session.QueryOver() - .Where(x => (x.Flowmeter == midId.ToString())) + .Where(x => (x.Flowmeter == Program.LocalSettings.MidNames[midId])) .List(); IList testRslts = new List(); foreach (var cmpnts in listOfComponentsWithFlowmeter) @@ -248,9 +253,12 @@ namespace Statistics else if (radioButton4.Checked) ls.SelectedRadioButtonNumber = 4; else ls.SelectedRadioButtonNumber = 0; - for (int i = 0; i < (int)MidId.Count; i++) + for (int i = 1; i < Math.Min(Program.LocalSettings.MidNames.Length, midsTabControl.TabPages.Count + 1); i++) { - (midsTabControl.TabPages[i].Controls[0] as MidOrWaterMetersCtrl).UI2Data(); + if (midsTabControl.TabPages[i - 1].Controls.Count > 0 && midsTabControl.TabPages[i - 1].Controls[0] is MidOrWaterMetersCtrl) + { + (midsTabControl.TabPages[i - 1].Controls[0] as MidOrWaterMetersCtrl).UI2Data(); + } } ls.Save(); diff --git a/Statistics/UserControls/Enums.cs b/Statistics/UserControls/Enums.cs deleted file mode 100644 index d9bb5cd37..000000000 --- a/Statistics/UserControls/Enums.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Statistics.UserControls -{ - public enum MidId - { - /// When converted to 'int' it's the MID number, 0 = water meters - WaterMeters, - I1, - I2, - I3, - I4, - Count - } -} diff --git a/Statistics/UserControls/MidOrWaterMetersCtrl.Designer.cs b/Statistics/UserControls/MidOrWaterMetersCtrl.Designer.cs index c2fc713ef..fc3c9939e 100644 --- a/Statistics/UserControls/MidOrWaterMetersCtrl.Designer.cs +++ b/Statistics/UserControls/MidOrWaterMetersCtrl.Designer.cs @@ -29,6 +29,26 @@ private void InitializeComponent() { this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.flow5GroupBox = new System.Windows.Forms.GroupBox(); + this.flow5ToExclamation = new System.Windows.Forms.Label(); + this.flow5FromExclamation = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.toLabel6 = new System.Windows.Forms.Label(); + this.fromLabel6 = new System.Windows.Forms.Label(); + this.flow5ToTextBox = new System.Windows.Forms.TextBox(); + this.flow5FromTextBox = new System.Windows.Forms.TextBox(); + this.flow5CheckBox = new System.Windows.Forms.CheckBox(); + this.flow4GroupBox = new System.Windows.Forms.GroupBox(); + this.flow4ToExclamation = new System.Windows.Forms.Label(); + this.flow4FromExclamation = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.toLabel5 = new System.Windows.Forms.Label(); + this.fromLabel5 = new System.Windows.Forms.Label(); + this.flow4ToTextBox = new System.Windows.Forms.TextBox(); + this.flow4FromTextBox = new System.Windows.Forms.TextBox(); + this.flow4CheckBox = new System.Windows.Forms.CheckBox(); this.flow3GroupBox = new System.Windows.Forms.GroupBox(); this.flow3ToExclamation = new System.Windows.Forms.Label(); this.flow3FromExclamation = new System.Windows.Forms.Label(); @@ -60,54 +80,15 @@ this.flow1FromTextBox = new System.Windows.Forms.TextBox(); this.flow1CheckBox = new System.Windows.Forms.CheckBox(); this.benchesTabControl = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.tabPage3 = new System.Windows.Forms.TabPage(); - this.tabPage4 = new System.Windows.Forms.TabPage(); - this.tabPage5 = new System.Windows.Forms.TabPage(); - this.tabPage6 = new System.Windows.Forms.TabPage(); - this.flow4GroupBox = new System.Windows.Forms.GroupBox(); - this.flow4ToExclamation = new System.Windows.Forms.Label(); - this.flow4FromExclamation = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.toLabel5 = new System.Windows.Forms.Label(); - this.fromLabel5 = new System.Windows.Forms.Label(); - this.flow4ToTextBox = new System.Windows.Forms.TextBox(); - this.flow4FromTextBox = new System.Windows.Forms.TextBox(); - this.flow4CheckBox = new System.Windows.Forms.CheckBox(); - this.flow5GroupBox = new System.Windows.Forms.GroupBox(); - this.flow5ToExclamation = new System.Windows.Forms.Label(); - this.flow5FromExclamation = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.label10 = new System.Windows.Forms.Label(); - this.toLabel6 = new System.Windows.Forms.Label(); - this.fromLabel6 = new System.Windows.Forms.Label(); - this.flow5ToTextBox = new System.Windows.Forms.TextBox(); - this.flow5FromTextBox = new System.Windows.Forms.TextBox(); - this.flow5CheckBox = new System.Windows.Forms.CheckBox(); - this.wr10StatisticsCtrl1 = new Statistics.UserControls.StatisticsCtrl(); - this.wr11StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl(); - this.wr13StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl(); - this.wr14StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl(); - this.wr15StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl(); - this.pt7StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); + this.flow5GroupBox.SuspendLayout(); + this.flow4GroupBox.SuspendLayout(); this.flow3GroupBox.SuspendLayout(); this.flow2GroupBox.SuspendLayout(); this.flow1GroupBox.SuspendLayout(); - this.benchesTabControl.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.tabPage2.SuspendLayout(); - this.tabPage3.SuspendLayout(); - this.tabPage4.SuspendLayout(); - this.tabPage5.SuspendLayout(); - this.tabPage6.SuspendLayout(); - this.flow4GroupBox.SuspendLayout(); - this.flow5GroupBox.SuspendLayout(); this.SuspendLayout(); // // splitContainer1 @@ -134,6 +115,210 @@ this.splitContainer1.SplitterDistance = 90; this.splitContainer1.TabIndex = 0; // + // flow5GroupBox + // + this.flow5GroupBox.Controls.Add(this.flow5ToExclamation); + this.flow5GroupBox.Controls.Add(this.flow5FromExclamation); + this.flow5GroupBox.Controls.Add(this.label9); + this.flow5GroupBox.Controls.Add(this.label10); + this.flow5GroupBox.Controls.Add(this.toLabel6); + this.flow5GroupBox.Controls.Add(this.fromLabel6); + this.flow5GroupBox.Controls.Add(this.flow5ToTextBox); + this.flow5GroupBox.Controls.Add(this.flow5FromTextBox); + this.flow5GroupBox.Controls.Add(this.flow5CheckBox); + this.flow5GroupBox.Location = new System.Drawing.Point(939, 7); + this.flow5GroupBox.Name = "flow5GroupBox"; + this.flow5GroupBox.Size = new System.Drawing.Size(221, 77); + this.flow5GroupBox.TabIndex = 8; + this.flow5GroupBox.TabStop = false; + // + // flow5ToExclamation + // + this.flow5ToExclamation.AutoSize = true; + this.flow5ToExclamation.ForeColor = System.Drawing.Color.Red; + this.flow5ToExclamation.Location = new System.Drawing.Point(167, 48); + this.flow5ToExclamation.Name = "flow5ToExclamation"; + this.flow5ToExclamation.Size = new System.Drawing.Size(10, 13); + this.flow5ToExclamation.TabIndex = 9; + this.flow5ToExclamation.Text = "!"; + this.flow5ToExclamation.Visible = false; + // + // flow5FromExclamation + // + this.flow5FromExclamation.AutoSize = true; + this.flow5FromExclamation.ForeColor = System.Drawing.Color.Red; + this.flow5FromExclamation.Location = new System.Drawing.Point(167, 24); + this.flow5FromExclamation.Name = "flow5FromExclamation"; + this.flow5FromExclamation.Size = new System.Drawing.Size(10, 13); + this.flow5FromExclamation.TabIndex = 8; + this.flow5FromExclamation.Text = "!"; + this.flow5FromExclamation.Visible = false; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(178, 48); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(32, 13); + this.label9.TabIndex = 6; + this.label9.Text = "m3/h"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(177, 23); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(32, 13); + this.label10.TabIndex = 5; + this.label10.Text = "m3/h"; + // + // toLabel6 + // + this.toLabel6.AutoSize = true; + this.toLabel6.Location = new System.Drawing.Point(14, 48); + this.toLabel6.Name = "toLabel6"; + this.toLabel6.Size = new System.Drawing.Size(20, 13); + this.toLabel6.TabIndex = 4; + this.toLabel6.Text = "To"; + // + // fromLabel6 + // + this.fromLabel6.AutoSize = true; + this.fromLabel6.Location = new System.Drawing.Point(14, 23); + this.fromLabel6.Name = "fromLabel6"; + this.fromLabel6.Size = new System.Drawing.Size(30, 13); + this.fromLabel6.TabIndex = 3; + this.fromLabel6.Text = "From"; + // + // flow5ToTextBox + // + this.flow5ToTextBox.Location = new System.Drawing.Point(65, 45); + this.flow5ToTextBox.Name = "flow5ToTextBox"; + this.flow5ToTextBox.Size = new System.Drawing.Size(100, 20); + this.flow5ToTextBox.TabIndex = 2; + this.flow5ToTextBox.TextChanged += new System.EventHandler(this.flow5ToTextBox_TextChanged); + // + // flow5FromTextBox + // + this.flow5FromTextBox.Location = new System.Drawing.Point(65, 20); + this.flow5FromTextBox.Name = "flow5FromTextBox"; + this.flow5FromTextBox.Size = new System.Drawing.Size(100, 20); + this.flow5FromTextBox.TabIndex = 1; + this.flow5FromTextBox.TextChanged += new System.EventHandler(this.flow5FromTextBox_TextChanged); + // + // flow5CheckBox + // + this.flow5CheckBox.AutoSize = true; + this.flow5CheckBox.Location = new System.Drawing.Point(10, 0); + this.flow5CheckBox.Name = "flow5CheckBox"; + this.flow5CheckBox.Size = new System.Drawing.Size(57, 17); + this.flow5CheckBox.TabIndex = 0; + this.flow5CheckBox.Text = "Flow 5"; + this.flow5CheckBox.UseVisualStyleBackColor = true; + this.flow5CheckBox.CheckedChanged += new System.EventHandler(this.flow5CheckBox_CheckedChanged); + // + // flow4GroupBox + // + this.flow4GroupBox.Controls.Add(this.flow4ToExclamation); + this.flow4GroupBox.Controls.Add(this.flow4FromExclamation); + this.flow4GroupBox.Controls.Add(this.label7); + this.flow4GroupBox.Controls.Add(this.label8); + this.flow4GroupBox.Controls.Add(this.toLabel5); + this.flow4GroupBox.Controls.Add(this.fromLabel5); + this.flow4GroupBox.Controls.Add(this.flow4ToTextBox); + this.flow4GroupBox.Controls.Add(this.flow4FromTextBox); + this.flow4GroupBox.Controls.Add(this.flow4CheckBox); + this.flow4GroupBox.Location = new System.Drawing.Point(706, 7); + this.flow4GroupBox.Name = "flow4GroupBox"; + this.flow4GroupBox.Size = new System.Drawing.Size(221, 77); + this.flow4GroupBox.TabIndex = 7; + this.flow4GroupBox.TabStop = false; + // + // flow4ToExclamation + // + this.flow4ToExclamation.AutoSize = true; + this.flow4ToExclamation.ForeColor = System.Drawing.Color.Red; + this.flow4ToExclamation.Location = new System.Drawing.Point(167, 48); + this.flow4ToExclamation.Name = "flow4ToExclamation"; + this.flow4ToExclamation.Size = new System.Drawing.Size(10, 13); + this.flow4ToExclamation.TabIndex = 9; + this.flow4ToExclamation.Text = "!"; + this.flow4ToExclamation.Visible = false; + // + // flow4FromExclamation + // + this.flow4FromExclamation.AutoSize = true; + this.flow4FromExclamation.ForeColor = System.Drawing.Color.Red; + this.flow4FromExclamation.Location = new System.Drawing.Point(167, 24); + this.flow4FromExclamation.Name = "flow4FromExclamation"; + this.flow4FromExclamation.Size = new System.Drawing.Size(10, 13); + this.flow4FromExclamation.TabIndex = 8; + this.flow4FromExclamation.Text = "!"; + this.flow4FromExclamation.Visible = false; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(178, 48); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(32, 13); + this.label7.TabIndex = 6; + this.label7.Text = "m3/h"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(177, 23); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(32, 13); + this.label8.TabIndex = 5; + this.label8.Text = "m3/h"; + // + // toLabel5 + // + this.toLabel5.AutoSize = true; + this.toLabel5.Location = new System.Drawing.Point(14, 48); + this.toLabel5.Name = "toLabel5"; + this.toLabel5.Size = new System.Drawing.Size(20, 13); + this.toLabel5.TabIndex = 4; + this.toLabel5.Text = "To"; + // + // fromLabel5 + // + this.fromLabel5.AutoSize = true; + this.fromLabel5.Location = new System.Drawing.Point(14, 23); + this.fromLabel5.Name = "fromLabel5"; + this.fromLabel5.Size = new System.Drawing.Size(30, 13); + this.fromLabel5.TabIndex = 3; + this.fromLabel5.Text = "From"; + // + // flow4ToTextBox + // + this.flow4ToTextBox.Location = new System.Drawing.Point(65, 45); + this.flow4ToTextBox.Name = "flow4ToTextBox"; + this.flow4ToTextBox.Size = new System.Drawing.Size(100, 20); + this.flow4ToTextBox.TabIndex = 2; + this.flow4ToTextBox.TextChanged += new System.EventHandler(this.flow4ToTextBox_TextChanged); + // + // flow4FromTextBox + // + this.flow4FromTextBox.Location = new System.Drawing.Point(65, 20); + this.flow4FromTextBox.Name = "flow4FromTextBox"; + this.flow4FromTextBox.Size = new System.Drawing.Size(100, 20); + this.flow4FromTextBox.TabIndex = 1; + this.flow4FromTextBox.TextChanged += new System.EventHandler(this.flow4FromTextBox_TextChanged); + // + // flow4CheckBox + // + this.flow4CheckBox.AutoSize = true; + this.flow4CheckBox.Location = new System.Drawing.Point(10, 0); + this.flow4CheckBox.Name = "flow4CheckBox"; + this.flow4CheckBox.Size = new System.Drawing.Size(57, 17); + this.flow4CheckBox.TabIndex = 0; + this.flow4CheckBox.Text = "Flow 4"; + this.flow4CheckBox.UseVisualStyleBackColor = true; + this.flow4CheckBox.CheckedChanged += new System.EventHandler(this.flow4CheckBox_CheckedChanged); + // // flow3GroupBox // this.flow3GroupBox.Controls.Add(this.flow3ToExclamation); @@ -442,12 +627,6 @@ // // benchesTabControl // - this.benchesTabControl.Controls.Add(this.tabPage1); - this.benchesTabControl.Controls.Add(this.tabPage2); - this.benchesTabControl.Controls.Add(this.tabPage3); - this.benchesTabControl.Controls.Add(this.tabPage4); - this.benchesTabControl.Controls.Add(this.tabPage5); - this.benchesTabControl.Controls.Add(this.tabPage6); this.benchesTabControl.Dock = System.Windows.Forms.DockStyle.Fill; this.benchesTabControl.Location = new System.Drawing.Point(0, 0); this.benchesTabControl.Name = "benchesTabControl"; @@ -455,320 +634,6 @@ this.benchesTabControl.Size = new System.Drawing.Size(1202, 356); this.benchesTabControl.TabIndex = 0; // - // tabPage1 - // - this.tabPage1.Controls.Add(this.wr10StatisticsCtrl1); - this.tabPage1.Location = new System.Drawing.Point(4, 22); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(1194, 330); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "WR10"; - this.tabPage1.UseVisualStyleBackColor = true; - // - // tabPage2 - // - this.tabPage2.Controls.Add(this.wr11StatisticsCtrl); - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(1194, 330); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "WR11"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // tabPage3 - // - this.tabPage3.Controls.Add(this.wr13StatisticsCtrl); - this.tabPage3.Location = new System.Drawing.Point(4, 22); - this.tabPage3.Name = "tabPage3"; - this.tabPage3.Size = new System.Drawing.Size(1194, 330); - this.tabPage3.TabIndex = 2; - this.tabPage3.Text = "WR13"; - this.tabPage3.UseVisualStyleBackColor = true; - // - // tabPage4 - // - this.tabPage4.Controls.Add(this.wr14StatisticsCtrl); - this.tabPage4.Location = new System.Drawing.Point(4, 22); - this.tabPage4.Name = "tabPage4"; - this.tabPage4.Size = new System.Drawing.Size(1194, 330); - this.tabPage4.TabIndex = 3; - this.tabPage4.Text = "WR14"; - this.tabPage4.UseVisualStyleBackColor = true; - // - // tabPage5 - // - this.tabPage5.Controls.Add(this.wr15StatisticsCtrl); - this.tabPage5.Location = new System.Drawing.Point(4, 22); - this.tabPage5.Name = "tabPage5"; - this.tabPage5.Size = new System.Drawing.Size(1194, 330); - this.tabPage5.TabIndex = 4; - this.tabPage5.Text = "WR15"; - this.tabPage5.UseVisualStyleBackColor = true; - // - // tabPage6 - // - this.tabPage6.Controls.Add(this.pt7StatisticsCtrl); - this.tabPage6.Location = new System.Drawing.Point(4, 22); - this.tabPage6.Name = "tabPage6"; - this.tabPage6.Size = new System.Drawing.Size(1194, 330); - this.tabPage6.TabIndex = 5; - this.tabPage6.Text = "PT7"; - this.tabPage6.UseVisualStyleBackColor = true; - // - // flow4GroupBox - // - this.flow4GroupBox.Controls.Add(this.flow4ToExclamation); - this.flow4GroupBox.Controls.Add(this.flow4FromExclamation); - this.flow4GroupBox.Controls.Add(this.label7); - this.flow4GroupBox.Controls.Add(this.label8); - this.flow4GroupBox.Controls.Add(this.toLabel5); - this.flow4GroupBox.Controls.Add(this.fromLabel5); - this.flow4GroupBox.Controls.Add(this.flow4ToTextBox); - this.flow4GroupBox.Controls.Add(this.flow4FromTextBox); - this.flow4GroupBox.Controls.Add(this.flow4CheckBox); - this.flow4GroupBox.Location = new System.Drawing.Point(706, 7); - this.flow4GroupBox.Name = "flow4GroupBox"; - this.flow4GroupBox.Size = new System.Drawing.Size(221, 77); - this.flow4GroupBox.TabIndex = 7; - this.flow4GroupBox.TabStop = false; - // - // flow4ToExclamation - // - this.flow4ToExclamation.AutoSize = true; - this.flow4ToExclamation.ForeColor = System.Drawing.Color.Red; - this.flow4ToExclamation.Location = new System.Drawing.Point(167, 48); - this.flow4ToExclamation.Name = "flow4ToExclamation"; - this.flow4ToExclamation.Size = new System.Drawing.Size(10, 13); - this.flow4ToExclamation.TabIndex = 9; - this.flow4ToExclamation.Text = "!"; - this.flow4ToExclamation.Visible = false; - // - // flow4FromExclamation - // - this.flow4FromExclamation.AutoSize = true; - this.flow4FromExclamation.ForeColor = System.Drawing.Color.Red; - this.flow4FromExclamation.Location = new System.Drawing.Point(167, 24); - this.flow4FromExclamation.Name = "flow4FromExclamation"; - this.flow4FromExclamation.Size = new System.Drawing.Size(10, 13); - this.flow4FromExclamation.TabIndex = 8; - this.flow4FromExclamation.Text = "!"; - this.flow4FromExclamation.Visible = false; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(178, 48); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(32, 13); - this.label7.TabIndex = 6; - this.label7.Text = "m3/h"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(177, 23); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(32, 13); - this.label8.TabIndex = 5; - this.label8.Text = "m3/h"; - // - // toLabel5 - // - this.toLabel5.AutoSize = true; - this.toLabel5.Location = new System.Drawing.Point(14, 48); - this.toLabel5.Name = "toLabel5"; - this.toLabel5.Size = new System.Drawing.Size(20, 13); - this.toLabel5.TabIndex = 4; - this.toLabel5.Text = "To"; - // - // fromLabel5 - // - this.fromLabel5.AutoSize = true; - this.fromLabel5.Location = new System.Drawing.Point(14, 23); - this.fromLabel5.Name = "fromLabel5"; - this.fromLabel5.Size = new System.Drawing.Size(30, 13); - this.fromLabel5.TabIndex = 3; - this.fromLabel5.Text = "From"; - // - // flow4ToTextBox - // - this.flow4ToTextBox.Location = new System.Drawing.Point(65, 45); - this.flow4ToTextBox.Name = "flow4ToTextBox"; - this.flow4ToTextBox.Size = new System.Drawing.Size(100, 20); - this.flow4ToTextBox.TabIndex = 2; - this.flow4ToTextBox.TextChanged += new System.EventHandler(this.flow4ToTextBox_TextChanged); - // - // flow4FromTextBox - // - this.flow4FromTextBox.Location = new System.Drawing.Point(65, 20); - this.flow4FromTextBox.Name = "flow4FromTextBox"; - this.flow4FromTextBox.Size = new System.Drawing.Size(100, 20); - this.flow4FromTextBox.TabIndex = 1; - this.flow4FromTextBox.TextChanged += new System.EventHandler(this.flow4FromTextBox_TextChanged); - // - // flow4CheckBox - // - this.flow4CheckBox.AutoSize = true; - this.flow4CheckBox.Location = new System.Drawing.Point(10, 0); - this.flow4CheckBox.Name = "flow4CheckBox"; - this.flow4CheckBox.Size = new System.Drawing.Size(57, 17); - this.flow4CheckBox.TabIndex = 0; - this.flow4CheckBox.Text = "Flow 4"; - this.flow4CheckBox.UseVisualStyleBackColor = true; - this.flow4CheckBox.CheckedChanged += new System.EventHandler(this.flow4CheckBox_CheckedChanged); - // - // flow5GroupBox - // - this.flow5GroupBox.Controls.Add(this.flow5ToExclamation); - this.flow5GroupBox.Controls.Add(this.flow5FromExclamation); - this.flow5GroupBox.Controls.Add(this.label9); - this.flow5GroupBox.Controls.Add(this.label10); - this.flow5GroupBox.Controls.Add(this.toLabel6); - this.flow5GroupBox.Controls.Add(this.fromLabel6); - this.flow5GroupBox.Controls.Add(this.flow5ToTextBox); - this.flow5GroupBox.Controls.Add(this.flow5FromTextBox); - this.flow5GroupBox.Controls.Add(this.flow5CheckBox); - this.flow5GroupBox.Location = new System.Drawing.Point(939, 7); - this.flow5GroupBox.Name = "flow5GroupBox"; - this.flow5GroupBox.Size = new System.Drawing.Size(221, 77); - this.flow5GroupBox.TabIndex = 8; - this.flow5GroupBox.TabStop = false; - // - // flow5ToExclamation - // - this.flow5ToExclamation.AutoSize = true; - this.flow5ToExclamation.ForeColor = System.Drawing.Color.Red; - this.flow5ToExclamation.Location = new System.Drawing.Point(167, 48); - this.flow5ToExclamation.Name = "flow5ToExclamation"; - this.flow5ToExclamation.Size = new System.Drawing.Size(10, 13); - this.flow5ToExclamation.TabIndex = 9; - this.flow5ToExclamation.Text = "!"; - this.flow5ToExclamation.Visible = false; - // - // flow5FromExclamation - // - this.flow5FromExclamation.AutoSize = true; - this.flow5FromExclamation.ForeColor = System.Drawing.Color.Red; - this.flow5FromExclamation.Location = new System.Drawing.Point(167, 24); - this.flow5FromExclamation.Name = "flow5FromExclamation"; - this.flow5FromExclamation.Size = new System.Drawing.Size(10, 13); - this.flow5FromExclamation.TabIndex = 8; - this.flow5FromExclamation.Text = "!"; - this.flow5FromExclamation.Visible = false; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(178, 48); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(32, 13); - this.label9.TabIndex = 6; - this.label9.Text = "m3/h"; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(177, 23); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(32, 13); - this.label10.TabIndex = 5; - this.label10.Text = "m3/h"; - // - // toLabel6 - // - this.toLabel6.AutoSize = true; - this.toLabel6.Location = new System.Drawing.Point(14, 48); - this.toLabel6.Name = "toLabel6"; - this.toLabel6.Size = new System.Drawing.Size(20, 13); - this.toLabel6.TabIndex = 4; - this.toLabel6.Text = "To"; - // - // fromLabel6 - // - this.fromLabel6.AutoSize = true; - this.fromLabel6.Location = new System.Drawing.Point(14, 23); - this.fromLabel6.Name = "fromLabel6"; - this.fromLabel6.Size = new System.Drawing.Size(30, 13); - this.fromLabel6.TabIndex = 3; - this.fromLabel6.Text = "From"; - // - // flow5ToTextBox - // - this.flow5ToTextBox.Location = new System.Drawing.Point(65, 45); - this.flow5ToTextBox.Name = "flow5ToTextBox"; - this.flow5ToTextBox.Size = new System.Drawing.Size(100, 20); - this.flow5ToTextBox.TabIndex = 2; - this.flow5ToTextBox.TextChanged += new System.EventHandler(this.flow5ToTextBox_TextChanged); - // - // flow5FromTextBox - // - this.flow5FromTextBox.Location = new System.Drawing.Point(65, 20); - this.flow5FromTextBox.Name = "flow5FromTextBox"; - this.flow5FromTextBox.Size = new System.Drawing.Size(100, 20); - this.flow5FromTextBox.TabIndex = 1; - this.flow5FromTextBox.TextChanged += new System.EventHandler(this.flow5FromTextBox_TextChanged); - // - // flow5CheckBox - // - this.flow5CheckBox.AutoSize = true; - this.flow5CheckBox.Location = new System.Drawing.Point(10, 0); - this.flow5CheckBox.Name = "flow5CheckBox"; - this.flow5CheckBox.Size = new System.Drawing.Size(57, 17); - this.flow5CheckBox.TabIndex = 0; - this.flow5CheckBox.Text = "Flow 5"; - this.flow5CheckBox.UseVisualStyleBackColor = true; - this.flow5CheckBox.CheckedChanged += new System.EventHandler(this.flow5CheckBox_CheckedChanged); - // - // wr10StatisticsCtrl1 - // - this.wr10StatisticsCtrl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.wr10StatisticsCtrl1.Location = new System.Drawing.Point(3, 3); - this.wr10StatisticsCtrl1.Name = "wr10StatisticsCtrl1"; - this.wr10StatisticsCtrl1.Size = new System.Drawing.Size(1188, 324); - this.wr10StatisticsCtrl1.TabIndex = 0; - // - // wr11StatisticsCtrl - // - this.wr11StatisticsCtrl.Dock = System.Windows.Forms.DockStyle.Fill; - this.wr11StatisticsCtrl.Location = new System.Drawing.Point(3, 3); - this.wr11StatisticsCtrl.Name = "wr11StatisticsCtrl"; - this.wr11StatisticsCtrl.Size = new System.Drawing.Size(1188, 324); - this.wr11StatisticsCtrl.TabIndex = 0; - // - // wr13StatisticsCtrl - // - this.wr13StatisticsCtrl.Dock = System.Windows.Forms.DockStyle.Fill; - this.wr13StatisticsCtrl.Location = new System.Drawing.Point(0, 0); - this.wr13StatisticsCtrl.Name = "wr13StatisticsCtrl"; - this.wr13StatisticsCtrl.Size = new System.Drawing.Size(1194, 330); - this.wr13StatisticsCtrl.TabIndex = 0; - // - // wr14StatisticsCtrl - // - this.wr14StatisticsCtrl.Dock = System.Windows.Forms.DockStyle.Fill; - this.wr14StatisticsCtrl.Location = new System.Drawing.Point(0, 0); - this.wr14StatisticsCtrl.Name = "wr14StatisticsCtrl"; - this.wr14StatisticsCtrl.Size = new System.Drawing.Size(1194, 330); - this.wr14StatisticsCtrl.TabIndex = 0; - // - // wr15StatisticsCtrl - // - this.wr15StatisticsCtrl.Dock = System.Windows.Forms.DockStyle.Fill; - this.wr15StatisticsCtrl.Location = new System.Drawing.Point(0, 0); - this.wr15StatisticsCtrl.Name = "wr15StatisticsCtrl"; - this.wr15StatisticsCtrl.Size = new System.Drawing.Size(1194, 330); - this.wr15StatisticsCtrl.TabIndex = 0; - // - // pt7StatisticsCtrl - // - this.pt7StatisticsCtrl.Dock = System.Windows.Forms.DockStyle.Fill; - this.pt7StatisticsCtrl.Location = new System.Drawing.Point(0, 0); - this.pt7StatisticsCtrl.Name = "pt7StatisticsCtrl"; - this.pt7StatisticsCtrl.Size = new System.Drawing.Size(1194, 330); - this.pt7StatisticsCtrl.TabIndex = 0; - // // MidOrWaterMetersCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -780,23 +645,16 @@ this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); + this.flow5GroupBox.ResumeLayout(false); + this.flow5GroupBox.PerformLayout(); + this.flow4GroupBox.ResumeLayout(false); + this.flow4GroupBox.PerformLayout(); this.flow3GroupBox.ResumeLayout(false); this.flow3GroupBox.PerformLayout(); this.flow2GroupBox.ResumeLayout(false); this.flow2GroupBox.PerformLayout(); this.flow1GroupBox.ResumeLayout(false); this.flow1GroupBox.PerformLayout(); - this.benchesTabControl.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.tabPage2.ResumeLayout(false); - this.tabPage3.ResumeLayout(false); - this.tabPage4.ResumeLayout(false); - this.tabPage5.ResumeLayout(false); - this.tabPage6.ResumeLayout(false); - this.flow4GroupBox.ResumeLayout(false); - this.flow4GroupBox.PerformLayout(); - this.flow5GroupBox.ResumeLayout(false); - this.flow5GroupBox.PerformLayout(); this.ResumeLayout(false); } @@ -805,18 +663,6 @@ private System.Windows.Forms.SplitContainer splitContainer1; private System.Windows.Forms.TabControl benchesTabControl; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.TabPage tabPage3; - private System.Windows.Forms.TabPage tabPage4; - private System.Windows.Forms.TabPage tabPage5; - private System.Windows.Forms.TabPage tabPage6; - private StatisticsCtrl wr10StatisticsCtrl1; - private StatisticsCtrl wr11StatisticsCtrl; - private StatisticsCtrl wr13StatisticsCtrl; - private StatisticsCtrl wr14StatisticsCtrl; - private StatisticsCtrl wr15StatisticsCtrl; - private StatisticsCtrl pt7StatisticsCtrl; private System.Windows.Forms.GroupBox flow3GroupBox; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; diff --git a/Statistics/UserControls/MidOrWaterMetersCtrl.cs b/Statistics/UserControls/MidOrWaterMetersCtrl.cs index 01ccadda8..d21cc58f5 100644 --- a/Statistics/UserControls/MidOrWaterMetersCtrl.cs +++ b/Statistics/UserControls/MidOrWaterMetersCtrl.cs @@ -13,7 +13,7 @@ namespace Statistics.UserControls { public partial class MidOrWaterMetersCtrl : UserControl { - public MidId MidId; + public int MidId; /// 1-based MID Id. public StatisticsDlg Parent; @@ -96,14 +96,16 @@ namespace Statistics.UserControls ManageCheckGroupBox(flow4CheckBox, flow4GroupBox); ManageCheckGroupBox(flow5CheckBox, flow5GroupBox); - for (int i = 0; i < benchesTabControl.TabPages.Count; i++ ) + for (int i = 0; i < Program.LocalSettings.BenchNames.Length; i++) { - TabPage tp = benchesTabControl.TabPages[i]; - if ((tp.Controls.Count > 0) && (tp.Controls[0] is StatisticsCtrl)) - { - (tp.Controls[0] as StatisticsCtrl).Id = i; - (tp.Controls[0] as StatisticsCtrl).MidCtrl = this; - } + TabPage tp = new TabPage(); + tp.Text = Program.LocalSettings.BenchNames[i]; + StatisticsCtrl statistics = new StatisticsCtrl(); + statistics.Id = i; + statistics.MidCtrl = this; + statistics.Dock = DockStyle.Fill; + tp.Controls.Add(statistics); + benchesTabControl.TabPages.Add(tp); } }