2017-04-12 15:33:47 +00:00
|
|
|
|
///
|
|
|
|
|
|
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
|
|
|
|
|
///
|
|
|
|
|
|
using System;
|
2016-02-09 07:31:14 +00:00
|
|
|
|
using System.Windows.Forms;
|
2016-05-28 11:40:58 +00:00
|
|
|
|
using TBF.Resources;
|
2016-02-09 07:31:14 +00:00
|
|
|
|
|
|
|
|
|
|
namespace TBF.Forms
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class PreviousResultCtrl : UserControl
|
|
|
|
|
|
{
|
2017-04-10 13:23:37 +00:00
|
|
|
|
readonly PreviousResultsDlg parent;
|
2019-04-30 09:43:37 +00:00
|
|
|
|
readonly PreviousResultsMode mode;
|
2016-02-09 07:31:14 +00:00
|
|
|
|
|
|
|
|
|
|
public int BatchNr;
|
|
|
|
|
|
public DateTime StarTime;
|
|
|
|
|
|
public DateTime EndTime;
|
2018-11-09 06:35:03 +00:00
|
|
|
|
public string Ver;
|
2016-02-09 07:31:14 +00:00
|
|
|
|
public string ProcedureName;
|
|
|
|
|
|
public string PurchaseOrder;
|
|
|
|
|
|
public int PassedCount;
|
|
|
|
|
|
public int FailedCount;
|
|
|
|
|
|
public bool Sent;
|
|
|
|
|
|
|
|
|
|
|
|
protected PreviousResultCtrl()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-04-30 09:43:37 +00:00
|
|
|
|
public PreviousResultCtrl(PreviousResultsDlg parent, int bnr, DateTime s, DateTime e, string ver, string proc, string pOrd, int passCnt, int failCnt, bool sent, PreviousResultsMode mode)
|
2016-02-09 07:31:14 +00:00
|
|
|
|
: this()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.parent = parent;
|
2019-04-30 09:43:37 +00:00
|
|
|
|
this.mode = mode;
|
2017-04-10 13:23:37 +00:00
|
|
|
|
|
2016-02-09 07:31:14 +00:00
|
|
|
|
BatchNr = bnr;
|
|
|
|
|
|
StarTime = s;
|
|
|
|
|
|
EndTime = e;
|
2018-11-09 06:35:03 +00:00
|
|
|
|
Ver = ver;
|
2016-02-09 07:31:14 +00:00
|
|
|
|
ProcedureName = proc;
|
|
|
|
|
|
PurchaseOrder = pOrd;
|
|
|
|
|
|
PassedCount = passCnt;
|
|
|
|
|
|
FailedCount = failCnt;
|
|
|
|
|
|
Sent = sent;
|
|
|
|
|
|
|
|
|
|
|
|
batchNrLabel.Text = BatchNr.ToString();
|
|
|
|
|
|
startTimeLabel.Text = string.Format("{0} {1}", StarTime.ToShortDateString(), StarTime.ToShortTimeString());
|
|
|
|
|
|
endTimeLabel.Text = string.Format("{0} {1}", EndTime.ToShortDateString(), EndTime.ToShortTimeString());
|
2018-11-09 06:35:03 +00:00
|
|
|
|
swVerLabel.Text = Ver;
|
2016-02-09 07:31:14 +00:00
|
|
|
|
procedureLabel.Text = ProcedureName;
|
2018-11-09 06:35:03 +00:00
|
|
|
|
purchaseOrderLabel.Text = PurchaseOrder;
|
2016-06-02 10:56:18 +00:00
|
|
|
|
passedCountLabel.Text = string.Format("{0}: {1}", Strings.Passed, PassedCount);
|
|
|
|
|
|
failedCountLabel.Text = string.Format("{0}: {1}", Strings.Failed, FailedCount);
|
2016-05-28 11:40:58 +00:00
|
|
|
|
|
2016-06-02 10:56:18 +00:00
|
|
|
|
#if MUNICH
|
|
|
|
|
|
sentCheckBox.Text = Strings.Printed;
|
|
|
|
|
|
sentCheckBox.Checked = Sent;
|
2017-04-10 13:23:37 +00:00
|
|
|
|
sendReloadButton.Enabled = true; /// 'Print again' function always available
|
2017-04-20 09:00:41 +00:00
|
|
|
|
sendReloadButton.Text = reloadEn ? Strings.Restore : Strings.Print_again;
|
2017-03-27 07:28:30 +00:00
|
|
|
|
#elif ORACLE_DB
|
2016-06-02 10:56:18 +00:00
|
|
|
|
sentCheckBox.Text = Strings.Sent;
|
|
|
|
|
|
sentCheckBox.Checked = Sent;
|
2019-04-30 09:43:37 +00:00
|
|
|
|
sendReloadButton.Enabled = (mode != PreviousResultsMode.Show) || !Sent;
|
|
|
|
|
|
switch (mode)
|
|
|
|
|
|
{
|
|
|
|
|
|
case PreviousResultsMode.Show: sendReloadButton.Text = Strings.Save_again; break;
|
|
|
|
|
|
case PreviousResultsMode.Reload: sendReloadButton.Text = Strings.Restore; break;
|
|
|
|
|
|
case PreviousResultsMode.Fix: sendReloadButton.Text = Strings.Fix; break;
|
|
|
|
|
|
}
|
2017-03-27 07:28:30 +00:00
|
|
|
|
#else
|
|
|
|
|
|
sentCheckBox.Visible = false;
|
2017-04-14 09:51:37 +00:00
|
|
|
|
sendReloadButton.Enabled = reloadEn;
|
|
|
|
|
|
sendReloadButton.Visible = reloadEn;
|
|
|
|
|
|
sendReloadButton.Text = Strings.Restore;
|
2016-06-02 10:56:18 +00:00
|
|
|
|
#endif
|
2016-11-16 14:28:02 +00:00
|
|
|
|
showButton.Text = Strings.Show;
|
2016-06-02 10:56:18 +00:00
|
|
|
|
}
|
2016-02-09 07:31:14 +00:00
|
|
|
|
|
|
|
|
|
|
public void UpdateSentState(bool sent)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Sent = sent;
|
2016-06-02 10:56:18 +00:00
|
|
|
|
#if MUNICH
|
|
|
|
|
|
sentCheckBox.Checked = sent;
|
2017-04-10 13:23:37 +00:00
|
|
|
|
sendReloadButton.Enabled = true;
|
2017-03-27 07:28:30 +00:00
|
|
|
|
#elif ORACLE_DB
|
2016-02-09 07:31:14 +00:00
|
|
|
|
sentCheckBox.Checked = sent;
|
2017-04-10 13:23:37 +00:00
|
|
|
|
sendReloadButton.Enabled = !sent;
|
2016-06-02 10:56:18 +00:00
|
|
|
|
#endif
|
2017-03-27 07:28:30 +00:00
|
|
|
|
}
|
2016-02-09 07:31:14 +00:00
|
|
|
|
|
2019-04-30 09:43:37 +00:00
|
|
|
|
private void showButton_Click(object sender, EventArgs e)
|
2016-02-09 07:31:14 +00:00
|
|
|
|
{
|
2019-04-30 09:43:37 +00:00
|
|
|
|
parent.OnShowResults(this, new PreviousResultIdEventArgs(BatchNr));
|
2016-02-09 07:31:14 +00:00
|
|
|
|
}
|
2016-06-10 14:30:29 +00:00
|
|
|
|
|
2019-04-30 09:43:37 +00:00
|
|
|
|
private void sendReloadButton_MouseClick(object sender, MouseEventArgs e)
|
2016-06-10 14:30:29 +00:00
|
|
|
|
{
|
2019-04-30 09:43:37 +00:00
|
|
|
|
if (mode == PreviousResultsMode.Show)
|
|
|
|
|
|
{
|
|
|
|
|
|
parent.OnSendAgain(this, new PreviousResultIdEventArgs(BatchNr));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (mode == PreviousResultsMode.Reload)
|
|
|
|
|
|
{
|
|
|
|
|
|
parent.OnReload(this, new PreviousResultIdEventArgs(BatchNr));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (mode == PreviousResultsMode.Fix)
|
|
|
|
|
|
{
|
|
|
|
|
|
/// Access only to thise who manage production tracing
|
|
|
|
|
|
Users.Grp.GID[] rqrdGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TraceabilityManagement };
|
|
|
|
|
|
|
|
|
|
|
|
if ((new Users.Forms.LoginDlg(Users.GlobalData.CurrentUser.UserName, rqrdGroupMembership)).ShowDialog() != DialogResult.OK)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
parent.OnReloadAndFix(this, new PreviousResultIdEventArgs(BatchNr));
|
|
|
|
|
|
}
|
2016-06-10 14:30:29 +00:00
|
|
|
|
}
|
2016-02-09 07:31:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|