Sensus Oracle Database support (stub) added, version 1.5.85

This commit is contained in:
Milan Hanajik 2015-08-19 14:17:02 +02:00
parent 33963ec8cf
commit 3ebeb4a0dc
9 changed files with 1033 additions and 2 deletions

View File

@ -0,0 +1,461 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Author: Milan Hanajík
///
using System;
using System.Collections.Generic;
using System.IO;
using log4net;
using TBF.BenchControl;
using TBF.Resources;
namespace TBF.BenchControl.DB.SensusOracle
{
public class Database : ComponentBase, IOperation, GenericDevices.IResultsWriter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Database));
public override string ToString() { return string.Format("ResultsWriters.Basic({0})", Cfg.ToString(1)); }
readonly DatabaseCfg writerCfg;
/// <summary>
/// Result items to print
/// </summary>
IList<TBF.Forms.ResultItemSpec> resultItems;
bool combined;
/// <summary>
/// Results to print
/// </summary>
Entities.Procedure procedure;
IList<Entities.TestResult> unsortedResults;
DateTime dateTime;
StreamWriter writer;
string separatorStr;
public Database()
{
}
public Database(DatabaseCfg cfg)
: base(cfg)
{
writerCfg = cfg;
switch (cfg.Separator)
{
default:
case Separator.None:
separatorStr = string.Empty;
break;
case Separator.Space:
separatorStr = " ";
break;
case Separator.Tabulator:
separatorStr = "\t";
break;
case Separator.Comma:
separatorStr = ",";
break;
case Separator.Semicolon:
separatorStr = ";";
break;
}
log.Debug(this.ToString());
}
/// <summary>
/// Eliminate spaces conditionally, depesing on bool WriterCfg.EliminateSpaces
/// </summary>
/// <param name="item">Input string</param>
/// <returns>Output string</returns>
string ElSpaces(string item)
{
if (writerCfg.EliminateSpaces)
return item.Replace(" ", string.Empty);
else
return item;
}
/// <summary>
/// Returns a file name derived from a DateTime structure.
/// Creates directories on this path as a side effect.
/// </summary>
/// <param name="time">Date and time</param>
/// <returns>File name</returns>
string GetFilename(DateTime time)
{
string directory = writerCfg.DestinationPath; /// Ends with "\\";
Directory.CreateDirectory(directory);
if (writerCfg.YearFolders)
{
directory = string.Format("{0}{1}\\", directory, time.Year.ToString());
Directory.CreateDirectory(directory);
}
if (writerCfg.MonthFolders)
{
string monthStr /* = now.Month.ToString("D2")*/;
switch (time.Month)
{
default:
case 1: monthStr = "January"; break;
case 2: monthStr = "February"; break;
case 3: monthStr = "March"; break;
case 4: monthStr = "April"; break;
case 5: monthStr = "May"; break;
case 6: monthStr = "June"; break;
case 7: monthStr = "July"; break;
case 8: monthStr = "August"; break;
case 9: monthStr = "September"; break;
case 10: monthStr = "October"; break;
case 11: monthStr = "November"; break;
case 12: monthStr = "December"; break;
}
directory = string.Format("{0}{1}\\", directory, monthStr);
Directory.CreateDirectory(directory);
}
if (writerCfg.DayFolders)
{
directory = string.Format("{0}{1}\\", directory, time.Day.ToString("D2"));
Directory.CreateDirectory(directory);
}
return string.Format("{0}{1}{2}{3}-{4}{5}.txt", directory, (time.Year % 100).ToString("D2"),
time.Month.ToString("D2"), time.Day.ToString("D2"), time.Hour.ToString("D2"), time.Minute.ToString("D2"));
}
/// <summary>
/// Writes the test cycle results into a file, Events: Event.ResultsWritten
/// </summary>
/// <param name="procedure">Procedure to print the results of</param>
/// <param name="unsortedResults">Results to write into the file</param>
/// <returns>Reference to the operation</returns>
public IOperation WriteResultsOp(Entities.Procedure procedure, IList<Entities.TestResult> unsortedResults)
{
if ((procedure == null) || (unsortedResults == null) || (unsortedResults.Count < 1))
{
return null;
}
this.procedure = procedure;
this.unsortedResults = unsortedResults;
combined = (procedure.MetersKind == Entities.MetersKind.Combined);
if (combined)
{
resultItems = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_CombinedWM);
}
else
{
resultItems = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_SingleWM);
}
try
{
dateTime = DateTime.Now;
writer = new StreamWriter(System.IO.File.Create(GetFilename(dateTime)));
}
catch
{
writer = null;
}
return this;
}
/// <summary>Start this operation</summary>
public void Start()
{
if (writer == null) return;
///----------
/// Header
///----------
writer.WriteLine(unsortedResults[0].ProtocolTitle);
writer.WriteLine(string.Empty);
string[] leftColumn = new string[]
{
"Batch number: ",
"Date and time: ",
"Procedure:",
Strings.User_,
"Ambient temperature: ",
"Ambient pressure: ",
"Ambient humidity: ",
};
string[] rightColumn = new string[]
{
unsortedResults[0].BatchNr.ToString(),
//dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(),
string.Format("{0}.{1}.{2} {3}:{4}", dateTime.Year.ToString("D4"),
dateTime.Month.ToString("D2"),
dateTime.Day.ToString("D2"),
dateTime.Hour.ToString("D2"),
dateTime.Minute.ToString("D2")),
procedure.Name,
Entities.User.CurrentUser.Name,
unsortedResults[0].AmbientTempAve.ToString("F1") + " °C",
unsortedResults[0].AmbientPressAve.ToString("F0") + " mbar",
unsortedResults[0].AmbientHumiAve.ToString("F0") + " %",
};
/// Determine max. left column width in characters
int maxLen = 0;
foreach (var s in leftColumn) if (s.Length > maxLen) maxLen = s.Length;
/// Write aligned columns
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
{
writer.Write(leftColumn[i]);
writer.Write(new string(' ', maxLen - leftColumn[i].Length + 3));
writer.WriteLine(rightColumn[i]);
}
writer.WriteLine(string.Empty);
///--------
/// Body
///--------
if (combined)
{
for (int wmNr = 0; wmNr < Program.CompoundWMsCount; wmNr++) WriteCombinedWM(wmNr + 1); /// wmNr is 0-based
}
else
{
for (int wmNr = 0; wmNr < Program.WMsCount; wmNr++) /// wmNr is 0-based
{
if (!unsortedResults[0].Meters[wmNr].Disabled)
WriteSingleWM(wmNr, wmNr + 1);
}
}
}
/// <summary>
/// Write one water meter results
/// </summary>
/// <param name="wmNr">Water meter number (0-based)</param>
void WriteSingleWM(int wmNr, int printedWMNr)
{
IList<Entities.TestResult> results = Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr + 1, combined));
/// Determine column widths
int[] columnWidths = new int[resultItems.Count];
int totalWidth = 0;
for (int i = 0; i < resultItems.Count; i++)
{
columnWidths[i] = ElSpaces(resultItems[i].ClmnHeaderText).Length;
foreach (var tr in results)
{
if (tr != null)
{
string text = resultItems[i].Print(tr.Meters[wmNr]);
/// Get rid of the color information
string[] texts = text.Split(new char[] { '|' });
if (texts.Length == 2) { text = texts[0]; }
int len = ElSpaces(text).Length;
if (len > columnWidths[i]) columnWidths[i] = len;
}
}
totalWidth += columnWidths[i];
}
totalWidth += 3 * (resultItems.Count - 1);
/// Write water meter number and s/n
writer.Write(string.Format("Water meter {0}", printedWMNr));
if (!string.IsNullOrEmpty(unsortedResults[0].Meters[wmNr].SerialNr))
{
writer.Write(string.Format(" s/n: {0}", unsortedResults[0].Meters[wmNr].SerialNr));
}
writer.WriteLine(string.Empty);
writer.WriteLine(new String('-', totalWidth)); /// Horizontal line above the header
/// Write column headers
for (int i = 0; i < resultItems.Count; i++)
{
writer.Write(ElSpaces(resultItems[i].ClmnHeaderText));
if (i < resultItems.Count - 1)
{
if (!writerCfg.EliminateSpaces)
{
writer.Write(new string(' ', columnWidths[i] - resultItems[i].ClmnHeaderText.Length + 3));
}
writer.Write(separatorStr);
}
else
{
writer.WriteLine(string.Empty);
}
}
writer.WriteLine(new String('-', totalWidth)); /// Horizontal line between the header and the body
/// Write table data
foreach (var tr in results)
{
if (tr != null)
{
for (int i = 0; i < resultItems.Count; i++)
{
string text = resultItems[i].Print(tr.Meters[wmNr]);
/// Get rid of the color information
string[] texts = text.Split(new char[] { '|' });
if (texts.Length == 2) { text = texts[0]; }
writer.Write(ElSpaces(text));
if (i < resultItems.Count - 1)
{
if (!writerCfg.EliminateSpaces)
{
writer.Write(new string(' ', columnWidths[i] - text.Length + 3));
}
writer.Write(separatorStr);
}
else
{
writer.WriteLine(string.Empty);
}
}
}
}
writer.WriteLine(new String('-', totalWidth)); /// Horizontal line below the body
writer.WriteLine(string.Empty);
}
/// <summary>
/// Write one combined water meter results
/// </summary>
/// <param name="wmNr1">Combined water meter number (1-based)</param>
void WriteCombinedWM(int wmNr1)
{
IList<Entities.TestResult> results = Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr1, combined));
/// Determin column widths
int[] columnWidths = new int[resultItems.Count];
int totalWidth = 0;
for (int i = 0; i < resultItems.Count; i++)
{
columnWidths[i] = ElSpaces(resultItems[i].ClmnHeaderText).Length;
foreach (var tr in results)
{
if (tr != null)
{
string text = resultItems[i].PrintCombined(tr.Meters[2 * wmNr1 - 2], tr.Meters[2 * wmNr1 - 1], tr.CombinedMeters[wmNr1 - 1]);
int len = ElSpaces(text).Length;
if (len > columnWidths[i]) columnWidths[i] = len;
}
}
totalWidth += columnWidths[i];
}
totalWidth += 3 * (resultItems.Count - 1);
/// Write water meter number and two s/n-s
writer.Write(string.Format("Water meter {0}", wmNr1));
if (!string.IsNullOrEmpty(unsortedResults[0].Meters[2 * wmNr1 - 2].SerialNr))
{
writer.Write(string.Format(", Main s/n: {0}", unsortedResults[0].Meters[2 * wmNr1 - 2].SerialNr));
}
if (!string.IsNullOrEmpty(unsortedResults[0].Meters[2 * wmNr1 - 1].SerialNr))
{
writer.Write(string.Format(", Aux. s/n:{0}", unsortedResults[0].Meters[2 * wmNr1 - 1].SerialNr));
}
writer.WriteLine(string.Empty);
writer.WriteLine(new String('-', totalWidth)); /// Horizontal line above the header
for (int i = 0; i < resultItems.Count; i++)
{
writer.Write(ElSpaces(resultItems[i].ClmnHeaderText));
if (i < resultItems.Count - 1)
{
if (!writerCfg.EliminateSpaces)
{
writer.Write(new string(' ', columnWidths[i] - resultItems[i].ClmnHeaderText.Length + 3));
}
writer.Write(separatorStr);
}
else
{
writer.WriteLine(string.Empty);
}
}
writer.WriteLine(new String('-', totalWidth)); /// Horizontal line between the header and the body
foreach (var tr in results)
{
if (tr != null)
{
for (int i = 0; i < resultItems.Count; i++)
{
string text = resultItems[i].PrintCombined(tr.Meters[2 * wmNr1 - 2], tr.Meters[2 * wmNr1 - 1], tr.CombinedMeters[wmNr1 - 1]);
/// Get rid of the color information
string[] texts = text.Split(new char[] { '|' });
if (texts.Length == 2) { text = texts[0]; }
writer.Write(ElSpaces(text));
if (i < resultItems.Count - 1)
{
if (!writerCfg.EliminateSpaces)
{
writer.Write(new string(' ', columnWidths[i] - text.Length + 3));
}
writer.Write(separatorStr);
}
else
{
writer.WriteLine(string.Empty);
}
}
}
}
writer.WriteLine(new String('-', totalWidth)); /// Horizontal line below the body
writer.WriteLine(string.Empty);
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsWritten</returns>
public Event Run()
{
return Event.ResultsWritten;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (writer != null) writer.Close();
writer = null;
}
}
}

View File

@ -0,0 +1,68 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Author: Milan Hanajík
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DB.SensusOracle
{
public enum Separator
{
None,
Space,
Tabulator,
Comma,
Semicolon,
Count
}
public class DatabaseCfg : ComponentCfgBase, Generic.IComponentCfg
{
public IComponent GetComponent(IList<IComponent> components) { return new Database(this); }
public IComponentCfgCtrl GetControl() { return new DatabaseCfgCtrl(); }
public string DestinationPath; /// Directory path into which the results will be saved
public bool YearFolders;
public bool MonthFolders;
public bool DayFolders;
public Separator Separator;
public bool EliminateSpaces;
/// Private parameterless constructor invoked by all other (public) constructors
DatabaseCfg()
{
Name = "Sensus-Oracle-Database";
ParentName = string.Empty;
DestinationPath = Program.HomeDir + "Results\\";
YearFolders = true;
MonthFolders = true;
DayFolders = false;
Separator = Separator.None;
EliminateSpaces = false;
}
public DatabaseCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}, Path={1}, Y={2}, M={3}, D={4}, Elim.Spaces={5}, Separator={6}",
Name,
DestinationPath,
YearFolders,
MonthFolders,
DayFolders,
EliminateSpaces,
Separator);
}
}
}

View File

@ -0,0 +1,137 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Author: Milan Hanajík
///
using System;
using System.Windows.Forms;
using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DB.SensusOracle
{
public partial class DatabaseCfgCtrl : UserControl, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(DatabaseCfgCtrl));
public bool ShowMore { get { return false; } }
DatabaseCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as DatabaseCfg;
Redraw();
}
}
public DatabaseCfgCtrl()
{
InitializeComponent();
}
private void WriterCfgCtrl_Load(object sender, EventArgs e)
{
for (int i = 0; i < (int)Separator.Count; i++)
{
separatorComboBox.Items.Add(((Separator)i).ToString());
}
Redraw();
}
public void Closing()
{
}
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
destinationTextBox.Text = config.DestinationPath;
yearFoldersCheckBox.Checked = config.YearFolders;
monthFoldersCheckBox.Checked = config.MonthFolders;
dayFoldersCheckBox.Checked = config.DayFolders;
separatorComboBox.Text = config.Separator.ToString();
eliminateSpacesCheckBox.Checked = config.EliminateSpaces;
}
public void Unlock()
{
nameTextBox.Enabled = true;
destinationTextBox.Enabled = true;
destinationButton.Enabled = true;
yearFoldersCheckBox.Enabled = true;
monthFoldersCheckBox.Enabled = true;
dayFoldersCheckBox.Enabled = true;
separatorComboBox.Enabled = true;
eliminateSpacesCheckBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!separatorComboBox.Items.Contains(separatorComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid separator";
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
if (config.Name != nameTextBox.Text) { config.Name = nameTextBox.Text; flags = CfgUpdateFlags.RestartRqrd; }
if (config.DestinationPath != destinationTextBox.Text)
{
config.DestinationPath = destinationTextBox.Text;
if (!config.DestinationPath.EndsWith("\\")) config.DestinationPath += "\\";
flags = CfgUpdateFlags.RestartRqrd;
}
if (yearFoldersCheckBox.Checked != config.YearFolders)
{
config.YearFolders = yearFoldersCheckBox.Checked;
flags = CfgUpdateFlags.RestartRqrd;
}
if (monthFoldersCheckBox.Checked != config.MonthFolders)
{
config.MonthFolders = monthFoldersCheckBox.Checked;
flags = CfgUpdateFlags.RestartRqrd;
}
if (dayFoldersCheckBox.Checked != config.DayFolders)
{
config.DayFolders = dayFoldersCheckBox.Checked;
flags = CfgUpdateFlags.RestartRqrd;
}
for (int i = 0; i < (int)Separator.Count; i++)
{
if (((Separator)i).ToString().Equals(separatorComboBox.Text))
{
config.Separator = (Separator)i;
}
}
if (eliminateSpacesCheckBox.Checked != config.EliminateSpaces)
{
config.EliminateSpaces = eliminateSpacesCheckBox.Checked;
flags = CfgUpdateFlags.RestartRqrd;
}
return flags;
}
private void destinationButton_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -0,0 +1,204 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Author: Milan Hanajík
///
namespace TBF.BenchControl.DB.SensusOracle
{
partial class DatabaseCfgCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.destinationTextBox = new System.Windows.Forms.TextBox();
this.destinationLabel = new System.Windows.Forms.Label();
this.dayFoldersCheckBox = new System.Windows.Forms.CheckBox();
this.destinationButton = new System.Windows.Forms.Button();
this.yearFoldersCheckBox = new System.Windows.Forms.CheckBox();
this.monthFoldersCheckBox = new System.Windows.Forms.CheckBox();
this.eliminateSpacesCheckBox = new System.Windows.Forms.CheckBox();
this.separatorLabel = new System.Windows.Forms.Label();
this.separatorComboBox = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(110, 39);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(19, 42);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(107, 15);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// destinationTextBox
//
this.destinationTextBox.Enabled = false;
this.destinationTextBox.Location = new System.Drawing.Point(110, 65);
this.destinationTextBox.Name = "destinationTextBox";
this.destinationTextBox.Size = new System.Drawing.Size(146, 20);
this.destinationTextBox.TabIndex = 4;
//
// destinationLabel
//
this.destinationLabel.AutoSize = true;
this.destinationLabel.Location = new System.Drawing.Point(19, 68);
this.destinationLabel.Name = "destinationLabel";
this.destinationLabel.Size = new System.Drawing.Size(60, 13);
this.destinationLabel.TabIndex = 3;
this.destinationLabel.Text = "Destination";
//
// dayFoldersCheckBox
//
this.dayFoldersCheckBox.AutoSize = true;
this.dayFoldersCheckBox.Enabled = false;
this.dayFoldersCheckBox.Location = new System.Drawing.Point(111, 136);
this.dayFoldersCheckBox.Name = "dayFoldersCheckBox";
this.dayFoldersCheckBox.Size = new System.Drawing.Size(79, 17);
this.dayFoldersCheckBox.TabIndex = 8;
this.dayFoldersCheckBox.Text = "Day folders";
this.dayFoldersCheckBox.UseVisualStyleBackColor = true;
//
// destinationButton
//
this.destinationButton.Enabled = false;
this.destinationButton.Location = new System.Drawing.Point(261, 65);
this.destinationButton.Name = "destinationButton";
this.destinationButton.Size = new System.Drawing.Size(30, 20);
this.destinationButton.TabIndex = 5;
this.destinationButton.Text = "...";
this.destinationButton.UseVisualStyleBackColor = true;
this.destinationButton.Click += new System.EventHandler(this.destinationButton_Click);
//
// yearFoldersCheckBox
//
this.yearFoldersCheckBox.AutoSize = true;
this.yearFoldersCheckBox.Enabled = false;
this.yearFoldersCheckBox.Location = new System.Drawing.Point(111, 94);
this.yearFoldersCheckBox.Name = "yearFoldersCheckBox";
this.yearFoldersCheckBox.Size = new System.Drawing.Size(82, 17);
this.yearFoldersCheckBox.TabIndex = 6;
this.yearFoldersCheckBox.Text = "Year folders";
this.yearFoldersCheckBox.UseVisualStyleBackColor = true;
//
// monthFoldersCheckBox
//
this.monthFoldersCheckBox.AutoSize = true;
this.monthFoldersCheckBox.Enabled = false;
this.monthFoldersCheckBox.Location = new System.Drawing.Point(111, 115);
this.monthFoldersCheckBox.Name = "monthFoldersCheckBox";
this.monthFoldersCheckBox.Size = new System.Drawing.Size(90, 17);
this.monthFoldersCheckBox.TabIndex = 7;
this.monthFoldersCheckBox.Text = "Month folders";
this.monthFoldersCheckBox.UseVisualStyleBackColor = true;
//
// eliminateSpacesCheckBox
//
this.eliminateSpacesCheckBox.AutoSize = true;
this.eliminateSpacesCheckBox.Enabled = false;
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(111, 194);
this.eliminateSpacesCheckBox.Name = "eliminateSpacesCheckBox";
this.eliminateSpacesCheckBox.Size = new System.Drawing.Size(165, 17);
this.eliminateSpacesCheckBox.TabIndex = 11;
this.eliminateSpacesCheckBox.Text = "Eliminate spaces in each field";
this.eliminateSpacesCheckBox.UseVisualStyleBackColor = true;
//
// separatorLabel
//
this.separatorLabel.AutoSize = true;
this.separatorLabel.Location = new System.Drawing.Point(19, 168);
this.separatorLabel.Name = "separatorLabel";
this.separatorLabel.Size = new System.Drawing.Size(53, 13);
this.separatorLabel.TabIndex = 9;
this.separatorLabel.Text = "Separator";
//
// separatorComboBox
//
this.separatorComboBox.Enabled = false;
this.separatorComboBox.FormattingEnabled = true;
this.separatorComboBox.Location = new System.Drawing.Point(110, 165);
this.separatorComboBox.Name = "separatorComboBox";
this.separatorComboBox.Size = new System.Drawing.Size(146, 21);
this.separatorComboBox.TabIndex = 10;
//
// WriterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.separatorComboBox);
this.Controls.Add(this.separatorLabel);
this.Controls.Add(this.eliminateSpacesCheckBox);
this.Controls.Add(this.monthFoldersCheckBox);
this.Controls.Add(this.yearFoldersCheckBox);
this.Controls.Add(this.destinationButton);
this.Controls.Add(this.dayFoldersCheckBox);
this.Controls.Add(this.destinationTextBox);
this.Controls.Add(this.destinationLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "WriterCfgCtrl";
this.Size = new System.Drawing.Size(300, 230);
this.Load += new System.EventHandler(this.WriterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.TextBox destinationTextBox;
private System.Windows.Forms.Label destinationLabel;
private System.Windows.Forms.CheckBox dayFoldersCheckBox;
private System.Windows.Forms.Button destinationButton;
private System.Windows.Forms.CheckBox yearFoldersCheckBox;
private System.Windows.Forms.CheckBox monthFoldersCheckBox;
private System.Windows.Forms.CheckBox eliminateSpacesCheckBox;
private System.Windows.Forms.Label separatorLabel;
private System.Windows.Forms.ComboBox separatorComboBox;
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,24 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Author: Milan Hanajík
///
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DB.SensusOracle
{
public class DatabaseFactory : IComponentFactory
{
public string ClassName { get { return "Sensus-Oracle-Database"; } }
public void ResetStaticProperties() { Database.ResetStaticProperties(); }
public IComponent DummyComponent() { return new Database(); }
public IComponentCfg DefaultConfig() { return new DatabaseCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(DatabaseCfg), component, this);
}
}
}

View File

@ -24,8 +24,10 @@ namespace TBF.BenchControl
Factories.Add(new TestMethods.CombinedWithDetection.TestMethodFactory());
Factories.Add(new Elde.ControlBoardFactory());
Factories.Add(new DataEntry.Combined.EntryFormFactory());
#if MUNICH
Factories.Add(new DataEntry.Munich3.EntryFormFactory());
Factories.Add(new DataEntry.Munich.EntryFormFactory());
#endif
Factories.Add(new DataEntry.Standard.EntryFormFactory());
Factories.Add(new DataEntry.Standard24.EntryFormFactory());
Factories.Add(new Elde.Diverter.DiverterFactory());
@ -62,6 +64,9 @@ namespace TBF.BenchControl
Factories.Add(new Elde.RegulValveTandem.RegulValveTandemFactory());
Factories.Add(new ResultsPrinters.Munich.PrinterFactory());
Factories.Add(new TestMethods.CameraRoiDetection.RoiDetectionFactory());
#if IPERLST
Factories.Add(new DB.SensusOracle.DatabaseFactory());
#endif
Factories.Add(new Elde.TempMeter.TempMeterFactory());
Factories.Add(new Elde.TempMeterInternal.TempMeterFactory());
Factories.Add(new Elde.Valve.ValveFactory());

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.5.84.1")]
[assembly: AssemblyFileVersion("1.5.84.1")]
[assembly: AssemblyVersion("1.5.85.1")]
[assembly: AssemblyFileVersion("1.5.85.1")]

View File

@ -209,6 +209,15 @@
<Compile Include="BenchControl\DataEntry\Standard\TestStartEndForm.designer.cs">
<DependentUpon>TestStartEndForm.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\DB\SensusOracle\Database.cs" />
<Compile Include="BenchControl\DB\SensusOracle\DatabaseCfg.cs" />
<Compile Include="BenchControl\DB\SensusOracle\DatabaseCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\DB\SensusOracle\DatabaseCfgCtrl.designer.cs">
<DependentUpon>DatabaseCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\DB\SensusOracle\DatabaseFactory.cs" />
<Compile Include="BenchControl\Elde\Diverter\Handlers.cs" />
<Compile Include="BenchControl\Elde\PressureMeterInternal\PressureMeter.cs" />
<Compile Include="BenchControl\Elde\PressureMeterInternal\PressureMeterCfg.cs" />
@ -1400,6 +1409,9 @@
<EmbeddedResource Include="BenchControl\DataEntry\WMStates\EntryFormCfgCtrl.resx">
<DependentUpon>EntryFormCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\DB\SensusOracle\DatabaseCfgCtrl.resx">
<DependentUpon>DatabaseCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Elde\Diverter\DiverterCfgCtrl.resx">
<DependentUpon>DiverterCfgCtrl.cs</DependentUpon>
</EmbeddedResource>