tbf/RecordProcessing/Records/CommTestRecord.cs

60 lines
1.8 KiB
C#

///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.IO;
using log4net;
namespace RecordProcessing.Records
{
public class CommTestRecord : IRecord
{
static readonly ILog log = LogManager.GetLogger(typeof(CommTestRecord));
public string FileName { get { return fileName; } }
public string SN { get { return sn; } set { } }
public DateTime TimeStamp { get { return timeStamp; } }
public Status Status { get { return status; } }
public string ResultStr { get { return string.Empty; } }
public string Remark { get { return string.Empty; } }
string fileName;
string sn;
DateTime timeStamp;
Status status;
public CommTestRecord()
{
}
/// <summary>
/// Load a record from a CommTest log file.
/// </summary>
/// <param name="fileName">Full file pathname</param>
/// <returns>Record or null</returns>
public static CommTestRecord FromFile(string pathName)
{
try
{
CommTestRecord record = new CommTestRecord();
record.fileName = Path.GetFileName(pathName);
record.sn = record.fileName.Substring(0, 12);
record.timeStamp = DateTime.Now;
record.status = Status.Passed;
return record;
}
catch (Exception exc)
{
log.ErrorFormat("Cannot open file {0}: {1}", pathName, exc.Message);
return null;
}
}
public bool CanSaveRecordToOracle() { return false; }
public bool SaveRecordToOracle(Oracle.DataAccess.Client.OracleConnection oraConn) { return false; }
public bool CanPrintRecord() { return false; }
public bool PrintRecord() { return false; }
}
}