SendAgain function in PreviousResultsDlg made fool proof for iPERL production, PW protection, etc.
This commit is contained in:
parent
1c638b3f87
commit
d3126bd9ea
@ -283,7 +283,7 @@ namespace TBF.UI.ResultsMI
|
|||||||
var dlg = new SendAgainDBAndWMSelectionForm();
|
var dlg = new SendAgainDBAndWMSelectionForm();
|
||||||
if (dlg.ShowDialog() != DialogResult.OK) return;
|
if (dlg.ShowDialog() != DialogResult.OK) return;
|
||||||
|
|
||||||
bool isSuccessful = true;
|
bool isSuccessful = dlg.SaveToOracle || dlg.SaveToProductionTracing; /// At least one must be selected to be successful
|
||||||
#if ORACLE_DB
|
#if ORACLE_DB
|
||||||
if (dlg.SaveToOracle)
|
if (dlg.SaveToOracle)
|
||||||
{
|
{
|
||||||
@ -298,7 +298,7 @@ namespace TBF.UI.ResultsMI
|
|||||||
case DBUsed.Test: conn = ProcessData.OracleDB.TestDB; break;
|
case DBUsed.Test: conn = ProcessData.OracleDB.TestDB; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
isSuccessful = isSuccessful && (ProcessData.OracleDB.WriteResultsToDB(conn, b, dlg.SelectedWM, true) == Rig.Output.DB.SensusOracle.Retv.OK);
|
isSuccessful = isSuccessful && (ProcessData.OracleDB.WriteResultsToDB(conn, b, dlg.SelectedWM, true) == Retv.OK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -37,21 +37,23 @@
|
|||||||
this.oracleDbGroupBox = new System.Windows.Forms.GroupBox();
|
this.oracleDbGroupBox = new System.Windows.Forms.GroupBox();
|
||||||
this.oracleDbCheckBox = new System.Windows.Forms.CheckBox();
|
this.oracleDbCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.productionTracingCheckBox = new System.Windows.Forms.CheckBox();
|
this.productionTracingCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
|
this.unlockButton = new System.Windows.Forms.Button();
|
||||||
this.oracleDbGroupBox.SuspendLayout();
|
this.oracleDbGroupBox.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// databaseComboBox
|
// databaseComboBox
|
||||||
//
|
//
|
||||||
this.databaseComboBox.FormattingEnabled = true;
|
this.databaseComboBox.FormattingEnabled = true;
|
||||||
this.databaseComboBox.Location = new System.Drawing.Point(191, 17);
|
this.databaseComboBox.Location = new System.Drawing.Point(161, 17);
|
||||||
this.databaseComboBox.Name = "databaseComboBox";
|
this.databaseComboBox.Name = "databaseComboBox";
|
||||||
this.databaseComboBox.Size = new System.Drawing.Size(163, 21);
|
this.databaseComboBox.Size = new System.Drawing.Size(163, 21);
|
||||||
this.databaseComboBox.TabIndex = 0;
|
this.databaseComboBox.TabIndex = 0;
|
||||||
|
this.databaseComboBox.Text = "Production";
|
||||||
//
|
//
|
||||||
// databaseLabel
|
// databaseLabel
|
||||||
//
|
//
|
||||||
this.databaseLabel.AutoSize = true;
|
this.databaseLabel.AutoSize = true;
|
||||||
this.databaseLabel.Location = new System.Drawing.Point(76, 20);
|
this.databaseLabel.Location = new System.Drawing.Point(46, 20);
|
||||||
this.databaseLabel.Name = "databaseLabel";
|
this.databaseLabel.Name = "databaseLabel";
|
||||||
this.databaseLabel.Size = new System.Drawing.Size(53, 13);
|
this.databaseLabel.Size = new System.Drawing.Size(53, 13);
|
||||||
this.databaseLabel.TabIndex = 1;
|
this.databaseLabel.TabIndex = 1;
|
||||||
@ -60,7 +62,7 @@
|
|||||||
// waterMetersLabel
|
// waterMetersLabel
|
||||||
//
|
//
|
||||||
this.waterMetersLabel.AutoSize = true;
|
this.waterMetersLabel.AutoSize = true;
|
||||||
this.waterMetersLabel.Location = new System.Drawing.Point(76, 48);
|
this.waterMetersLabel.Location = new System.Drawing.Point(46, 48);
|
||||||
this.waterMetersLabel.Name = "waterMetersLabel";
|
this.waterMetersLabel.Name = "waterMetersLabel";
|
||||||
this.waterMetersLabel.Size = new System.Drawing.Size(70, 13);
|
this.waterMetersLabel.Size = new System.Drawing.Size(70, 13);
|
||||||
this.waterMetersLabel.TabIndex = 2;
|
this.waterMetersLabel.TabIndex = 2;
|
||||||
@ -69,15 +71,16 @@
|
|||||||
// waterMetersComboBox
|
// waterMetersComboBox
|
||||||
//
|
//
|
||||||
this.waterMetersComboBox.FormattingEnabled = true;
|
this.waterMetersComboBox.FormattingEnabled = true;
|
||||||
this.waterMetersComboBox.Location = new System.Drawing.Point(191, 44);
|
this.waterMetersComboBox.Location = new System.Drawing.Point(161, 44);
|
||||||
this.waterMetersComboBox.Name = "waterMetersComboBox";
|
this.waterMetersComboBox.Name = "waterMetersComboBox";
|
||||||
this.waterMetersComboBox.Size = new System.Drawing.Size(163, 21);
|
this.waterMetersComboBox.Size = new System.Drawing.Size(163, 21);
|
||||||
this.waterMetersComboBox.TabIndex = 3;
|
this.waterMetersComboBox.TabIndex = 3;
|
||||||
|
this.waterMetersComboBox.Text = "iPERL";
|
||||||
//
|
//
|
||||||
// okButton
|
// okButton
|
||||||
//
|
//
|
||||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.okButton.Location = new System.Drawing.Point(261, 119);
|
this.okButton.Location = new System.Drawing.Point(411, 19);
|
||||||
this.okButton.Name = "okButton";
|
this.okButton.Name = "okButton";
|
||||||
this.okButton.Size = new System.Drawing.Size(92, 40);
|
this.okButton.Size = new System.Drawing.Size(92, 40);
|
||||||
this.okButton.TabIndex = 4;
|
this.okButton.TabIndex = 4;
|
||||||
@ -87,8 +90,8 @@
|
|||||||
//
|
//
|
||||||
// cancelButton
|
// cancelButton
|
||||||
//
|
//
|
||||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.cancelButton.Location = new System.Drawing.Point(377, 119);
|
this.cancelButton.Location = new System.Drawing.Point(411, 65);
|
||||||
this.cancelButton.Name = "cancelButton";
|
this.cancelButton.Name = "cancelButton";
|
||||||
this.cancelButton.Size = new System.Drawing.Size(92, 40);
|
this.cancelButton.Size = new System.Drawing.Size(92, 40);
|
||||||
this.cancelButton.TabIndex = 5;
|
this.cancelButton.TabIndex = 5;
|
||||||
@ -103,15 +106,19 @@
|
|||||||
this.oracleDbGroupBox.Controls.Add(this.databaseComboBox);
|
this.oracleDbGroupBox.Controls.Add(this.databaseComboBox);
|
||||||
this.oracleDbGroupBox.Controls.Add(this.databaseLabel);
|
this.oracleDbGroupBox.Controls.Add(this.databaseLabel);
|
||||||
this.oracleDbGroupBox.Controls.Add(this.waterMetersLabel);
|
this.oracleDbGroupBox.Controls.Add(this.waterMetersLabel);
|
||||||
|
this.oracleDbGroupBox.Enabled = false;
|
||||||
this.oracleDbGroupBox.Location = new System.Drawing.Point(19, 13);
|
this.oracleDbGroupBox.Location = new System.Drawing.Point(19, 13);
|
||||||
this.oracleDbGroupBox.Name = "oracleDbGroupBox";
|
this.oracleDbGroupBox.Name = "oracleDbGroupBox";
|
||||||
this.oracleDbGroupBox.Size = new System.Drawing.Size(417, 75);
|
this.oracleDbGroupBox.Size = new System.Drawing.Size(357, 75);
|
||||||
this.oracleDbGroupBox.TabIndex = 6;
|
this.oracleDbGroupBox.TabIndex = 6;
|
||||||
this.oracleDbGroupBox.TabStop = false;
|
this.oracleDbGroupBox.TabStop = false;
|
||||||
//
|
//
|
||||||
// oracleDbCheckBox
|
// oracleDbCheckBox
|
||||||
//
|
//
|
||||||
this.oracleDbCheckBox.AutoSize = true;
|
this.oracleDbCheckBox.AutoSize = true;
|
||||||
|
this.oracleDbCheckBox.Checked = true;
|
||||||
|
this.oracleDbCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
|
this.oracleDbCheckBox.Enabled = false;
|
||||||
this.oracleDbCheckBox.Location = new System.Drawing.Point(23, -1);
|
this.oracleDbCheckBox.Location = new System.Drawing.Point(23, -1);
|
||||||
this.oracleDbCheckBox.Name = "oracleDbCheckBox";
|
this.oracleDbCheckBox.Name = "oracleDbCheckBox";
|
||||||
this.oracleDbCheckBox.Size = new System.Drawing.Size(115, 17);
|
this.oracleDbCheckBox.Size = new System.Drawing.Size(115, 17);
|
||||||
@ -123,6 +130,7 @@
|
|||||||
// productionTracingCheckBox
|
// productionTracingCheckBox
|
||||||
//
|
//
|
||||||
this.productionTracingCheckBox.AutoSize = true;
|
this.productionTracingCheckBox.AutoSize = true;
|
||||||
|
this.productionTracingCheckBox.Enabled = false;
|
||||||
this.productionTracingCheckBox.Location = new System.Drawing.Point(42, 105);
|
this.productionTracingCheckBox.Location = new System.Drawing.Point(42, 105);
|
||||||
this.productionTracingCheckBox.Name = "productionTracingCheckBox";
|
this.productionTracingCheckBox.Name = "productionTracingCheckBox";
|
||||||
this.productionTracingCheckBox.Size = new System.Drawing.Size(169, 17);
|
this.productionTracingCheckBox.Size = new System.Drawing.Size(169, 17);
|
||||||
@ -130,18 +138,31 @@
|
|||||||
this.productionTracingCheckBox.Text = "Save to production tracing DB";
|
this.productionTracingCheckBox.Text = "Save to production tracing DB";
|
||||||
this.productionTracingCheckBox.UseVisualStyleBackColor = true;
|
this.productionTracingCheckBox.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// unlockButton
|
||||||
|
//
|
||||||
|
this.unlockButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.unlockButton.Location = new System.Drawing.Point(411, 111);
|
||||||
|
this.unlockButton.Name = "unlockButton";
|
||||||
|
this.unlockButton.Size = new System.Drawing.Size(92, 40);
|
||||||
|
this.unlockButton.TabIndex = 8;
|
||||||
|
this.unlockButton.Text = "Unlock";
|
||||||
|
this.unlockButton.UseVisualStyleBackColor = true;
|
||||||
|
this.unlockButton.Click += new System.EventHandler(this.unlockButton_Click);
|
||||||
|
//
|
||||||
// SendAgainDBAndWMSelectionForm
|
// SendAgainDBAndWMSelectionForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(502, 181);
|
this.ClientSize = new System.Drawing.Size(530, 181);
|
||||||
|
this.Controls.Add(this.unlockButton);
|
||||||
this.Controls.Add(this.productionTracingCheckBox);
|
this.Controls.Add(this.productionTracingCheckBox);
|
||||||
this.Controls.Add(this.oracleDbGroupBox);
|
this.Controls.Add(this.oracleDbGroupBox);
|
||||||
this.Controls.Add(this.cancelButton);
|
this.Controls.Add(this.cancelButton);
|
||||||
this.Controls.Add(this.okButton);
|
this.Controls.Add(this.okButton);
|
||||||
this.Name = "SendAgainDBAndWMSelectionForm";
|
this.Name = "SendAgainDBAndWMSelectionForm";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "Database and water meter selection";
|
this.Text = "p";
|
||||||
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SendAgainDBAndWMSelectionForm_FormClosing);
|
||||||
this.oracleDbGroupBox.ResumeLayout(false);
|
this.oracleDbGroupBox.ResumeLayout(false);
|
||||||
this.oracleDbGroupBox.PerformLayout();
|
this.oracleDbGroupBox.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
@ -160,5 +181,6 @@
|
|||||||
private System.Windows.Forms.GroupBox oracleDbGroupBox;
|
private System.Windows.Forms.GroupBox oracleDbGroupBox;
|
||||||
private System.Windows.Forms.CheckBox oracleDbCheckBox;
|
private System.Windows.Forms.CheckBox oracleDbCheckBox;
|
||||||
private System.Windows.Forms.CheckBox productionTracingCheckBox;
|
private System.Windows.Forms.CheckBox productionTracingCheckBox;
|
||||||
|
private System.Windows.Forms.Button unlockButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,6 +6,8 @@ using System.Windows.Forms;
|
|||||||
using TBF.Rig.Output.DB.SensusOracle;
|
using TBF.Rig.Output.DB.SensusOracle;
|
||||||
using TBF.Resources;
|
using TBF.Resources;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using static TBF.UI.Shared.SharedButtons;
|
||||||
|
using Common;
|
||||||
|
|
||||||
namespace TBF.UI.ResultsMI
|
namespace TBF.UI.ResultsMI
|
||||||
{
|
{
|
||||||
@ -14,9 +16,11 @@ namespace TBF.UI.ResultsMI
|
|||||||
public bool SaveToOracle;
|
public bool SaveToOracle;
|
||||||
public DBUsed SelectedDB;
|
public DBUsed SelectedDB;
|
||||||
public WMKind SelectedWM;
|
public WMKind SelectedWM;
|
||||||
|
|
||||||
public bool SaveToProductionTracing;
|
public bool SaveToProductionTracing;
|
||||||
|
|
||||||
|
bool unlocked = false;
|
||||||
|
GID[] RequiredGroupMembership = new GID[] { GID.TestingSpecialists, GID.Metrologists };
|
||||||
|
|
||||||
public SendAgainDBAndWMSelectionForm()
|
public SendAgainDBAndWMSelectionForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -107,5 +111,39 @@ namespace TBF.UI.ResultsMI
|
|||||||
{
|
{
|
||||||
ManageCheckGroupBox(oracleDbCheckBox, oracleDbGroupBox);
|
ManageCheckGroupBox(oracleDbCheckBox, oracleDbGroupBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void unlockButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!unlocked)
|
||||||
|
{
|
||||||
|
if (!Users.CurrentUser.IsMemberOf(RequiredGroupMembership))
|
||||||
|
{
|
||||||
|
if (new Users.Forms.LoginDlg(TBF.DB.UserSessionFactories,
|
||||||
|
RequiredGroupMembership, this).ShowDialog() != DialogResult.OK)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (Program.LocalSettings.AlwaysAskPasswdWhenUnlocking)
|
||||||
|
{
|
||||||
|
if (new Users.Forms.LoginDlg(TBF.DB.UserSessionFactories,
|
||||||
|
Users.CurrentUser.UserName(),
|
||||||
|
RequiredGroupMembership, this).ShowDialog() != DialogResult.OK)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
|
||||||
|
|
||||||
|
oracleDbCheckBox.Enabled = true;
|
||||||
|
oracleDbGroupBox.Enabled = true;
|
||||||
|
productionTracingCheckBox.Enabled = true;
|
||||||
|
unlockButton.Enabled = false;
|
||||||
|
|
||||||
|
unlocked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SendAgainDBAndWMSelectionForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
if (Users.CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user