using System;
using System.Collections.Generic;
namespace SharedDatabase.Entities
{
public class Record
{
public virtual int Id { get; protected set; }
public virtual string Name { get; set; } /// Part name (e.g. SAP number)
public virtual string Code { get; set; } /// Serial number or batch number
public virtual int Result { get; set; } /// Operation result: 0=OK, otherwise a non-zero error code
public virtual string Note { get; set; } /// Arbitrary additional information (e.g. Oracle settings)
public virtual StepRecord StepRecord { get; set; } /// Step record with timestamp/workstep/workplace/user info, many-to-one relationship
public virtual ReferenceRecord ReferenceRecord { get; set; } /// Reference record with info identifying the product, many-to-one relationship
protected Record() { }
///
/// Constructor used when a part barcode is scanned
///
/// Part name (SAP nr.)
/// Scanned barcode: S/N or a batch nr.
/// 0=OK, otherwise a non-zero error code
/// Step record
/// Reference record
/// true = record with workstep info, false = record with part info
public Record(ReferenceRecord referenceRecord, StepRecord stepRecord, string name, string code, int result = 0, string note = null)
{
ReferenceRecord = referenceRecord;
StepRecord = stepRecord;
Name = name;
Code = code;
Result = Result;
Note = note;
}
public override string ToString()
{
return string.Format("name={0} code={1} rslt={2} note={3}",
Name != null ? Name : "",
Code != null ? Code : "",
Result,
Note != null ? Note : "");
}
}
}