tbf/TestBenchFramework/Forms/PreviousResultCtrl.cs

89 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TBF.Resources;
namespace TBF.Forms
{
public partial class PreviousResultCtrl : UserControl
{
PreviousResultsDlg parent;
public int BatchNr;
public DateTime StarTime;
public DateTime EndTime;
public string ProcedureName;
public string PurchaseOrder;
public int PassedCount;
public int FailedCount;
public bool Sent;
protected PreviousResultCtrl()
{
InitializeComponent();
}
public PreviousResultCtrl(PreviousResultsDlg parent, int bnr, DateTime s, DateTime e, string proc, string pOrd, int passCnt, int failCnt, bool sent)
: this()
{
this.parent = parent;
BatchNr = bnr;
StarTime = s;
EndTime = e;
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());
procedureLabel.Text = ProcedureName;
purchaseOrderLabel.Text = string.Format("{0}: {1}", Strings.PO, PurchaseOrder);
passedCountLabel.Text = string.Format("{0}: {1}", Strings.Passed, PassedCount);
failedCountLabel.Text = string.Format("{0}: {1}", Strings.Failed, FailedCount);
#if MUNICH
sentCheckBox.Text = Strings.Printed;
sentCheckBox.Checked = Sent;
sendButton.Enabled = true; /// 'Print again' function always available
sendButton.Text = Strings.Print_again;
#else
sentCheckBox.Text = Strings.Sent;
sentCheckBox.Checked = Sent;
sendButton.Enabled = !Sent;
sendButton.Text = Strings.Again;
#endif
showButton.Text = Strings.Show;
}
public void UpdateSentState(bool sent)
{
this.Sent = sent;
#if MUNICH
sentCheckBox.Checked = sent;
sendButton.Enabled = true;
#else
sentCheckBox.Checked = sent;
sendButton.Enabled = !sent;
#endif
}
private void sendButton_Click(object sender, EventArgs e)
{
parent.OnSendAgain(this, new PreviousResultIdEventArgs(BatchNr));
}
private void showButton_Click(object sender, EventArgs e)
{
parent.OnShowResults(this, new PreviousResultIdEventArgs(BatchNr));
}
}
}