using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
namespace Raytheon.Common.PdelWriter.Utilities
{
[XmlType("TestExecutive-PdelInformation")]
public class PdelInformation
{
#region Public Properties
///
/// Gets or sets the Test Data Standard Version.
///
/// The Test Data Standard Version.
[XmlElement("TestDataStandardVersion")]
public string TestDataStandardVersion { get; set; }
///
/// Gets or sets the UUT Identification.
///
/// The UUT Identification.
[XmlElement("UutIdentification")]
public string UutIdentification { get; set; }
///
/// Gets or sets the UUT Revision.
/// Drawing Number Revision of the Unit Under Test (also know as Dash Number)
///
/// The UUT Revision.
[XmlElement("UutRevision")]
public string UutRevision { get; set; }
///
/// Gets or sets the UUT Serial Number.
///
/// The UUT Serial Number.
[XmlElement("UutSerialNumber")]
public string UutSerialNumber { get; set; }
///
/// Gets or sets the Test Procedure Revision.
///
/// The Test Procedure Revision.
[XmlElement("TestProcedureRevision")]
public string TestProcedureRevision { get; set; }
///
/// Gets or sets the Test Procedure Identification.
///
/// The Test Procedure Identification.
[XmlElement("TestProcedureIdentification")]
public string TestProcedureIdentification { get; set; }
///
/// Gets or sets the work order.
/// Work order number for the test being run
///
/// The work order.
[XmlElement("WorkOrder")]
public string WorkOrder { get; set; }
///
/// Gets or sets the Work Order Operation.
///
/// The Work Order Operation.
[XmlElement("WorkOrderOperation")]
public string WorkOrderOperation { get; set; }
///
/// Gets or sets the Test Software Identification.
///
/// The Test Software Identification.
[XmlElement("TestSoftwareIdentification")]
public string TestSoftwareIdentification { get; set; }
///
/// Gets or sets the Test Software Revision.
///
/// The Test Software Revision.
[XmlElement("TestSoftwareRevision")]
public string TestSoftwareRevision { get; set; }
///
/// Gets or sets the Test Set Identification.
///
/// The Test Set Identification.
[XmlElement("TestSetIdentification")]
public string TestSetIdentification { get; set; }
///
/// Gets or sets the Test Set Revision.
///
/// The Test Set Revision.
[XmlElement("TestSetRevision")]
public string TestSetRevision { get; set; }
///
/// Gets or sets the Test Set Serial Number.
///
/// The Test Set Serial Number.
[XmlElement("TestSetSerialNumber")]
public string TestSetSerialNumber { get; set; }
///
/// Gets or sets the Test Chamber Identification.
///
/// The Test Chamber Identification.
[XmlElement("TestChamberIdentification")]
public string TestChamberIdentification { get; set; }
///
/// Gets or sets the Test Chamber Revision.
///
/// The Test Chamber Revision.
[XmlElement("TestChamberRevision")]
public string TestChamberRevision { get; set; }
///
/// Gets or sets the Test Chamber Serial Number.
///
/// The Test Chamber Serial Number.
[XmlElement("TestChamberSerialNumber")]
public string TestChamberSerialNumber { get; set; }
///
/// Gets or sets the Interface Adapter Identification.
///
/// The Interface Adapter Identification.
[XmlElement("InterfaceAdapterIdentification")]
public string InterfaceAdapterIdentification { get; set; }
///
/// Gets or sets the Interface Adapter Revision.
///
/// The Interface Adapter Revision.
[XmlElement("InterfaceAdapterRevision")]
public string InterfaceAdapterRevision { get; set; }
///
/// Gets or sets the Interface Adapter Serial Number.
///
/// The Interface Adapter Serial Number.
[XmlElement("InterfaceAdapterSerialNumber")]
public string InterfaceAdapterSerialNumber { get; set; }
///
/// Gets or sets the test category.
///
/// The test category.
[XmlElement("Address")]
public TestCategory TestCategory { get; set; }
///
/// Gets or sets the Test Location.
///
/// The Test Location.
[XmlElement("TestLocation")]
public string TestLocation { get; set; }
///
/// Gets or sets the Test operator.
///
/// The Test Operator.
[XmlElement("TestOperator")]
public string TestOperator { get; set; }
///
/// Gets or sets the Test Temperature.
///
/// The Test Temperature.
[XmlElement("TestTemperature")]
public string TestTemperature { get; set; }
///
/// Gets or sets the Test Start Time.
///
/// The Test start time.
[XmlElement("TestStartTime")]
public DateTime TestStartTime { get; set; }
///
/// Gets or sets the Test Stop Time.
///
/// The Test Stop Time.
[XmlElement("TestStopTime")]
public DateTime TestStopTime { get; set; }
///
/// Gets or sets the UUT Test Status.
///
/// The UUT Test Status.
[XmlElement("UutTestStatus")]
public PassFailStatus UutTestStatus { get; set; }
///
/// Gets or sets the test comments.
///
/// The test comments.
[XmlElement("TestComments")]
public string TestComments { get; set; }
[XmlElement("ECIDNumber")]
public string ECIDNumber { get; set; }
///
/// Physical slot number the UUT is tested in.
///
[XmlElement("SlotNumber")]
public int SlotNumber { get; set; } = 1;
#endregion
#region Constructors
public PdelInformation()
{
}
///
/// ICloneable is depreciated so we have to create a basic copy constructor.
///
///
public PdelInformation(PdelInformation copyThis)
{
Clone(copyThis);
}
#endregion
#region Public Members
///
/// Clones the PdelInformation from copyThis to this.
///
///
void Clone(PdelInformation cloneThis)
{
UutSerialNumber = cloneThis.UutSerialNumber;
UutIdentification = cloneThis.UutIdentification;
UutRevision = cloneThis.UutRevision;
WorkOrder = cloneThis.WorkOrder;
WorkOrderOperation = cloneThis.WorkOrderOperation;
TestProcedureIdentification = cloneThis.TestProcedureIdentification;
TestProcedureRevision = cloneThis.TestProcedureRevision;
TestSetIdentification = cloneThis.TestSetIdentification;
TestSoftwareRevision = cloneThis.TestSoftwareRevision;
TestSoftwareIdentification = cloneThis.TestSoftwareIdentification;
TestSetRevision = cloneThis.TestSetRevision;
TestSetSerialNumber = cloneThis.TestSetSerialNumber;
TestChamberIdentification = cloneThis.TestChamberIdentification;
TestChamberRevision = cloneThis.TestChamberRevision;
TestChamberSerialNumber = cloneThis.TestChamberSerialNumber;
InterfaceAdapterIdentification = cloneThis.InterfaceAdapterIdentification;
InterfaceAdapterRevision = cloneThis.InterfaceAdapterRevision;
InterfaceAdapterSerialNumber = cloneThis.InterfaceAdapterSerialNumber;
TestLocation = cloneThis.TestLocation;
TestCategory = cloneThis.TestCategory;
TestTemperature = cloneThis.TestTemperature;
ECIDNumber = cloneThis.ECIDNumber;
SlotNumber = cloneThis.SlotNumber;
}
///
/// Returns all the public properties of the current System.Type.
///
/// Dictionary of key/value pairs representing PDEL Header values.
public Dictionary GetDetails()
{
Dictionary details = new Dictionary();
PropertyInfo[] propertyInfos = this.GetType().GetProperties();
foreach (PropertyInfo info in propertyInfos)
{
var value = string.Empty;
foreach (var test in info.CustomAttributes)
{
if (test.NamedArguments != null && test.NamedArguments.Count > 0 && test.NamedArguments[0].MemberName == "EmitDefaultValue")
{
value = "DoNotWriteToPDEL";
break;
}
else
{
value = info.GetValue(this) == null ? "NA" : info.GetValue(this).ToString();
break;
}
}
string name = Regex.Replace(info.Name, @"(?