(1) PreviousResultsDlg with filters, (2) Procedure history can be inspected, ver. 2.26.1577
This commit is contained in:
+167
-8
@@ -32,21 +32,42 @@
|
||||
this.closeButton = new System.Windows.Forms.Button();
|
||||
this.previousButton = new System.Windows.Forms.Button();
|
||||
this.nextButton = new System.Windows.Forms.Button();
|
||||
this.vertSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.horizSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.filterGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.procedureTextBox = new System.Windows.Forms.TextBox();
|
||||
this.procedureLabel = new System.Windows.Forms.Label();
|
||||
this.toLabel = new System.Windows.Forms.Label();
|
||||
this.fromLabel = new System.Windows.Forms.Label();
|
||||
this.toDateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||
this.fromDateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||
this.reloadButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.vertSplitContainer)).BeginInit();
|
||||
this.vertSplitContainer.Panel1.SuspendLayout();
|
||||
this.vertSplitContainer.Panel2.SuspendLayout();
|
||||
this.vertSplitContainer.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit();
|
||||
this.horizSplitContainer.Panel1.SuspendLayout();
|
||||
this.horizSplitContainer.Panel2.SuspendLayout();
|
||||
this.horizSplitContainer.SuspendLayout();
|
||||
this.filterGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.AutoScroll = true;
|
||||
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(1073, 897);
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(1060, 828);
|
||||
this.flowLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// closeButton
|
||||
//
|
||||
this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.closeButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.closeButton.Location = new System.Drawing.Point(1079, 12);
|
||||
this.closeButton.Location = new System.Drawing.Point(12, 25);
|
||||
this.closeButton.Name = "closeButton";
|
||||
this.closeButton.Size = new System.Drawing.Size(103, 37);
|
||||
this.closeButton.TabIndex = 1;
|
||||
@@ -56,7 +77,8 @@
|
||||
//
|
||||
// previousButton
|
||||
//
|
||||
this.previousButton.Location = new System.Drawing.Point(1079, 82);
|
||||
this.previousButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.previousButton.Location = new System.Drawing.Point(12, 95);
|
||||
this.previousButton.Name = "previousButton";
|
||||
this.previousButton.Size = new System.Drawing.Size(103, 37);
|
||||
this.previousButton.TabIndex = 2;
|
||||
@@ -66,7 +88,8 @@
|
||||
//
|
||||
// nextButton
|
||||
//
|
||||
this.nextButton.Location = new System.Drawing.Point(1079, 125);
|
||||
this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nextButton.Location = new System.Drawing.Point(12, 138);
|
||||
this.nextButton.Name = "nextButton";
|
||||
this.nextButton.Size = new System.Drawing.Size(103, 37);
|
||||
this.nextButton.TabIndex = 3;
|
||||
@@ -74,22 +97,148 @@
|
||||
this.nextButton.UseVisualStyleBackColor = true;
|
||||
this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
|
||||
//
|
||||
// vertSplitContainer
|
||||
//
|
||||
this.vertSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.vertSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.vertSplitContainer.IsSplitterFixed = true;
|
||||
this.vertSplitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.vertSplitContainer.Name = "vertSplitContainer";
|
||||
//
|
||||
// vertSplitContainer.Panel1
|
||||
//
|
||||
this.vertSplitContainer.Panel1.Controls.Add(this.horizSplitContainer);
|
||||
//
|
||||
// vertSplitContainer.Panel2
|
||||
//
|
||||
this.vertSplitContainer.Panel2.Controls.Add(this.closeButton);
|
||||
this.vertSplitContainer.Panel2.Controls.Add(this.nextButton);
|
||||
this.vertSplitContainer.Panel2.Controls.Add(this.previousButton);
|
||||
this.vertSplitContainer.Size = new System.Drawing.Size(1194, 892);
|
||||
this.vertSplitContainer.SplitterDistance = 1060;
|
||||
this.vertSplitContainer.TabIndex = 4;
|
||||
//
|
||||
// horizSplitContainer
|
||||
//
|
||||
this.horizSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.horizSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.horizSplitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.horizSplitContainer.Name = "horizSplitContainer";
|
||||
this.horizSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// horizSplitContainer.Panel1
|
||||
//
|
||||
this.horizSplitContainer.Panel1.Controls.Add(this.filterGroupBox);
|
||||
//
|
||||
// horizSplitContainer.Panel2
|
||||
//
|
||||
this.horizSplitContainer.Panel2.Controls.Add(this.flowLayoutPanel1);
|
||||
this.horizSplitContainer.Size = new System.Drawing.Size(1060, 892);
|
||||
this.horizSplitContainer.SplitterDistance = 60;
|
||||
this.horizSplitContainer.TabIndex = 0;
|
||||
//
|
||||
// filterGroupBox
|
||||
//
|
||||
this.filterGroupBox.Controls.Add(this.reloadButton);
|
||||
this.filterGroupBox.Controls.Add(this.procedureTextBox);
|
||||
this.filterGroupBox.Controls.Add(this.procedureLabel);
|
||||
this.filterGroupBox.Controls.Add(this.toLabel);
|
||||
this.filterGroupBox.Controls.Add(this.fromLabel);
|
||||
this.filterGroupBox.Controls.Add(this.toDateTimePicker);
|
||||
this.filterGroupBox.Controls.Add(this.fromDateTimePicker);
|
||||
this.filterGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.filterGroupBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.filterGroupBox.Name = "filterGroupBox";
|
||||
this.filterGroupBox.Size = new System.Drawing.Size(1060, 60);
|
||||
this.filterGroupBox.TabIndex = 0;
|
||||
this.filterGroupBox.TabStop = false;
|
||||
this.filterGroupBox.Text = "Filter";
|
||||
//
|
||||
// procedureTextBox
|
||||
//
|
||||
this.procedureTextBox.Location = new System.Drawing.Point(460, 25);
|
||||
this.procedureTextBox.Name = "procedureTextBox";
|
||||
this.procedureTextBox.Size = new System.Drawing.Size(523, 20);
|
||||
this.procedureTextBox.TabIndex = 22;
|
||||
//
|
||||
// procedureLabel
|
||||
//
|
||||
this.procedureLabel.AutoSize = true;
|
||||
this.procedureLabel.Location = new System.Drawing.Point(378, 30);
|
||||
this.procedureLabel.Name = "procedureLabel";
|
||||
this.procedureLabel.Size = new System.Drawing.Size(56, 13);
|
||||
this.procedureLabel.TabIndex = 21;
|
||||
this.procedureLabel.Text = "Procedure";
|
||||
//
|
||||
// toLabel
|
||||
//
|
||||
this.toLabel.AutoSize = true;
|
||||
this.toLabel.Location = new System.Drawing.Point(216, 31);
|
||||
this.toLabel.Name = "toLabel";
|
||||
this.toLabel.Size = new System.Drawing.Size(16, 13);
|
||||
this.toLabel.TabIndex = 20;
|
||||
this.toLabel.Text = "to";
|
||||
//
|
||||
// fromLabel
|
||||
//
|
||||
this.fromLabel.AutoSize = true;
|
||||
this.fromLabel.Location = new System.Drawing.Point(44, 31);
|
||||
this.fromLabel.Name = "fromLabel";
|
||||
this.fromLabel.Size = new System.Drawing.Size(27, 13);
|
||||
this.fromLabel.TabIndex = 19;
|
||||
this.fromLabel.Text = "from";
|
||||
//
|
||||
// toDateTimePicker
|
||||
//
|
||||
this.toDateTimePicker.CustomFormat = "dd.MM.yyyy";
|
||||
this.toDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
|
||||
this.toDateTimePicker.Location = new System.Drawing.Point(252, 25);
|
||||
this.toDateTimePicker.Name = "toDateTimePicker";
|
||||
this.toDateTimePicker.Size = new System.Drawing.Size(82, 20);
|
||||
this.toDateTimePicker.TabIndex = 18;
|
||||
//
|
||||
// fromDateTimePicker
|
||||
//
|
||||
this.fromDateTimePicker.CustomFormat = "dd.MM.yyyy";
|
||||
this.fromDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
|
||||
this.fromDateTimePicker.Location = new System.Drawing.Point(89, 25);
|
||||
this.fromDateTimePicker.Name = "fromDateTimePicker";
|
||||
this.fromDateTimePicker.Size = new System.Drawing.Size(82, 20);
|
||||
this.fromDateTimePicker.TabIndex = 17;
|
||||
//
|
||||
// reloadButton
|
||||
//
|
||||
this.reloadButton.Location = new System.Drawing.Point(1005, 23);
|
||||
this.reloadButton.Name = "reloadButton";
|
||||
this.reloadButton.Size = new System.Drawing.Size(37, 23);
|
||||
this.reloadButton.TabIndex = 0;
|
||||
this.reloadButton.Text = "@";
|
||||
this.reloadButton.UseVisualStyleBackColor = true;
|
||||
this.reloadButton.Click += new System.EventHandler(this.reloadButton_Click);
|
||||
//
|
||||
// PreviousResultsDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.closeButton;
|
||||
this.ClientSize = new System.Drawing.Size(1194, 892);
|
||||
this.Controls.Add(this.nextButton);
|
||||
this.Controls.Add(this.previousButton);
|
||||
this.Controls.Add(this.closeButton);
|
||||
this.Controls.Add(this.flowLayoutPanel1);
|
||||
this.Controls.Add(this.vertSplitContainer);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "PreviousResultsDlg";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Text = "Previous results";
|
||||
this.Load += new System.EventHandler(this.PreviousResultsDlg_Load);
|
||||
this.vertSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.vertSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.vertSplitContainer)).EndInit();
|
||||
this.vertSplitContainer.ResumeLayout(false);
|
||||
this.horizSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.horizSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).EndInit();
|
||||
this.horizSplitContainer.ResumeLayout(false);
|
||||
this.filterGroupBox.ResumeLayout(false);
|
||||
this.filterGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -100,5 +249,15 @@
|
||||
private System.Windows.Forms.Button closeButton;
|
||||
private System.Windows.Forms.Button previousButton;
|
||||
private System.Windows.Forms.Button nextButton;
|
||||
private System.Windows.Forms.SplitContainer vertSplitContainer;
|
||||
private System.Windows.Forms.SplitContainer horizSplitContainer;
|
||||
private System.Windows.Forms.GroupBox filterGroupBox;
|
||||
private System.Windows.Forms.Label toLabel;
|
||||
private System.Windows.Forms.Label fromLabel;
|
||||
private System.Windows.Forms.DateTimePicker toDateTimePicker;
|
||||
private System.Windows.Forms.DateTimePicker fromDateTimePicker;
|
||||
private System.Windows.Forms.Label procedureLabel;
|
||||
private System.Windows.Forms.TextBox procedureTextBox;
|
||||
private System.Windows.Forms.Button reloadButton;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2017 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -9,8 +9,8 @@ using log4net;
|
||||
using Oracle.DataAccess.Client;
|
||||
using Results;
|
||||
using Results.Entities;
|
||||
using TBF.Resources;
|
||||
using TBF.BenchControl.Output.DB.SensusOracle;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.UI.ResultsMI
|
||||
{
|
||||
@@ -27,9 +27,11 @@ namespace TBF.UI.ResultsMI
|
||||
|
||||
ISession session;
|
||||
int currentBatchNr;
|
||||
int lastDisplayedBatchNr;
|
||||
const int LinesCount = 25;
|
||||
IList<Batch> batches;
|
||||
|
||||
IList<Batch> batches; /// A list of batches selected from all batches using criteria from/to date and procedure name
|
||||
int lastDisplayedIx; /// Index of the last displayed batch from the list 'batches'
|
||||
const int LinesCount = 25; /// Number of batches displayed on one screen
|
||||
|
||||
PreviousResultsMode mode;
|
||||
|
||||
|
||||
@@ -62,11 +64,31 @@ namespace TBF.UI.ResultsMI
|
||||
{
|
||||
Localize();
|
||||
|
||||
session = DB.CreateSession();
|
||||
fromDateTimePicker.MinDate = Constants.MinDate;
|
||||
fromDateTimePicker.MaxDate = DateTime.Today;
|
||||
fromDateTimePicker.Value = Constants.MinDate;
|
||||
fromDateTimePicker.CustomFormat = Constants.DateFormat;
|
||||
fromDateTimePicker.ShowUpDown = true;
|
||||
|
||||
lastDisplayedBatchNr = currentBatchNr - 1;
|
||||
DrawBatches(lastDisplayedBatchNr - LinesCount + 1, lastDisplayedBatchNr);
|
||||
toDateTimePicker.MinDate = Constants.MinDate;
|
||||
toDateTimePicker.MaxDate = DateTime.Today;
|
||||
toDateTimePicker.Value = DateTime.Today;
|
||||
toDateTimePicker.CustomFormat = Constants.DateFormat;
|
||||
toDateTimePicker.ShowUpDown = true;
|
||||
|
||||
try
|
||||
{
|
||||
session = DB.CreateSession();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
session = null;
|
||||
log.ErrorFormat("Opening Results DB failed: {0}", exc.Message);
|
||||
}
|
||||
|
||||
var batches = GetFilteredBatches();
|
||||
UpdateButtons();
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void Localize()
|
||||
@@ -75,10 +97,44 @@ namespace TBF.UI.ResultsMI
|
||||
closeButton.Text = TBF.Resources.Strings.CloseBtnText;
|
||||
previousButton.Text = TBF.Resources.Strings.Previous;
|
||||
nextButton.Text = TBF.Resources.Strings.Next;
|
||||
fromLabel.Text = Strings.from;
|
||||
toLabel.Text = Strings.to;
|
||||
procedureLabel.Text = Strings.Procedure;
|
||||
}
|
||||
|
||||
IList<Batch> GetFilteredBatches()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(procedureTextBox.Text))
|
||||
{
|
||||
batches = session.QueryOver<Batch>()
|
||||
.Where(x => (x.StartTime >= fromDateTimePicker.Value))
|
||||
.And(x => (x.StartTime <= toDateTimePicker.Value.AddDays(1)))
|
||||
.OrderBy(x => x.BatchNr).Asc
|
||||
.List();
|
||||
}
|
||||
else
|
||||
{
|
||||
batches = session.QueryOver<Batch>()
|
||||
.Where(x => (x.ProcedureName == procedureTextBox.Text))
|
||||
.And(x => (x.StartTime >= fromDateTimePicker.Value))
|
||||
.And(x => (x.StartTime <= toDateTimePicker.Value.AddDays(1)))
|
||||
.OrderBy(x => x.BatchNr).Asc
|
||||
.List();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
batches = new List<Batch>();
|
||||
log.ErrorFormat("Reading batches from Results DB failed: {0}", exc.Message);
|
||||
}
|
||||
|
||||
lastDisplayedIx = batches.Count - 1;
|
||||
|
||||
return batches;
|
||||
}
|
||||
|
||||
|
||||
public void OnReload(object sender, PreviousResultIdEventArgs data)
|
||||
{
|
||||
foreach (var batch in batches)
|
||||
@@ -318,10 +374,11 @@ namespace TBF.UI.ResultsMI
|
||||
|
||||
if (batches == null || batches.Count == 0) return;
|
||||
|
||||
foreach (var b in batches)
|
||||
{
|
||||
for (int i = Math.Max(0, lastDisplayedIx - LinesCount + 1); i <= lastDisplayedIx; i++)
|
||||
{
|
||||
var b = batches[i];
|
||||
int passedCount = 0;
|
||||
int failedCount = 0;
|
||||
int failedCount = 0;
|
||||
foreach (var wm in b.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && wm.Passed) { passedCount++; } else { failedCount++; }
|
||||
@@ -340,7 +397,7 @@ namespace TBF.UI.ResultsMI
|
||||
failedCount,
|
||||
b.RsltsSent,
|
||||
mode));
|
||||
}
|
||||
}
|
||||
|
||||
ResumeLayout();
|
||||
}
|
||||
@@ -354,22 +411,29 @@ namespace TBF.UI.ResultsMI
|
||||
|
||||
private void previousButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
lastDisplayedBatchNr = Math.Max(lastDisplayedBatchNr - LinesCount, LinesCount);
|
||||
DrawBatches(lastDisplayedBatchNr - LinesCount + 1, lastDisplayedBatchNr);
|
||||
lastDisplayedIx = Math.Max(lastDisplayedIx - LinesCount, LinesCount - 1);
|
||||
Redraw();
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
private void nextButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
lastDisplayedBatchNr = Math.Min(lastDisplayedBatchNr + LinesCount, currentBatchNr - 1);
|
||||
DrawBatches(lastDisplayedBatchNr - LinesCount + 1, lastDisplayedBatchNr);
|
||||
lastDisplayedIx = Math.Min(lastDisplayedIx + LinesCount, batches.Count - 1);
|
||||
Redraw();
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
private void UpdateButtons()
|
||||
{
|
||||
nextButton.Enabled = (lastDisplayedBatchNr < currentBatchNr - 1);
|
||||
previousButton.Enabled = (lastDisplayedBatchNr > LinesCount);
|
||||
nextButton.Enabled = (lastDisplayedIx < batches.Count - 1);
|
||||
previousButton.Enabled = (lastDisplayedIx > LinesCount - 1);
|
||||
}
|
||||
|
||||
private void reloadButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
batches = GetFilteredBatches();
|
||||
UpdateButtons();
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user