ResultsBrowser : Export of statistics, ver. 2.18.856
This commit is contained in:
+113
-97
@@ -28,103 +28,118 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||||
this.statisticsListView = new System.Windows.Forms.ListView();
|
this.statisticsListView = new System.Windows.Forms.ListView();
|
||||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||||
this.printButton = new System.Windows.Forms.Button();
|
this.printButton = new System.Windows.Forms.Button();
|
||||||
this.closeButton = new System.Windows.Forms.Button();
|
this.closeButton = new System.Windows.Forms.Button();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
this.exportButton = new System.Windows.Forms.Button();
|
||||||
this.splitContainer1.Panel1.SuspendLayout();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||||
this.splitContainer1.Panel2.SuspendLayout();
|
this.splitContainer1.Panel1.SuspendLayout();
|
||||||
this.splitContainer1.SuspendLayout();
|
this.splitContainer1.Panel2.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
|
this.splitContainer1.SuspendLayout();
|
||||||
this.splitContainer2.Panel2.SuspendLayout();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
|
||||||
this.splitContainer2.SuspendLayout();
|
this.splitContainer2.Panel2.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.splitContainer2.SuspendLayout();
|
||||||
//
|
this.SuspendLayout();
|
||||||
// splitContainer1
|
//
|
||||||
//
|
// splitContainer1
|
||||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
//
|
||||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||||
this.splitContainer1.Name = "splitContainer1";
|
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
this.splitContainer1.Name = "splitContainer1";
|
||||||
//
|
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||||
// splitContainer1.Panel1
|
//
|
||||||
//
|
// splitContainer1.Panel1
|
||||||
this.splitContainer1.Panel1.Controls.Add(this.statisticsListView);
|
//
|
||||||
//
|
this.splitContainer1.Panel1.Controls.Add(this.statisticsListView);
|
||||||
// splitContainer1.Panel2
|
//
|
||||||
//
|
// splitContainer1.Panel2
|
||||||
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
|
//
|
||||||
this.splitContainer1.Size = new System.Drawing.Size(572, 409);
|
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
|
||||||
this.splitContainer1.SplitterDistance = 320;
|
this.splitContainer1.Size = new System.Drawing.Size(572, 409);
|
||||||
this.splitContainer1.TabIndex = 0;
|
this.splitContainer1.SplitterDistance = 320;
|
||||||
//
|
this.splitContainer1.TabIndex = 0;
|
||||||
// statisticsListView
|
//
|
||||||
//
|
// statisticsListView
|
||||||
this.statisticsListView.Dock = System.Windows.Forms.DockStyle.Fill;
|
//
|
||||||
this.statisticsListView.GridLines = true;
|
this.statisticsListView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.statisticsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
this.statisticsListView.GridLines = true;
|
||||||
this.statisticsListView.Location = new System.Drawing.Point(0, 0);
|
this.statisticsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||||
this.statisticsListView.Name = "statisticsListView";
|
this.statisticsListView.Location = new System.Drawing.Point(0, 0);
|
||||||
this.statisticsListView.Size = new System.Drawing.Size(572, 320);
|
this.statisticsListView.Name = "statisticsListView";
|
||||||
this.statisticsListView.TabIndex = 0;
|
this.statisticsListView.Size = new System.Drawing.Size(572, 320);
|
||||||
this.statisticsListView.UseCompatibleStateImageBehavior = false;
|
this.statisticsListView.TabIndex = 0;
|
||||||
//
|
this.statisticsListView.UseCompatibleStateImageBehavior = false;
|
||||||
// splitContainer2
|
//
|
||||||
//
|
// splitContainer2
|
||||||
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
|
//
|
||||||
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
|
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||||
this.splitContainer2.Name = "splitContainer2";
|
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
|
||||||
//
|
this.splitContainer2.Name = "splitContainer2";
|
||||||
// splitContainer2.Panel2
|
//
|
||||||
//
|
// splitContainer2.Panel2
|
||||||
this.splitContainer2.Panel2.Controls.Add(this.printButton);
|
//
|
||||||
this.splitContainer2.Panel2.Controls.Add(this.closeButton);
|
this.splitContainer2.Panel2.Controls.Add(this.exportButton);
|
||||||
this.splitContainer2.Size = new System.Drawing.Size(572, 85);
|
this.splitContainer2.Panel2.Controls.Add(this.printButton);
|
||||||
this.splitContainer2.SplitterDistance = 249;
|
this.splitContainer2.Panel2.Controls.Add(this.closeButton);
|
||||||
this.splitContainer2.TabIndex = 0;
|
this.splitContainer2.Size = new System.Drawing.Size(572, 85);
|
||||||
//
|
this.splitContainer2.SplitterDistance = 249;
|
||||||
// printButton
|
this.splitContainer2.TabIndex = 0;
|
||||||
//
|
//
|
||||||
this.printButton.Location = new System.Drawing.Point(38, 22);
|
// printButton
|
||||||
this.printButton.Name = "printButton";
|
//
|
||||||
this.printButton.Size = new System.Drawing.Size(108, 41);
|
this.printButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.printButton.TabIndex = 0;
|
this.printButton.Location = new System.Drawing.Point(4, 21);
|
||||||
this.printButton.Text = "Print";
|
this.printButton.Name = "printButton";
|
||||||
this.printButton.UseVisualStyleBackColor = true;
|
this.printButton.Size = new System.Drawing.Size(94, 41);
|
||||||
this.printButton.Click += new System.EventHandler(this.printButton_Click);
|
this.printButton.TabIndex = 0;
|
||||||
//
|
this.printButton.Text = "Print";
|
||||||
// closeButton
|
this.printButton.UseVisualStyleBackColor = true;
|
||||||
//
|
this.printButton.Click += new System.EventHandler(this.printButton_Click);
|
||||||
this.closeButton.Location = new System.Drawing.Point(176, 22);
|
//
|
||||||
this.closeButton.Name = "closeButton";
|
// closeButton
|
||||||
this.closeButton.Size = new System.Drawing.Size(108, 41);
|
//
|
||||||
this.closeButton.TabIndex = 1;
|
this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.closeButton.Text = "Close";
|
this.closeButton.Location = new System.Drawing.Point(203, 21);
|
||||||
this.closeButton.UseVisualStyleBackColor = true;
|
this.closeButton.Name = "closeButton";
|
||||||
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
|
this.closeButton.Size = new System.Drawing.Size(94, 41);
|
||||||
//
|
this.closeButton.TabIndex = 2;
|
||||||
// StatisticsDlg
|
this.closeButton.Text = "Close";
|
||||||
//
|
this.closeButton.UseVisualStyleBackColor = true;
|
||||||
this.AcceptButton = this.closeButton;
|
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
//
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
// exportButton
|
||||||
this.ClientSize = new System.Drawing.Size(572, 409);
|
//
|
||||||
this.Controls.Add(this.splitContainer1);
|
this.exportButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.Name = "StatisticsDlg";
|
this.exportButton.Location = new System.Drawing.Point(103, 21);
|
||||||
this.Text = "StatisticsDlg";
|
this.exportButton.Name = "exportButton";
|
||||||
this.Load += new System.EventHandler(this.StatisticsDlg_Load);
|
this.exportButton.Size = new System.Drawing.Size(94, 41);
|
||||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
this.exportButton.TabIndex = 1;
|
||||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
this.exportButton.Text = "Export";
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
this.exportButton.UseVisualStyleBackColor = true;
|
||||||
this.splitContainer1.ResumeLayout(false);
|
this.exportButton.Click += new System.EventHandler(this.exportButton_Click);
|
||||||
this.splitContainer2.Panel2.ResumeLayout(false);
|
//
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
|
// StatisticsDlg
|
||||||
this.splitContainer2.ResumeLayout(false);
|
//
|
||||||
this.ResumeLayout(false);
|
this.AcceptButton = this.closeButton;
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(572, 409);
|
||||||
|
this.Controls.Add(this.splitContainer1);
|
||||||
|
this.Name = "StatisticsDlg";
|
||||||
|
this.Text = "StatisticsDlg";
|
||||||
|
this.Load += new System.EventHandler(this.StatisticsDlg_Load);
|
||||||
|
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||||
|
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||||
|
this.splitContainer1.ResumeLayout(false);
|
||||||
|
this.splitContainer2.Panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
|
||||||
|
this.splitContainer2.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,5 +150,6 @@
|
|||||||
private System.Windows.Forms.SplitContainer splitContainer2;
|
private System.Windows.Forms.SplitContainer splitContainer2;
|
||||||
private System.Windows.Forms.Button closeButton;
|
private System.Windows.Forms.Button closeButton;
|
||||||
private System.Windows.Forms.Button printButton;
|
private System.Windows.Forms.Button printButton;
|
||||||
|
private System.Windows.Forms.Button exportButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ using System.Windows.Forms;
|
|||||||
using Results.Entities;
|
using Results.Entities;
|
||||||
using ResultsBrowser.Resources;
|
using ResultsBrowser.Resources;
|
||||||
using ResultsBrowser.Output.Printers.Statistics;
|
using ResultsBrowser.Output.Printers.Statistics;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace ResultsBrowser.Forms
|
namespace ResultsBrowser.Forms
|
||||||
{
|
{
|
||||||
@@ -217,5 +218,55 @@ namespace ResultsBrowser.Forms
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void exportButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (rowValues == null || columnValues == null || occurances == null) return;
|
||||||
|
|
||||||
|
SaveFileDialog dlg = new SaveFileDialog();
|
||||||
|
dlg.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*";
|
||||||
|
|
||||||
|
if (dlg.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
//IList<MonitoringDB.ItemSpec> items = currentQR.ProjectedItems;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (TextWriter writer = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8))
|
||||||
|
{
|
||||||
|
if (twoDim)
|
||||||
|
{
|
||||||
|
/// Write column headers
|
||||||
|
for (int i = 0; i < columnValues.Count; i++)
|
||||||
|
{
|
||||||
|
writer.Write(string.Format(";\"{0}\"", columnValues[i]));
|
||||||
|
}
|
||||||
|
writer.WriteLine();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writer.WriteLine(string.Format("\"{0}\";\"{1}\"", rowItem.Caption, Strings.Count));
|
||||||
|
}
|
||||||
|
|
||||||
|
int nrColumns = Math.Max(1, columnValues.Count);
|
||||||
|
|
||||||
|
/// Write rows, row header first
|
||||||
|
for (int j = 0; j < rowValues.Count; j++)
|
||||||
|
{
|
||||||
|
writer.Write(string.Format("\"{0}\"", rowValues[j]));
|
||||||
|
for (int i = 0; i < nrColumns; i++)
|
||||||
|
{
|
||||||
|
writer.Write(string.Format(";{0}", occurances[j,i]));
|
||||||
|
}
|
||||||
|
writer.WriteLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
MessageBox.Show(exc.Message, Strings.Error_exporting_results, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Sensus")]
|
[assembly: AssemblyCompany("Sensus")]
|
||||||
[assembly: AssemblyProduct("ResultsBrowser")]
|
[assembly: AssemblyProduct("ResultsBrowser")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2015 - 2017 Sensus Slovensko a.s.")]
|
[assembly: AssemblyCopyright("Copyright © 2015 - 2018 Sensus Slovensko a.s.")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.18.851.0")]
|
[assembly: AssemblyVersion("2.18.856.0")]
|
||||||
[assembly: AssemblyFileVersion("2.18.851.0")]
|
[assembly: AssemblyFileVersion("2.18.856.0")]
|
||||||
|
|||||||
@@ -822,4 +822,7 @@
|
|||||||
<data name="Printing_completed" xml:space="preserve">
|
<data name="Printing_completed" xml:space="preserve">
|
||||||
<value>Printing completed</value>
|
<value>Printing completed</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Error_exporting_results" xml:space="preserve">
|
||||||
|
<value>Error exporting results</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
+9
@@ -1014,6 +1014,15 @@ namespace ResultsBrowser.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Error exporting results.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Error_exporting_results {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Error_exporting_results", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Error loading users from the database:.
|
/// Looks up a localized string similar to Error loading users from the database:.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -344,13 +344,14 @@ namespace ResultsBrowser
|
|||||||
if (waterMeters == null || waterMeters.Count == 0 || items.Count == 0) return;
|
if (waterMeters == null || waterMeters.Count == 0 || items.Count == 0) return;
|
||||||
|
|
||||||
SaveFileDialog dlg = new SaveFileDialog();
|
SaveFileDialog dlg = new SaveFileDialog();
|
||||||
|
dlg.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*";
|
||||||
|
|
||||||
if (dlg.ShowDialog() == DialogResult.OK)
|
if (dlg.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
using (TextWriter writer = new StreamWriter(dlg.FileName))
|
try
|
||||||
{
|
{
|
||||||
try
|
using (TextWriter writer = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < items.Count; i++)
|
for (int i = 0; i < items.Count; i++)
|
||||||
{
|
{
|
||||||
writer.Write(items[i].Caption);
|
writer.Write(items[i].Caption);
|
||||||
@@ -379,14 +380,15 @@ namespace ResultsBrowser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
MessageBox.Show(exc.Message, Strings.Error_displaying_results, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
MessageBox.Show(exc.Message, Strings.Error_exporting_results, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void printQueryResultsBtn_Click(object sender, EventArgs e)
|
private void printQueryResultsBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (waterMeters == null || waterMeters.Count == 0) return;
|
if (waterMeters == null || waterMeters.Count == 0) return;
|
||||||
@@ -470,6 +472,7 @@ namespace ResultsBrowser
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void statisticsBtn_Click(object sender, EventArgs e)
|
private void statisticsBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (waterMeters == null || waterMeters.Count == 0) return;
|
if (waterMeters == null || waterMeters.Count == 0) return;
|
||||||
@@ -494,6 +497,7 @@ namespace ResultsBrowser
|
|||||||
statisticsDlg.ShowDialog();
|
statisticsDlg.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates component factory
|
/// Updates component factory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user