2017-04-12 15:33:47 +00:00
|
|
|
|
///
|
2022-05-25 13:46:43 +00:00
|
|
|
|
/// Copyright (c) 2016-2022 Sensus Slovensko a.s.
|
2017-04-12 15:33:47 +00:00
|
|
|
|
///
|
|
|
|
|
|
using System;
|
2022-11-09 10:20:30 +00:00
|
|
|
|
using System.Collections.Generic;
|
2016-02-09 07:31:14 +00:00
|
|
|
|
using System.Windows.Forms;
|
2022-05-25 13:46:43 +00:00
|
|
|
|
using Common;
|
2016-05-28 11:40:58 +00:00
|
|
|
|
using TBF.Resources;
|
2016-02-09 07:31:14 +00:00
|
|
|
|
|
2019-11-22 08:17:16 +00:00
|
|
|
|
namespace TBF.UI.ResultsMI
|
2016-02-09 07:31:14 +00:00
|
|
|
|
{
|
|
|
|
|
|
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;
|
2023-03-10 09:32:45 +00:00
|
|
|
|
readonly bool sendBtnIsPrint;
|
|
|
|
|
|
|
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;
|
2022-11-09 10:20:30 +00:00
|
|
|
|
public IList<string> SerialNrs;
|
2016-02-09 07:31:14 +00:00
|
|
|
|
|
2022-05-25 13:46:43 +00:00
|
|
|
|
PreviousResultCtrl()
|
2016-02-09 07:31:14 +00:00
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-11-09 10:20:30 +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, IList<string> serialNrs = null)
|
2016-02-09 07:31:14 +00:00
|
|
|
|
: this()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.parent = parent;
|
|
|
|
|
|
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;
|
2022-11-09 10:20:30 +00:00
|
|
|
|
this.mode = mode;
|
|
|
|
|
|
SerialNrs = serialNrs;
|
2016-02-09 07:31:14 +00:00
|
|
|
|
|
|
|
|
|
|
batchNrLabel.Text = BatchNr.ToString();
|
2020-05-06 07:45:23 +00:00
|
|
|
|
startTimeLabel.Text = StarTime.ToString(Constants.DateTimeFormat);
|
|
|
|
|
|
endTimeLabel.Text = EndTime.ToString(Constants.DateTimeFormat);
|
2018-11-09 06:35:03 +00:00
|
|
|
|
swVerLabel.Text = Ver;
|
2023-02-27 12:44:06 +00:00
|
|
|
|
int nr = 0;
|
|
|
|
|
|
procedureLabel.Text = TBF.UI.MainWnd.ProcedureNrs.TryGetValue(proc, out nr) ? string.Format("{0} {1}", nr, proc) : proc;
|
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
|
|
|
|
|
2023-03-10 09:32:45 +00:00
|
|
|
|
/// 'Sent' check box
|
|
|
|
|
|
#if ORACLE_DB
|
|
|
|
|
|
sentCheckBox.Visible = (mode == PreviousResultsMode.Show);
|
2016-06-02 10:56:18 +00:00
|
|
|
|
sentCheckBox.Text = Strings.Sent;
|
|
|
|
|
|
sentCheckBox.Checked = Sent;
|
2023-03-10 09:32:45 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/// 'Send again'/'Print' button
|
|
|
|
|
|
sendBtnIsPrint = false;
|
|
|
|
|
|
switch (mode)
|
|
|
|
|
|
{
|
|
|
|
|
|
case PreviousResultsMode.Show:
|
|
|
|
|
|
#if ORACLE_DB
|
|
|
|
|
|
sendReloadButton.Enabled = !Sent;
|
|
|
|
|
|
sendReloadButton.Text = Strings.Save_again;
|
2017-03-27 07:28:30 +00:00
|
|
|
|
#else
|
2023-03-10 09:32:45 +00:00
|
|
|
|
sendReloadButton.Enabled = true; /// 'Print' function always available
|
|
|
|
|
|
sendReloadButton.Text = Strings.Print;
|
|
|
|
|
|
sendBtnIsPrint = true;
|
2016-06-02 10:56:18 +00:00
|
|
|
|
#endif
|
2023-03-10 09:32:45 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case PreviousResultsMode.Reload:
|
|
|
|
|
|
sendReloadButton.Enabled = true;
|
|
|
|
|
|
sendReloadButton.Text = Strings.Restore;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case PreviousResultsMode.Fix:
|
|
|
|
|
|
sendReloadButton.Enabled = true;
|
|
|
|
|
|
sendReloadButton.Text = Strings.Fix;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// 'Show' button
|
|
|
|
|
|
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
|
|
|
|
{
|
2022-11-09 10:20:30 +00:00
|
|
|
|
parent.OnShowResults(this, new PreviousResultIdEventArgs(BatchNr, SerialNrs));
|
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
|
|
|
|
{
|
2023-03-10 09:32:45 +00:00
|
|
|
|
if (sendBtnIsPrint)
|
|
|
|
|
|
{
|
|
|
|
|
|
parent.OnPrint(this, new PreviousResultIdEventArgs(BatchNr, SerialNrs));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (mode == PreviousResultsMode.Show)
|
2019-04-30 09:43:37 +00:00
|
|
|
|
{
|
2022-11-09 10:20:30 +00:00
|
|
|
|
parent.OnSendAgain(this, new PreviousResultIdEventArgs(BatchNr, SerialNrs));
|
2019-04-30 09:43:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
else if (mode == PreviousResultsMode.Reload)
|
|
|
|
|
|
{
|
2022-11-09 10:20:30 +00:00
|
|
|
|
parent.OnReload(this, new PreviousResultIdEventArgs(BatchNr, SerialNrs));
|
2019-04-30 09:43:37 +00:00
|
|
|
|
}
|
2019-07-24 13:38:49 +00:00
|
|
|
|
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
|
2019-04-30 09:43:37 +00:00
|
|
|
|
else if (mode == PreviousResultsMode.Fix)
|
|
|
|
|
|
{
|
|
|
|
|
|
/// Access only to thise who manage production tracing
|
2022-05-25 13:46:43 +00:00
|
|
|
|
GID[] rqrdGroupMembership = new GID[] { GID.TraceabilityManagement };
|
2019-04-30 09:43:37 +00:00
|
|
|
|
|
2023-03-28 11:03:38 +00:00
|
|
|
|
if ((new Users.Forms.LoginDlg(TBF.DB.UserSessionFactories, Users.CurrentUser.UserName(), rqrdGroupMembership, parent)).ShowDialog() != DialogResult.OK)
|
2019-04-30 09:43:37 +00:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-25 13:46:43 +00:00
|
|
|
|
Program.MainWnd.UpdateUser();
|
|
|
|
|
|
|
2022-11-09 10:20:30 +00:00
|
|
|
|
parent.OnReloadAndFix(this, new PreviousResultIdEventArgs(BatchNr, SerialNrs));
|
2019-04-30 09:43:37 +00:00
|
|
|
|
}
|
2019-05-02 07:36:33 +00:00
|
|
|
|
#endif
|
2016-06-10 14:30:29 +00:00
|
|
|
|
}
|
2016-02-09 07:31:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|