TBF.UI.ResultsMI.SendAainDBAndWMSelectionForm as in 2.27
This commit is contained in:
parent
9bc9db1792
commit
bbffc3b406
18
TBF/Resources/Strings.Designer.cs
generated
18
TBF/Resources/Strings.Designer.cs
generated
@ -1194,6 +1194,24 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Database.
|
||||
/// </summary>
|
||||
internal static string Database {
|
||||
get {
|
||||
return ResourceManager.GetString("Database", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Database and water meters selection.
|
||||
/// </summary>
|
||||
internal static string Database_and_water_meters_selection {
|
||||
get {
|
||||
return ResourceManager.GetString("Database_and_water_meters_selection", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Database Settings.
|
||||
/// </summary>
|
||||
|
||||
@ -2350,4 +2350,10 @@
|
||||
<data name="Do_you_really_want_to_delete_all_codes_Q" xml:space="preserve">
|
||||
<value>Do you really want to delete all codes ?</value>
|
||||
</data>
|
||||
<data name="Database" xml:space="preserve">
|
||||
<value>Database</value>
|
||||
</data>
|
||||
<data name="Database_and_water_meters_selection" xml:space="preserve">
|
||||
<value>Database and water meters selection</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -2387,6 +2387,12 @@
|
||||
<Compile Include="UI\ResultsMI\ResultsTabPageCtrl.designer.cs">
|
||||
<DependentUpon>ResultsTabPageCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\ResultsMI\SendAgainDBAndWMSelectionForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\ResultsMI\SendAgainDBAndWMSelectionForm.Designer.cs">
|
||||
<DependentUpon>SendAgainDBAndWMSelectionForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Settings\BenchesDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -3255,6 +3261,9 @@
|
||||
<EmbeddedResource Include="UI\ResultsMI\ResultsTabPageCtrl.resx">
|
||||
<DependentUpon>ResultsTabPageCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\ResultsMI\SendAgainDBAndWMSelectionForm.resx">
|
||||
<DependentUpon>SendAgainDBAndWMSelectionForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\Settings\BenchesDlg.resx">
|
||||
<DependentUpon>BenchesDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@ -16,6 +16,7 @@ using Results;
|
||||
using Results.Entities;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig.Output.DB.SensusOracle;
|
||||
using TBF.Rig.Sequences;
|
||||
|
||||
namespace TBF.UI.ResultsMI
|
||||
{
|
||||
@ -204,66 +205,31 @@ namespace TBF.UI.ResultsMI
|
||||
if (b.BatchNr == data.BatchNr)
|
||||
{
|
||||
#if ORACLE_DB
|
||||
//System.IO.StreamWriter logger;
|
||||
//string fname = "C:\\TBF\\Logs\\test.log";
|
||||
//try { logger = new System.IO.StreamWriter(System.IO.File.Create(fname)); }
|
||||
//catch
|
||||
//{
|
||||
// logger = null;
|
||||
// log.ErrorFormat("Was not able to open LU log file {0}", fname);
|
||||
//}
|
||||
//Database.WriteLogsToDisk(logger, b);
|
||||
|
||||
using (ISession configSession = TBF.DB.CreateSession(DBKind.Config))
|
||||
if (ProcessData.OracleDB == null)
|
||||
{
|
||||
IList<Config.Entities.Component> cmpntEntities = configSession.QueryOver<Config.Entities.Component>()
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.Where(x => (x.ClassName == "Sensus-Oracle-Database"))
|
||||
.List<Config.Entities.Component>();
|
||||
MessageBox.Show("No database");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmpntEntities.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Nepodarilo sa uložiť, neviem načítať nastavenia Oracle databázy",
|
||||
Strings.Error,
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
var dlg = new SendAgainDBAndWMSelectionForm();
|
||||
if (dlg.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
TBF.Rig.Output.DB.SensusOracle.DatabaseCfg cfg = TBF.Rig.ComponentCfgBase.CreateFromDbEntity(DatabaseCfg.Serializer, cmpntEntities[0], null)
|
||||
as TBF.Rig.Output.DB.SensusOracle.DatabaseCfg;
|
||||
OracleConnection conn;
|
||||
switch (dlg.SelectedDB)
|
||||
{
|
||||
default:
|
||||
case DBUsed.Production: conn = ProcessData.OracleDB.ProductionDB; break;
|
||||
case DBUsed.Quality: conn = ProcessData.OracleDB.QualityDB; break;
|
||||
case DBUsed.Test: conn = ProcessData.OracleDB.TestDB; break;
|
||||
}
|
||||
|
||||
/// TODO: Implement database selection
|
||||
MessageBox.Show(string.Format("Výsledky budú zapísané do produkčnej databázy"),
|
||||
Strings.Information,
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
|
||||
OracleConnection conn;
|
||||
switch (DBUsed.Production)
|
||||
{
|
||||
default:
|
||||
case DBUsed.Production:
|
||||
conn = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
|
||||
break;
|
||||
case DBUsed.Quality:
|
||||
conn = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltaqual;Password=test;");
|
||||
break;
|
||||
case DBUsed.Test:
|
||||
conn = new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ((TBF.Rig.Sequences.ProcessData.OracleDB != null) &&
|
||||
(TBF.Rig.Sequences.ProcessData.OracleDB.WriteResultsToDB(conn, b, WMKind.Mechanical, true) == Retv.OK))
|
||||
{
|
||||
b.RsltsSent = true; /// Result was successfully sent
|
||||
session.SaveOrUpdate(b); /// Update MySQL DB
|
||||
session.Flush();
|
||||
(sender as PreviousResultCtrl).Sent = true; /// Update UI
|
||||
Redraw();
|
||||
}
|
||||
if (ProcessData.OracleDB.WriteResultsToDB(conn, b, dlg.SelectedWM, true) == Retv.OK)
|
||||
{
|
||||
b.RsltsSent = true; /// Result was successfully sent
|
||||
session.SaveOrUpdate(b); /// Update MySQL DB
|
||||
session.Flush();
|
||||
(sender as PreviousResultCtrl).Sent = true; /// Update UI
|
||||
Redraw();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
123
TBF/UI/ResultsMI/SendAgainDBAndWMSelectionForm.Designer.cs
generated
Normal file
123
TBF/UI/ResultsMI/SendAgainDBAndWMSelectionForm.Designer.cs
generated
Normal file
@ -0,0 +1,123 @@
|
||||
namespace TBF.UI.ResultsMI
|
||||
{
|
||||
partial class SendAgainDBAndWMSelectionForm
|
||||
{
|
||||
/// <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 Windows Form 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.databaseComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.databaseLabel = new System.Windows.Forms.Label();
|
||||
this.waterMetersLabel = new System.Windows.Forms.Label();
|
||||
this.waterMetersComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// databaseComboBox
|
||||
//
|
||||
this.databaseComboBox.FormattingEnabled = true;
|
||||
this.databaseComboBox.Location = new System.Drawing.Point(151, 27);
|
||||
this.databaseComboBox.Name = "databaseComboBox";
|
||||
this.databaseComboBox.Size = new System.Drawing.Size(163, 21);
|
||||
this.databaseComboBox.TabIndex = 0;
|
||||
//
|
||||
// databaseLabel
|
||||
//
|
||||
this.databaseLabel.AutoSize = true;
|
||||
this.databaseLabel.Location = new System.Drawing.Point(36, 30);
|
||||
this.databaseLabel.Name = "databaseLabel";
|
||||
this.databaseLabel.Size = new System.Drawing.Size(53, 13);
|
||||
this.databaseLabel.TabIndex = 1;
|
||||
this.databaseLabel.Text = "Database";
|
||||
//
|
||||
// waterMetersLabel
|
||||
//
|
||||
this.waterMetersLabel.AutoSize = true;
|
||||
this.waterMetersLabel.Location = new System.Drawing.Point(36, 65);
|
||||
this.waterMetersLabel.Name = "waterMetersLabel";
|
||||
this.waterMetersLabel.Size = new System.Drawing.Size(70, 13);
|
||||
this.waterMetersLabel.TabIndex = 2;
|
||||
this.waterMetersLabel.Text = "Water meters";
|
||||
//
|
||||
// waterMetersComboBox
|
||||
//
|
||||
this.waterMetersComboBox.FormattingEnabled = true;
|
||||
this.waterMetersComboBox.Location = new System.Drawing.Point(151, 62);
|
||||
this.waterMetersComboBox.Name = "waterMetersComboBox";
|
||||
this.waterMetersComboBox.Size = new System.Drawing.Size(163, 21);
|
||||
this.waterMetersComboBox.TabIndex = 3;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Location = new System.Drawing.Point(106, 115);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(92, 40);
|
||||
this.okButton.TabIndex = 4;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelButton.Location = new System.Drawing.Point(222, 115);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(92, 40);
|
||||
this.cancelButton.TabIndex = 5;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// SendAgainDBAndWMSelectionForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(347, 181);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.waterMetersComboBox);
|
||||
this.Controls.Add(this.waterMetersLabel);
|
||||
this.Controls.Add(this.databaseLabel);
|
||||
this.Controls.Add(this.databaseComboBox);
|
||||
this.Name = "SendAgainDBAndWMSelectionForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Database and water meter selection";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ComboBox databaseComboBox;
|
||||
private System.Windows.Forms.Label databaseLabel;
|
||||
private System.Windows.Forms.Label waterMetersLabel;
|
||||
private System.Windows.Forms.ComboBox waterMetersComboBox;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
}
|
||||
}
|
||||
70
TBF/UI/ResultsMI/SendAgainDBAndWMSelectionForm.cs
Normal file
70
TBF/UI/ResultsMI/SendAgainDBAndWMSelectionForm.cs
Normal file
@ -0,0 +1,70 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TBF.Rig.Output.DB.SensusOracle;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.UI.ResultsMI
|
||||
{
|
||||
public partial class SendAgainDBAndWMSelectionForm : Form
|
||||
{
|
||||
public DBUsed SelectedDB;
|
||||
public WMKind SelectedWM;
|
||||
|
||||
public SendAgainDBAndWMSelectionForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Localize();
|
||||
|
||||
databaseComboBox.Items.Add(DBUsed.Production);
|
||||
databaseComboBox.Items.Add(DBUsed.Test);
|
||||
databaseComboBox.Items.Add(DBUsed.Quality);
|
||||
databaseComboBox.Text = databaseComboBox.Items[0].ToString();
|
||||
|
||||
waterMetersComboBox.Items.Add(WMKind.iPERL);
|
||||
waterMetersComboBox.Items.Add(WMKind.Mechanical);
|
||||
waterMetersComboBox.Text = waterMetersComboBox.Items[0].ToString();
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Database_and_water_meters_selection;
|
||||
databaseLabel.Text = Strings.Database;
|
||||
waterMetersLabel.Text = Strings.Water_meters;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
cancelButton.Text = Strings.CancelBtnText;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (DBUsed db = DBUsed.Production; db < DBUsed.Count; db++)
|
||||
{
|
||||
if (db.ToString() == databaseComboBox.Text)
|
||||
{
|
||||
SelectedDB = db;
|
||||
for (WMKind wm = WMKind.iPERL; wm < WMKind.Count; wm++)
|
||||
{
|
||||
if (wm.ToString() == waterMetersComboBox.Text)
|
||||
{
|
||||
SelectedWM = wm;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageBox.Show("Invalid selection");
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
TBF/UI/ResultsMI/SendAgainDBAndWMSelectionForm.resx
Normal file
120
TBF/UI/ResultsMI/SendAgainDBAndWMSelectionForm.resx
Normal 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>
|
||||
Loading…
Reference in New Issue
Block a user