using System; using System.Linq; using System.Xml; using System.Xml.Linq; namespace bsmd.hisnord { public class SystemError { private DateTime? _errorAt; private string _meldeTyp; private string _referenceId; private int _processStatus; private string _importFileName; private int _errorCode; private string _errorMessage; private string _errorDescription; public SystemError(XElement xml) { if(xml.Descendants("ErrorAt").Count() > 0) { _errorAt = DateTime.Parse(xml.Descendants("ErrorAt").First().Value); } _meldeTyp = xml.Descendants("MeldeType").First()?.Value; _referenceId = xml.Descendants("ReferenceId").First()?.Value; if(xml.Descendants("ProcessStatus").Count() > 0) { _processStatus = Int32.Parse(xml.Descendants("ProcessStatus").First().Value); } _importFileName = xml.Descendants("ImportFilename").First()?.Value; if(xml.Descendants("ErrorCode").Count() > 0) { _errorCode = Int32.Parse(xml.Descendants("ErrorCode").First().Value); } _errorMessage = xml.Descendants("ErrorMessage").First()?.Value; _errorDescription = xml.Descendants("ErrorDescription").First()?.Value; } #region Properties public DateTime? ErrorAt { get { return _errorAt; } } public string MeldeTyp { get { return _meldeTyp; } } public string ReferenceId { get { return _referenceId; } } public int ProcessStatus { get { return _processStatus; } } public string ImportFileName { get { return _importFileName; } } public int ErrorCode { get { return _errorCode; } } public string ErrorMessage { get { return _errorMessage; } } public string ErrorDescription { get { return _errorDescription; } } #endregion } }