Statistics : 5 flow ranges and charts.

This commit is contained in:
Milan Hanajik 2018-12-21 08:14:42 +01:00
parent 1703c5dcc2
commit 1937850814
13 changed files with 931 additions and 143 deletions

View File

@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2015 Sensus Metering Systems /// Copyright (c) 2018 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.IO; using System.IO;

102
Statistics/LocalSettings.cs Normal file
View File

@ -0,0 +1,102 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
namespace Statistics
{
/// <summary>
/// Class to be serialized to an XML file...
/// Public members are local settings.
/// These settings are modified by dialogs invoked by menu items
/// Edit->Preferences ... PreferencesDlg ... S1.1(language, etc. local settings), and
/// Edit->Advanced settings ... AdvancedSettingsDlg ... S1.2(spec. where bench settings are stored)
/// </summary>
[XmlRootAttribute("Statistics")]
public class LocalSettings
{
/// <summary>
/// User interface language (used as CultureInfo(..) constructor argument).
/// </summary>
public string Language;
/// Names of servers.
public string Bench1;
public string Bench2;
public string Bench3;
public string Bench4;
public string Bench5;
public string Bench6;
/// Database settings of servers.
public string ConnectionString1;
public string ConnectionString2;
public string ConnectionString3;
public string ConnectionString4;
public string ConnectionString5;
public string ConnectionString6;
public string TimePeriodFormat;
/// Statistics options
public bool TwoDim;
/// MainWnd
public int MainWndLeft;
public int MainWndTop;
public int MainWndWidth;
public int MainWndHeight;
public bool ManiWndMaximized;
public int SplitterDistance;
/// Last configuration file name
public string LastConfigFileName;
public LocalSettings()
{
}
/// <summary>
/// Load public fields of this class from the XML file.
/// </summary>
public static LocalSettings Load(string fileName)
{
try
{
using (TextReader reader = new StreamReader(fileName))
{
LocalSettings ls = (new XmlSerializer(typeof(LocalSettings))).Deserialize(reader) as LocalSettings;
// Copy the settings just in case De-serialize() completes OK
return ls;
}
}
catch (Exception e)
{
string msg = e.Message;
return null;
}
}
/// <summary>
/// Save public fields of this class to the XML file.
/// </summary>
public void Save()
{
try
{
using (TextWriter writer = new StreamWriter(Program.LocalSettingsFileName))
{
(new XmlSerializer(typeof(LocalSettings))).Serialize(writer, this);
}
}
catch (Exception e)
{
string msg = e.Message;
}
}
}
}

View File

@ -1,18 +1,96 @@
using System; ///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using Statistics.Resources;
namespace Statistics namespace Statistics
{ {
static class Program static class Program
{ {
/// Program information
public static string Version; /// version string
public static DateTime BuildDateTime; /// date and time of program build
/// Local settings
public static readonly string ExecutableDirectory;
public static readonly string ConfigDirectory;
public static readonly string LocalSettingsFileName;
public static readonly string LocalSettingsBackupName;
public static LocalSettings LocalSettings;
static Program()
{
/// Program version string
System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly();
Version ver = thisAssembly.GetName().Version;
Version = string.Format("{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build);
BuildDateTime = new System.IO.FileInfo(thisAssembly.Location).LastWriteTime;
/// Local program configuration directory including the trailing backslash
ExecutableDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
ConfigDirectory = Path.Combine(ExecutableDirectory, "..\\Cfg\\");
LocalSettingsFileName = ConfigDirectory + "config.xml";
LocalSettingsBackupName = ConfigDirectory + "config.backup.xml";
}
/// <summary> /// <summary>
/// The main entry point for the application. /// The main entry point for the application.
/// </summary> /// </summary>
[STAThread] [STAThread]
static void Main() static void Main()
{ {
///
/// Load the local settings
///
LocalSettings = LocalSettings.Load(Program.LocalSettingsFileName);
if (LocalSettings == null)
{
/// Loading local seetings from regular config file failed. Use the backup
LocalSettings = LocalSettings.Load(Program.LocalSettingsBackupName);
if (LocalSettings == null)
{
MessageBox.Show(Strings.No_program_settings_found + Strings.Using_default_settings,
string.Empty,
MessageBoxButtons.OK,
MessageBoxIcon.Information);
/// Create new default settings and save them
LocalSettings = new LocalSettings();
Directory.CreateDirectory(ConfigDirectory);
LocalSettings.Save();
}
else
{
LocalSettings.Save(); /// Save the settings to overwrite the wrong file
}
}
else
{
/// Loading local seetings from the regular config file was successful. Update the backup
File.Copy(Program.LocalSettingsFileName, Program.LocalSettingsBackupName, true);
}
try
{
string culture = LocalSettings.Language.Replace('_', '-');
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(culture);
}
catch (Exception e)
{
string msg = e.Message;
MessageBox.Show(Strings.Selected_language_not_supported + Environment.NewLine + Strings.Using_English,
Strings.Warning,
MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
System.Threading.Thread.CurrentThread.CurrentUICulture =
new System.Globalization.CultureInfo("en");
}
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new StatisticsDlg()); Application.Run(new StatisticsDlg());

View File

@ -78,6 +78,51 @@ namespace Statistics.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to From / to.
/// </summary>
internal static string From_to {
get {
return ResourceManager.GetString("From_to", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Last 3 months.
/// </summary>
internal static string Last_3_months {
get {
return ResourceManager.GetString("Last_3_months", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Last month.
/// </summary>
internal static string Last_month {
get {
return ResourceManager.GetString("Last_month", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Last week.
/// </summary>
internal static string Last_week {
get {
return ResourceManager.GetString("Last_week", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to No program settings found..
/// </summary>
internal static string No_program_settings_found {
get {
return ResourceManager.GetString("No_program_settings_found", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to searching.... /// Looks up a localized string similar to searching....
/// </summary> /// </summary>
@ -87,6 +132,15 @@ namespace Statistics.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Selected language is not supported..
/// </summary>
internal static string Selected_language_not_supported {
get {
return ResourceManager.GetString("Selected_language_not_supported", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Statistics. /// Looks up a localized string similar to Statistics.
/// </summary> /// </summary>
@ -114,6 +168,33 @@ namespace Statistics.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Default settings are used..
/// </summary>
internal static string Using_default_settings {
get {
return ResourceManager.GetString("Using_default_settings", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to English will be used..
/// </summary>
internal static string Using_English {
get {
return ResourceManager.GetString("Using_English", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Warning.
/// </summary>
internal static string Warning {
get {
return ResourceManager.GetString("Warning", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Water meters. /// Looks up a localized string similar to Water meters.
/// </summary> /// </summary>

View File

@ -138,4 +138,31 @@
<data name="Water_meters" xml:space="preserve"> <data name="Water_meters" xml:space="preserve">
<value>Water meters</value> <value>Water meters</value>
</data> </data>
<data name="From_to" xml:space="preserve">
<value>From / to</value>
</data>
<data name="Last_3_months" xml:space="preserve">
<value>Last 3 months</value>
</data>
<data name="Last_month" xml:space="preserve">
<value>Last month</value>
</data>
<data name="Last_week" xml:space="preserve">
<value>Last week</value>
</data>
<data name="No_program_settings_found" xml:space="preserve">
<value>No program settings found.</value>
</data>
<data name="Selected_language_not_supported" xml:space="preserve">
<value>Selected language is not supported.</value>
</data>
<data name="Using_default_settings" xml:space="preserve">
<value>Default settings are used.</value>
</data>
<data name="Using_English" xml:space="preserve">
<value>English will be used.</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Warning</value>
</data>
</root> </root>

View File

@ -138,4 +138,25 @@
<data name="Water_meters" xml:space="preserve"> <data name="Water_meters" xml:space="preserve">
<value>Vodomery</value> <value>Vodomery</value>
</data> </data>
<data name="From_to" xml:space="preserve">
<value>Od / do</value>
</data>
<data name="Last_3_months" xml:space="preserve">
<value>Posledné 3 mesiace</value>
</data>
<data name="Last_month" xml:space="preserve">
<value>Posledný mesiac</value>
</data>
<data name="Last_week" xml:space="preserve">
<value>Posledný týždeň</value>
</data>
<data name="No_program_settings_found" xml:space="preserve">
<value>Nebola nájdená konfigurácia programu.</value>
</data>
<data name="Using_default_settings" xml:space="preserve">
<value>Použijú sa štandardné nastavenia.</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Upozornenie</value>
</data>
</root> </root>

View File

@ -66,6 +66,7 @@
<Compile Include="Forms\ModelessForm.designer.cs"> <Compile Include="Forms\ModelessForm.designer.cs">
<DependentUpon>ModelessForm.cs</DependentUpon> <DependentUpon>ModelessForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="LocalSettings.cs" />
<Compile Include="Resources\Strings.Designer.cs"> <Compile Include="Resources\Strings.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>

View File

@ -29,22 +29,25 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.radioButton4 = new System.Windows.Forms.RadioButton();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.timePeriodGroupBox = new System.Windows.Forms.GroupBox(); this.timePeriodGroupBox = new System.Windows.Forms.GroupBox();
this.timePeriodCheckBox = new System.Windows.Forms.CheckBox();
this.toLabel1 = new System.Windows.Forms.Label(); this.toLabel1 = new System.Windows.Forms.Label();
this.fromLabel1 = new System.Windows.Forms.Label(); this.fromLabel1 = new System.Windows.Forms.Label();
this.dateTimeFromPicker = new System.Windows.Forms.DateTimePicker(); this.dateTimeFromPicker = new System.Windows.Forms.DateTimePicker();
this.dateTimeToPicker = new System.Windows.Forms.DateTimePicker(); this.dateTimeToPicker = new System.Windows.Forms.DateTimePicker();
this.midsTabControl = new System.Windows.Forms.TabControl(); this.midsTabControl = new System.Windows.Forms.TabControl();
this.wr10TabPage = new System.Windows.Forms.TabPage(); this.wr10TabPage = new System.Windows.Forms.TabPage();
this.wr11TabPage = new System.Windows.Forms.TabPage();
this.wr13TabPage = new System.Windows.Forms.TabPage();
this.wr14TabPage = new System.Windows.Forms.TabPage();
this.wr15TabPage = new System.Windows.Forms.TabPage();
this.wmsBenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl(); this.wmsBenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl();
this.wr11TabPage = new System.Windows.Forms.TabPage();
this.i1BenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl(); this.i1BenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl();
this.wr13TabPage = new System.Windows.Forms.TabPage();
this.i2BbenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl(); this.i2BbenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl();
this.wr14TabPage = new System.Windows.Forms.TabPage();
this.i3BenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl(); this.i3BenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl();
this.wr15TabPage = new System.Windows.Forms.TabPage();
this.i4BenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl(); this.i4BenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
@ -70,6 +73,10 @@
// //
// splitContainer1.Panel1 // splitContainer1.Panel1
// //
this.splitContainer1.Panel1.Controls.Add(this.radioButton4);
this.splitContainer1.Panel1.Controls.Add(this.radioButton3);
this.splitContainer1.Panel1.Controls.Add(this.radioButton2);
this.splitContainer1.Panel1.Controls.Add(this.radioButton1);
this.splitContainer1.Panel1.Controls.Add(this.timePeriodGroupBox); this.splitContainer1.Panel1.Controls.Add(this.timePeriodGroupBox);
// //
// splitContainer1.Panel2 // splitContainer1.Panel2
@ -79,30 +86,63 @@
this.splitContainer1.SplitterDistance = 90; this.splitContainer1.SplitterDistance = 90;
this.splitContainer1.TabIndex = 0; this.splitContainer1.TabIndex = 0;
// //
// radioButton4
//
this.radioButton4.AutoSize = true;
this.radioButton4.Location = new System.Drawing.Point(136, 12);
this.radioButton4.Name = "radioButton4";
this.radioButton4.Size = new System.Drawing.Size(68, 17);
this.radioButton4.TabIndex = 6;
this.radioButton4.TabStop = true;
this.radioButton4.Text = "From / to";
this.radioButton4.UseVisualStyleBackColor = true;
this.radioButton4.CheckedChanged += new System.EventHandler(this.radioButton4_CheckedChanged);
//
// radioButton3
//
this.radioButton3.AutoSize = true;
this.radioButton3.Location = new System.Drawing.Point(12, 58);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(91, 17);
this.radioButton3.TabIndex = 5;
this.radioButton3.TabStop = true;
this.radioButton3.Text = "Last 3 months";
this.radioButton3.UseVisualStyleBackColor = true;
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(12, 35);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(77, 17);
this.radioButton2.TabIndex = 4;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "Last month";
this.radioButton2.UseVisualStyleBackColor = true;
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(12, 12);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(74, 17);
this.radioButton1.TabIndex = 3;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Last week";
this.radioButton1.UseVisualStyleBackColor = true;
//
// timePeriodGroupBox // timePeriodGroupBox
// //
this.timePeriodGroupBox.Controls.Add(this.timePeriodCheckBox);
this.timePeriodGroupBox.Controls.Add(this.toLabel1); this.timePeriodGroupBox.Controls.Add(this.toLabel1);
this.timePeriodGroupBox.Controls.Add(this.fromLabel1); this.timePeriodGroupBox.Controls.Add(this.fromLabel1);
this.timePeriodGroupBox.Controls.Add(this.dateTimeFromPicker); this.timePeriodGroupBox.Controls.Add(this.dateTimeFromPicker);
this.timePeriodGroupBox.Controls.Add(this.dateTimeToPicker); this.timePeriodGroupBox.Controls.Add(this.dateTimeToPicker);
this.timePeriodGroupBox.Location = new System.Drawing.Point(12, 10); this.timePeriodGroupBox.Location = new System.Drawing.Point(210, 10);
this.timePeriodGroupBox.Name = "timePeriodGroupBox"; this.timePeriodGroupBox.Name = "timePeriodGroupBox";
this.timePeriodGroupBox.Size = new System.Drawing.Size(296, 74); this.timePeriodGroupBox.Size = new System.Drawing.Size(296, 74);
this.timePeriodGroupBox.TabIndex = 2; this.timePeriodGroupBox.TabIndex = 2;
this.timePeriodGroupBox.TabStop = false; this.timePeriodGroupBox.TabStop = false;
// //
// timePeriodCheckBox
//
this.timePeriodCheckBox.AutoSize = true;
this.timePeriodCheckBox.Location = new System.Drawing.Point(6, -2);
this.timePeriodCheckBox.Name = "timePeriodCheckBox";
this.timePeriodCheckBox.Size = new System.Drawing.Size(81, 17);
this.timePeriodCheckBox.TabIndex = 4;
this.timePeriodCheckBox.Text = "Time period";
this.timePeriodCheckBox.UseVisualStyleBackColor = true;
this.timePeriodCheckBox.CheckedChanged += new System.EventHandler(this.timePeriodCheckBox_CheckedChanged);
//
// toLabel1 // toLabel1
// //
this.toLabel1.AutoSize = true; this.toLabel1.AutoSize = true;
@ -160,6 +200,14 @@
this.wr10TabPage.Text = "Water meters"; this.wr10TabPage.Text = "Water meters";
this.wr10TabPage.UseVisualStyleBackColor = true; 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 // wr11TabPage
// //
this.wr11TabPage.Controls.Add(this.i1BenchesControl); this.wr11TabPage.Controls.Add(this.i1BenchesControl);
@ -171,6 +219,14 @@
this.wr11TabPage.Text = "I1"; this.wr11TabPage.Text = "I1";
this.wr11TabPage.UseVisualStyleBackColor = true; 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 // wr13TabPage
// //
this.wr13TabPage.Controls.Add(this.i2BbenchesControl); this.wr13TabPage.Controls.Add(this.i2BbenchesControl);
@ -182,6 +238,14 @@
this.wr13TabPage.Text = "I2"; this.wr13TabPage.Text = "I2";
this.wr13TabPage.UseVisualStyleBackColor = true; 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 // wr14TabPage
// //
this.wr14TabPage.Controls.Add(this.i3BenchesControl); this.wr14TabPage.Controls.Add(this.i3BenchesControl);
@ -193,6 +257,14 @@
this.wr14TabPage.Text = "I3"; this.wr14TabPage.Text = "I3";
this.wr14TabPage.UseVisualStyleBackColor = true; 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 // wr15TabPage
// //
this.wr15TabPage.Controls.Add(this.i4BenchesControl); this.wr15TabPage.Controls.Add(this.i4BenchesControl);
@ -204,38 +276,6 @@
this.wr15TabPage.Text = "I4"; this.wr15TabPage.Text = "I4";
this.wr15TabPage.UseVisualStyleBackColor = true; this.wr15TabPage.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;
//
// 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;
//
// 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;
//
// 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;
//
// i4BenchesControl // i4BenchesControl
// //
this.i4BenchesControl.Dock = System.Windows.Forms.DockStyle.Fill; this.i4BenchesControl.Dock = System.Windows.Forms.DockStyle.Fill;
@ -254,6 +294,7 @@
this.Text = "Statistics"; this.Text = "Statistics";
this.Load += new System.EventHandler(this.StatisticsDlg_Load); this.Load += new System.EventHandler(this.StatisticsDlg_Load);
this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false); this.splitContainer1.ResumeLayout(false);
@ -283,12 +324,15 @@
private System.Windows.Forms.DateTimePicker dateTimeToPicker; private System.Windows.Forms.DateTimePicker dateTimeToPicker;
private System.Windows.Forms.Label toLabel1; private System.Windows.Forms.Label toLabel1;
private System.Windows.Forms.Label fromLabel1; private System.Windows.Forms.Label fromLabel1;
private System.Windows.Forms.CheckBox timePeriodCheckBox;
private UserControls.MidOrWaterMetersCtrl wmsBenchesControl; private UserControls.MidOrWaterMetersCtrl wmsBenchesControl;
private UserControls.MidOrWaterMetersCtrl i1BenchesControl; private UserControls.MidOrWaterMetersCtrl i1BenchesControl;
private UserControls.MidOrWaterMetersCtrl i2BbenchesControl; private UserControls.MidOrWaterMetersCtrl i2BbenchesControl;
private UserControls.MidOrWaterMetersCtrl i3BenchesControl; private UserControls.MidOrWaterMetersCtrl i3BenchesControl;
private UserControls.MidOrWaterMetersCtrl i4BenchesControl; 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;
} }
} }

View File

@ -1,4 +1,7 @@
using System; ///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@ -51,7 +54,7 @@ namespace Statistics
{ {
InitializeComponent(); InitializeComponent();
ManageCheckGroupBox(timePeriodCheckBox, timePeriodGroupBox); ///ManageCheckGroupBox(timePeriodCheckBox, timePeriodGroupBox);
for (MidId midId = 0; midId < MidId.Count; midId++) for (MidId midId = 0; midId < MidId.Count; midId++)
{ {
@ -62,19 +65,32 @@ namespace Statistics
} }
midsTabControl.TabPages[0].Text = Strings.Water_meters; midsTabControl.TabPages[0].Text = Strings.Water_meters;
radioButton1.Checked = true;
timePeriodGroupBox.Enabled = false;
Localize(); Localize();
} }
void Localize() void Localize()
{ {
Text = Strings.Statistics; Text = Strings.Statistics;
timePeriodCheckBox.Text = Strings.Time_period; //timePeriodCheckBox.Text = Strings.Time_period;
fromLabel1.Text = Strings.From; fromLabel1.Text = Strings.From;
toLabel1.Text = Strings.To; toLabel1.Text = Strings.To;
radioButton1.Text = Strings.Last_week;
radioButton2.Text = Strings.Last_month;
radioButton3.Text = Strings.Last_3_months;
radioButton4.Text = Strings.From_to;
} }
private void StatisticsDlg_Load(object sender, EventArgs e) private void StatisticsDlg_Load(object sender, EventArgs e)
{ {
Statistics.LocalSettings ls = Program.LocalSettings;
Width = (ls.MainWndWidth > 0) ? ls.MainWndWidth : 1000;
Height = (ls.MainWndHeight > 0) ? ls.MainWndHeight : 750;
Left = (ls.MainWndLeft != 0) ? ls.MainWndLeft : 50;
Top = (ls.MainWndTop != 0) ? ls.MainWndTop : 50;
for (int i = 0; i < testBenchNames.Length; i++) for (int i = 0; i < testBenchNames.Length; i++)
{ {
if ((i < connectionStrings.Length) && !string.IsNullOrEmpty(connectionStrings[i])) if ((i < connectionStrings.Length) && !string.IsNullOrEmpty(connectionStrings[i]))
@ -116,10 +132,10 @@ namespace Statistics
grp.Enabled = chk.Checked; grp.Enabled = chk.Checked;
} }
private void timePeriodCheckBox_CheckedChanged(object sender, EventArgs e) //private void timePeriodCheckBox_CheckedChanged(object sender, EventArgs e)
{ //{
ManageCheckGroupBox(timePeriodCheckBox, timePeriodGroupBox); // ManageCheckGroupBox(timePeriodCheckBox, timePeriodGroupBox);
} //}
public IList<TestRslt> UpdateRequest(int benchId, MidId midId) public IList<TestRslt> UpdateRequest(int benchId, MidId midId)
@ -150,6 +166,10 @@ namespace Statistics
thread.CurrentUICulture = CultureInfo.CurrentUICulture; thread.CurrentUICulture = CultureInfo.CurrentUICulture;
thread.Start(); thread.Start();
DateTime from;
DateTime to;
GetDateRange(out from, out to);
try try
{ {
ISession session = sessionFactories[benchId].OpenSession(); ISession session = sessionFactories[benchId].OpenSession();
@ -160,7 +180,7 @@ namespace Statistics
foreach (var cmpnts in listOfComponentsWithFlowmeter) foreach (var cmpnts in listOfComponentsWithFlowmeter)
{ {
var listOfRslts = session.QueryOver<TestRslt>() var listOfRslts = session.QueryOver<TestRslt>()
.Where(x => ((x.EndTime >= dateTimeFromPicker.Value) && (x.EndTime <= dateTimeToPicker.Value))) .Where(x => ((x.EndTime >= from) && (x.EndTime <= to)))
.And(x => (x.Components == cmpnts)) .And(x => (x.Components == cmpnts))
.List(); .List();
foreach (var tr in listOfRslts) testRslts.Add(tr); foreach (var tr in listOfRslts) testRslts.Add(tr);
@ -177,5 +197,38 @@ namespace Statistics
return null; return null;
} }
} }
void GetDateRange(out DateTime from, out DateTime to)
{
if (radioButton1.Checked)
{
/// Last week
from = DateTime.Now.Date.AddDays(-7);
to = DateTime.Now;
}
else if (radioButton2.Checked)
{
/// Last month
from = DateTime.Now.Date.AddDays(-31);
to = DateTime.Now;
}
else if (radioButton3.Checked)
{
/// Last 3 months
from = DateTime.Now.Date.AddDays(-91);
to = DateTime.Now;
}
else
{
/// From / to
from = dateTimeFromPicker.Value.Date;
to = dateTimeToPicker.Value.Date.AddDays(1).AddTicks(-1);
}
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)
{
timePeriodGroupBox.Enabled = radioButton4.Checked;
}
} }
} }

View File

@ -61,16 +61,36 @@
this.flow1CheckBox = new System.Windows.Forms.CheckBox(); this.flow1CheckBox = new System.Windows.Forms.CheckBox();
this.benchesTabControl = new System.Windows.Forms.TabControl(); this.benchesTabControl = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.wr10StatisticsCtrl1 = new Statistics.UserControls.StatisticsCtrl();
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.wr11StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.wr13StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl();
this.tabPage4 = new System.Windows.Forms.TabPage(); this.tabPage4 = new System.Windows.Forms.TabPage();
this.wr14StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl();
this.tabPage5 = new System.Windows.Forms.TabPage(); this.tabPage5 = new System.Windows.Forms.TabPage();
this.wr15StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl();
this.tabPage6 = 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(); this.pt7StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
@ -86,6 +106,8 @@
this.tabPage4.SuspendLayout(); this.tabPage4.SuspendLayout();
this.tabPage5.SuspendLayout(); this.tabPage5.SuspendLayout();
this.tabPage6.SuspendLayout(); this.tabPage6.SuspendLayout();
this.flow4GroupBox.SuspendLayout();
this.flow5GroupBox.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// splitContainer1 // splitContainer1
@ -99,6 +121,8 @@
// //
// splitContainer1.Panel1 // splitContainer1.Panel1
// //
this.splitContainer1.Panel1.Controls.Add(this.flow5GroupBox);
this.splitContainer1.Panel1.Controls.Add(this.flow4GroupBox);
this.splitContainer1.Panel1.Controls.Add(this.flow3GroupBox); this.splitContainer1.Panel1.Controls.Add(this.flow3GroupBox);
this.splitContainer1.Panel1.Controls.Add(this.flow2GroupBox); this.splitContainer1.Panel1.Controls.Add(this.flow2GroupBox);
this.splitContainer1.Panel1.Controls.Add(this.flow1GroupBox); this.splitContainer1.Panel1.Controls.Add(this.flow1GroupBox);
@ -106,7 +130,7 @@
// splitContainer1.Panel2 // splitContainer1.Panel2
// //
this.splitContainer1.Panel2.Controls.Add(this.benchesTabControl); this.splitContainer1.Panel2.Controls.Add(this.benchesTabControl);
this.splitContainer1.Size = new System.Drawing.Size(800, 450); this.splitContainer1.Size = new System.Drawing.Size(1202, 450);
this.splitContainer1.SplitterDistance = 90; this.splitContainer1.SplitterDistance = 90;
this.splitContainer1.TabIndex = 0; this.splitContainer1.TabIndex = 0;
// //
@ -428,7 +452,7 @@
this.benchesTabControl.Location = new System.Drawing.Point(0, 0); this.benchesTabControl.Location = new System.Drawing.Point(0, 0);
this.benchesTabControl.Name = "benchesTabControl"; this.benchesTabControl.Name = "benchesTabControl";
this.benchesTabControl.SelectedIndex = 0; this.benchesTabControl.SelectedIndex = 0;
this.benchesTabControl.Size = new System.Drawing.Size(800, 356); this.benchesTabControl.Size = new System.Drawing.Size(1202, 356);
this.benchesTabControl.TabIndex = 0; this.benchesTabControl.TabIndex = 0;
// //
// tabPage1 // tabPage1
@ -437,108 +461,312 @@
this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(792, 330); this.tabPage1.Size = new System.Drawing.Size(1194, 330);
this.tabPage1.TabIndex = 0; this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "WR10"; this.tabPage1.Text = "WR10";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
// //
// 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(786, 324);
this.wr10StatisticsCtrl1.TabIndex = 0;
//
// tabPage2 // tabPage2
// //
this.tabPage2.Controls.Add(this.wr11StatisticsCtrl); this.tabPage2.Controls.Add(this.wr11StatisticsCtrl);
this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(792, 320); this.tabPage2.Size = new System.Drawing.Size(1194, 330);
this.tabPage2.TabIndex = 1; this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "WR11"; this.tabPage2.Text = "WR11";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
// //
// 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(786, 314);
this.wr11StatisticsCtrl.TabIndex = 0;
//
// tabPage3 // tabPage3
// //
this.tabPage3.Controls.Add(this.wr13StatisticsCtrl); this.tabPage3.Controls.Add(this.wr13StatisticsCtrl);
this.tabPage3.Location = new System.Drawing.Point(4, 22); this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3"; this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(792, 320); this.tabPage3.Size = new System.Drawing.Size(1194, 330);
this.tabPage3.TabIndex = 2; this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "WR13"; this.tabPage3.Text = "WR13";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
// //
// 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(792, 320);
this.wr13StatisticsCtrl.TabIndex = 0;
//
// tabPage4 // tabPage4
// //
this.tabPage4.Controls.Add(this.wr14StatisticsCtrl); this.tabPage4.Controls.Add(this.wr14StatisticsCtrl);
this.tabPage4.Location = new System.Drawing.Point(4, 22); this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4"; this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(792, 320); this.tabPage4.Size = new System.Drawing.Size(1194, 330);
this.tabPage4.TabIndex = 3; this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "WR14"; this.tabPage4.Text = "WR14";
this.tabPage4.UseVisualStyleBackColor = true; this.tabPage4.UseVisualStyleBackColor = true;
// //
// 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(792, 320);
this.wr14StatisticsCtrl.TabIndex = 0;
//
// tabPage5 // tabPage5
// //
this.tabPage5.Controls.Add(this.wr15StatisticsCtrl); this.tabPage5.Controls.Add(this.wr15StatisticsCtrl);
this.tabPage5.Location = new System.Drawing.Point(4, 22); this.tabPage5.Location = new System.Drawing.Point(4, 22);
this.tabPage5.Name = "tabPage5"; this.tabPage5.Name = "tabPage5";
this.tabPage5.Size = new System.Drawing.Size(792, 320); this.tabPage5.Size = new System.Drawing.Size(1194, 330);
this.tabPage5.TabIndex = 4; this.tabPage5.TabIndex = 4;
this.tabPage5.Text = "WR15"; this.tabPage5.Text = "WR15";
this.tabPage5.UseVisualStyleBackColor = true; this.tabPage5.UseVisualStyleBackColor = true;
// //
// 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(792, 320);
this.wr15StatisticsCtrl.TabIndex = 0;
//
// tabPage6 // tabPage6
// //
this.tabPage6.Controls.Add(this.pt7StatisticsCtrl); this.tabPage6.Controls.Add(this.pt7StatisticsCtrl);
this.tabPage6.Location = new System.Drawing.Point(4, 22); this.tabPage6.Location = new System.Drawing.Point(4, 22);
this.tabPage6.Name = "tabPage6"; this.tabPage6.Name = "tabPage6";
this.tabPage6.Size = new System.Drawing.Size(792, 320); this.tabPage6.Size = new System.Drawing.Size(1194, 330);
this.tabPage6.TabIndex = 5; this.tabPage6.TabIndex = 5;
this.tabPage6.Text = "PT7"; this.tabPage6.Text = "PT7";
this.tabPage6.UseVisualStyleBackColor = true; 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 // pt7StatisticsCtrl
// //
this.pt7StatisticsCtrl.Dock = System.Windows.Forms.DockStyle.Fill; this.pt7StatisticsCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
this.pt7StatisticsCtrl.Location = new System.Drawing.Point(0, 0); this.pt7StatisticsCtrl.Location = new System.Drawing.Point(0, 0);
this.pt7StatisticsCtrl.Name = "pt7StatisticsCtrl"; this.pt7StatisticsCtrl.Name = "pt7StatisticsCtrl";
this.pt7StatisticsCtrl.Size = new System.Drawing.Size(792, 320); this.pt7StatisticsCtrl.Size = new System.Drawing.Size(1194, 330);
this.pt7StatisticsCtrl.TabIndex = 0; this.pt7StatisticsCtrl.TabIndex = 0;
// //
// MidOrWaterMetersCtrl // MidOrWaterMetersCtrl
@ -547,7 +775,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1); this.Controls.Add(this.splitContainer1);
this.Name = "MidOrWaterMetersCtrl"; this.Name = "MidOrWaterMetersCtrl";
this.Size = new System.Drawing.Size(800, 450); this.Size = new System.Drawing.Size(1202, 450);
this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
@ -565,6 +793,10 @@
this.tabPage4.ResumeLayout(false); this.tabPage4.ResumeLayout(false);
this.tabPage5.ResumeLayout(false); this.tabPage5.ResumeLayout(false);
this.tabPage6.ResumeLayout(false); this.tabPage6.ResumeLayout(false);
this.flow4GroupBox.ResumeLayout(false);
this.flow4GroupBox.PerformLayout();
this.flow5GroupBox.ResumeLayout(false);
this.flow5GroupBox.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -615,5 +847,25 @@
private System.Windows.Forms.Label flow3FromExclamation; private System.Windows.Forms.Label flow3FromExclamation;
private System.Windows.Forms.Label flow2ToExclamation; private System.Windows.Forms.Label flow2ToExclamation;
private System.Windows.Forms.Label flow2FromExclamation; private System.Windows.Forms.Label flow2FromExclamation;
private System.Windows.Forms.GroupBox flow5GroupBox;
private System.Windows.Forms.Label flow5ToExclamation;
private System.Windows.Forms.Label flow5FromExclamation;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label toLabel6;
private System.Windows.Forms.Label fromLabel6;
private System.Windows.Forms.TextBox flow5ToTextBox;
private System.Windows.Forms.TextBox flow5FromTextBox;
private System.Windows.Forms.CheckBox flow5CheckBox;
private System.Windows.Forms.GroupBox flow4GroupBox;
private System.Windows.Forms.Label flow4ToExclamation;
private System.Windows.Forms.Label flow4FromExclamation;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label toLabel5;
private System.Windows.Forms.Label fromLabel5;
private System.Windows.Forms.TextBox flow4ToTextBox;
private System.Windows.Forms.TextBox flow4FromTextBox;
private System.Windows.Forms.CheckBox flow4CheckBox;
} }
} }

View File

@ -1,4 +1,7 @@
using System; ///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
@ -16,17 +19,46 @@ namespace Statistics.UserControls
public MidId MidId; public MidId MidId;
public StatisticsDlg Parent; public StatisticsDlg Parent;
public bool Flow1Enabled { get { return flow1CheckBox.Checked; } }
public double Flow1From { get { return flow1From; } }
public double Flow1To { get { return flow1To; } }
public bool Flow2Enabled { get { return flow2CheckBox.Checked; } } public bool IsFlowEnabled(int i)
public double Flow2From { get { return flow2From; } } {
public double Flow2To { get { return flow2To; } } switch (i)
{
case 1: return flow1CheckBox.Checked;
case 2: return flow2CheckBox.Checked;
case 3: return flow3CheckBox.Checked;
case 4: return flow4CheckBox.Checked;
case 5: return flow5CheckBox.Checked;
default: return false;
}
}
public double FlowFrom(int i)
{
switch (i)
{
case 1: return flow1From;
case 2: return flow2From;
case 3: return flow3From;
case 4: return flow4From;
case 5: return flow5From;
default: return 0;
}
}
public double FlowTo(int i)
{
switch (i)
{
case 1: return flow1To;
case 2: return flow2To;
case 3: return flow3To;
case 4: return flow4To;
case 5: return flow5To;
default: return 0;
}
}
public bool Flow3Enabled { get { return flow3CheckBox.Checked; } }
public double Flow3From { get { return flow3From; } }
public double Flow3To { get { return flow3To; } }
/// All flows are in m3/h /// All flows are in m3/h
double flow1From; double flow1From;
@ -35,6 +67,10 @@ namespace Statistics.UserControls
double flow2To; double flow2To;
double flow3From; double flow3From;
double flow3To; double flow3To;
double flow4From;
double flow4To;
double flow5From;
double flow5To;
StatisticsCtrl GetStatistics(int i) StatisticsCtrl GetStatistics(int i)
@ -60,6 +96,8 @@ namespace Statistics.UserControls
ManageCheckGroupBox(flow1CheckBox, flow1GroupBox); ManageCheckGroupBox(flow1CheckBox, flow1GroupBox);
ManageCheckGroupBox(flow2CheckBox, flow2GroupBox); ManageCheckGroupBox(flow2CheckBox, flow2GroupBox);
ManageCheckGroupBox(flow3CheckBox, flow3GroupBox); ManageCheckGroupBox(flow3CheckBox, flow3GroupBox);
ManageCheckGroupBox(flow4CheckBox, flow4GroupBox);
ManageCheckGroupBox(flow5CheckBox, flow5GroupBox);
for (int i = 0; i < benchesTabControl.TabPages.Count; i++ ) for (int i = 0; i < benchesTabControl.TabPages.Count; i++ )
{ {
@ -67,7 +105,7 @@ namespace Statistics.UserControls
if ((tp.Controls.Count > 0) && (tp.Controls[0] is StatisticsCtrl)) if ((tp.Controls.Count > 0) && (tp.Controls[0] is StatisticsCtrl))
{ {
(tp.Controls[0] as StatisticsCtrl).Id = i; (tp.Controls[0] as StatisticsCtrl).Id = i;
(tp.Controls[0] as StatisticsCtrl).BenchesCtrl = this; (tp.Controls[0] as StatisticsCtrl).MidCtrl = this;
} }
} }
} }
@ -77,17 +115,25 @@ namespace Statistics.UserControls
flow1CheckBox.Text = string.Format("{0} 1", Strings.Flow); flow1CheckBox.Text = string.Format("{0} 1", Strings.Flow);
flow2CheckBox.Text = string.Format("{0} 2", Strings.Flow); flow2CheckBox.Text = string.Format("{0} 2", Strings.Flow);
flow3CheckBox.Text = string.Format("{0} 3", Strings.Flow); flow3CheckBox.Text = string.Format("{0} 3", Strings.Flow);
flow4CheckBox.Text = string.Format("{0} 4", Strings.Flow);
flow5CheckBox.Text = string.Format("{0} 5", Strings.Flow);
fromLabel2.Text = Strings.From; fromLabel2.Text = Strings.From;
fromLabel3.Text = Strings.From; fromLabel3.Text = Strings.From;
fromLabel4.Text = Strings.From; fromLabel4.Text = Strings.From;
fromLabel5.Text = Strings.From;
fromLabel6.Text = Strings.From;
toLabel2.Text = Strings.To; toLabel2.Text = Strings.To;
toLabel3.Text = Strings.To; toLabel3.Text = Strings.To;
toLabel4.Text = Strings.To; toLabel4.Text = Strings.To;
toLabel5.Text = Strings.To;
toLabel6.Text = Strings.To;
} }
private void flow1CheckBox_CheckedChanged(object sender, EventArgs e) { ManageCheckGroupBox(flow1CheckBox, flow1GroupBox); } private void flow1CheckBox_CheckedChanged(object sender, EventArgs e) { ManageCheckGroupBox(flow1CheckBox, flow1GroupBox); }
private void flow2CheckBox_CheckedChanged(object sender, EventArgs e) { ManageCheckGroupBox(flow2CheckBox, flow2GroupBox); } private void flow2CheckBox_CheckedChanged(object sender, EventArgs e) { ManageCheckGroupBox(flow2CheckBox, flow2GroupBox); }
private void flow3CheckBox_CheckedChanged(object sender, EventArgs e) { ManageCheckGroupBox(flow3CheckBox, flow3GroupBox); } private void flow3CheckBox_CheckedChanged(object sender, EventArgs e) { ManageCheckGroupBox(flow3CheckBox, flow3GroupBox); }
private void flow4CheckBox_CheckedChanged(object sender, EventArgs e) { ManageCheckGroupBox(flow4CheckBox, flow4GroupBox); }
private void flow5CheckBox_CheckedChanged(object sender, EventArgs e) { ManageCheckGroupBox(flow5CheckBox, flow5GroupBox); }
private void ManageCheckGroupBox(CheckBox chk, GroupBox grp) private void ManageCheckGroupBox(CheckBox chk, GroupBox grp)
{ {
@ -168,5 +214,49 @@ namespace Statistics.UserControls
else else
flow3ToExclamation.Visible = !(double.TryParse(flow3ToTextBox.Text, out flow3To) && (flow3To >= 0)); flow3ToExclamation.Visible = !(double.TryParse(flow3ToTextBox.Text, out flow3To) && (flow3To >= 0));
} }
private void flow4FromTextBox_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(flow4FromTextBox.Text))
{
flow4From = 0;
flow4FromExclamation.Visible = false;
}
else
flow4FromExclamation.Visible = !(double.TryParse(flow4FromTextBox.Text, out flow4From) && (flow4From >= 0));
}
private void flow4ToTextBox_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(flow4ToTextBox.Text))
{
flow4To = 0;
flow4ToExclamation.Visible = false;
}
else
flow4ToExclamation.Visible = !(double.TryParse(flow4ToTextBox.Text, out flow4To) && (flow4To >= 0));
}
private void flow5FromTextBox_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(flow5FromTextBox.Text))
{
flow5From = 0;
flow5FromExclamation.Visible = false;
}
else
flow5FromExclamation.Visible = !(double.TryParse(flow5FromTextBox.Text, out flow5From) && (flow5From >= 0));
}
private void flow5ToTextBox_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(flow5ToTextBox.Text))
{
flow5To = 0;
flow5ToExclamation.Visible = false;
}
else
flow5ToExclamation.Visible = !(double.TryParse(flow5ToTextBox.Text, out flow5To) && (flow5To >= 0));
}
} }
} }

View File

@ -31,6 +31,10 @@
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.Series series5 = new System.Windows.Forms.DataVisualization.Charting.Series();
this.updateButton = new System.Windows.Forms.Button(); this.updateButton = new System.Windows.Forms.Button();
this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
@ -66,9 +70,33 @@
series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
series1.Color = System.Drawing.Color.ForestGreen; series1.Color = System.Drawing.Color.ForestGreen;
series1.Legend = "Legend1"; series1.Legend = "Legend1";
series1.Name = "Error"; series1.Name = "Flow 1";
series2.ChartArea = "ChartArea1";
series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
series2.Color = System.Drawing.Color.Red;
series2.Legend = "Legend1";
series2.Name = "Flow 2";
series3.ChartArea = "ChartArea1";
series3.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
series3.Color = System.Drawing.Color.Blue;
series3.Legend = "Legend1";
series3.Name = "Flow 3";
series4.ChartArea = "ChartArea1";
series4.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
series4.Color = System.Drawing.Color.Yellow;
series4.Legend = "Legend1";
series4.Name = "Flow 4";
series5.ChartArea = "ChartArea1";
series5.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
series5.Color = System.Drawing.Color.Fuchsia;
series5.Legend = "Legend1";
series5.Name = "Flow 5";
this.chart1.Series.Add(series1); this.chart1.Series.Add(series1);
this.chart1.Size = new System.Drawing.Size(470, 381); this.chart1.Series.Add(series2);
this.chart1.Series.Add(series3);
this.chart1.Series.Add(series4);
this.chart1.Series.Add(series5);
this.chart1.Size = new System.Drawing.Size(473, 381);
this.chart1.TabIndex = 5; this.chart1.TabIndex = 5;
this.chart1.Text = "chart1"; this.chart1.Text = "chart1";
// //
@ -89,7 +117,7 @@
this.splitContainer1.Panel2.Controls.Add(this.exportButton); this.splitContainer1.Panel2.Controls.Add(this.exportButton);
this.splitContainer1.Panel2.Controls.Add(this.updateButton); this.splitContainer1.Panel2.Controls.Add(this.updateButton);
this.splitContainer1.Size = new System.Drawing.Size(577, 381); this.splitContainer1.Size = new System.Drawing.Size(577, 381);
this.splitContainer1.SplitterDistance = 470; this.splitContainer1.SplitterDistance = 473;
this.splitContainer1.SplitterWidth = 1; this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 6; this.splitContainer1.TabIndex = 6;
// //

View File

@ -1,20 +1,19 @@
using System; ///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting; using System.Windows.Forms.DataVisualization.Charting;
using Results.Entities; using Results.Entities;
using Statistics.Resources;
namespace Statistics.UserControls namespace Statistics.UserControls
{ {
public partial class StatisticsCtrl : UserControl public partial class StatisticsCtrl : UserControl
{ {
public int Id; /// Index of the tab page public int Id; /// Index of the tab page
public MidOrWaterMetersCtrl BenchesCtrl; /// Reference to the parent control public MidOrWaterMetersCtrl MidCtrl; /// Reference to the parent control
public StatisticsCtrl() public StatisticsCtrl()
{ {
@ -26,21 +25,33 @@ namespace Statistics.UserControls
private void updateButton_Click(object sender, EventArgs e) private void updateButton_Click(object sender, EventArgs e)
{ {
if (BenchesCtrl != null) if (MidCtrl != null)
{ {
IList<TestRslt> results = BenchesCtrl.UpdateRequest(Id); for (int i = 1; i <= 5; i++)
{
chart1.Series[string.Format("{0} {1}", Strings.Flow, i)].Points.Clear();
}
IList<TestRslt> results = MidCtrl.UpdateRequest(Id);
if (results != null) if (results != null)
{ {
foreach (var r in results) foreach (var r in results)
{ {
chart1.Series["Error"].Points.AddXY(r.StartTime, r.ErrorMaster); if (r.ErrorMaster != 0)
{
for (int i = 1; i <= 5; i++)
{
if (MidCtrl.IsFlowEnabled(i) && (MidCtrl.FlowFrom(i) <= r.FlowMean) && (r.FlowMean <= MidCtrl.FlowTo(i)))
{
chart1.Series[string.Format("{0} {1}", Strings.Flow, i)].Points.AddXY(r.StartTime, r.ErrorMaster);
}
}
}
} }
return; return;
} }
} }
chart1.Series["Error"].Points.Clear();
} }
private void exportButton_Click(object sender, EventArgs e) private void exportButton_Click(object sender, EventArgs e)