- Speichern - Locking (noch nicht funktional) - Visit-Id anfordern (noch nicht funktional) - neuer Splashscreen
566 lines
27 KiB
C#
566 lines
27 KiB
C#
// Copyright (c) 2015-2017 schick Informatik
|
|
// Description: Kopfdaten Schiffsanmeldungen
|
|
|
|
using System;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace bsmd.database
|
|
{
|
|
public class MessageCore : DatabaseEntity
|
|
{
|
|
|
|
#region Fields
|
|
|
|
private Guid? previous;
|
|
private Guid? next;
|
|
private DateTime? created;
|
|
private DateTime? changed;
|
|
|
|
private Guid? customerId;
|
|
private int? wetris_zz_56_datensatz_id;
|
|
|
|
#endregion
|
|
|
|
#region selection delegate definition
|
|
|
|
public delegate void MessageCoreSelectedHandler(MessageCore aMessageCore);
|
|
|
|
#endregion
|
|
|
|
#region Construction
|
|
|
|
public MessageCore()
|
|
{
|
|
this.tablename = "MessageCore";
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Enum
|
|
|
|
/// <summary>
|
|
/// "globaler" Status des Schiffsanlaufs
|
|
/// </summary>
|
|
public enum BSMDStatus
|
|
{
|
|
UNDEFINED = 0,
|
|
PREPARE,
|
|
TOSEND,
|
|
SENT,
|
|
RESPONDED,
|
|
FAILURE,
|
|
REPORTREQUESTED,
|
|
ARCHIVED,
|
|
HIS_FAILURE_DBH
|
|
}
|
|
|
|
/// <summary>
|
|
/// Dieses Enum dient zur Steuerung des ReportGenerator Service
|
|
/// </summary>
|
|
public enum ReportStatusEnum
|
|
{
|
|
NONE = 0, // keine Aktion
|
|
COMPLETE, // Report mit vollst. Ausgabe aller Felder
|
|
HE_REVISION, // eine neue EU-NOAD Rev. wurde empfangen (TBD)
|
|
HE_REPORTTYPE, // ein neuer EU-NOAD ReportType wurde empfangen (TBD)
|
|
RECEIPT // einfache Empfangsbestätigung (TBD)
|
|
}
|
|
|
|
|
|
public enum SearchFilterType
|
|
{
|
|
FILTER_ID,
|
|
FILTER_PORT,
|
|
FILTER_IMO,
|
|
FILTER_SHIPNAME,
|
|
FILTER_ETA,
|
|
FILTER_TICKETNO
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
[MaxLength(25)]
|
|
public string VisitId { get; set; }
|
|
|
|
[MaxLength(25)]
|
|
public string TransitId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Display Property für ENI-2
|
|
/// </summary>
|
|
public string DisplayId
|
|
{
|
|
get
|
|
{
|
|
if (!VisitId.IsNullOrEmpty()) return VisitId;
|
|
if (!TransitId.IsNullOrEmpty()) return TransitId;
|
|
return "";
|
|
}
|
|
}
|
|
|
|
[MaxLength(7)]
|
|
public string IMO { get; set; }
|
|
|
|
[MaxLength(8)]
|
|
public string ENI { get; set; }
|
|
|
|
[MaxLength(5)]
|
|
public string PoC { get; set; }
|
|
|
|
[MaxLength(50)]
|
|
public string Portname { get; set; }
|
|
|
|
public DateTime? ETA { get; set; }
|
|
|
|
public DateTime? ETAKielCanal { get; set; }
|
|
|
|
public bool IsTransit { get; set; }
|
|
|
|
public bool Incoming { get; set; } // tbd: für HIS-NORD, mal sehen ob das so bleibt
|
|
|
|
public BSMDStatus BSMDStatusInternal { get; set; }
|
|
|
|
public Message.NSWProvider InitialHIS { get; set; }
|
|
|
|
public Guid? HerbergFormGuid { get; set; }
|
|
|
|
public Guid? HerbergFormTemplateGuid { get; set; }
|
|
|
|
[MaxLength(50)]
|
|
public string HerbergReportType { get; set; }
|
|
|
|
[MaxLength(255)]
|
|
public string HerbergEmailContactReportingVessel { get; set; }
|
|
|
|
[MaxLength(255)]
|
|
public string HerbergEmail24HrsContact { get; set; }
|
|
|
|
public DateTime? HerbergRevDate { get; set; }
|
|
|
|
public Customer Customer { get; set; }
|
|
|
|
public Guid? CustomerId { get { return this.customerId; } set { this.customerId = value; } }
|
|
|
|
public ReportStatusEnum ReportStatus { get; set; }
|
|
|
|
[MaxLength(50)]
|
|
public string SietasSheetVersion { get; set; }
|
|
|
|
public Guid? DefaultReportingPartyId { get; set; }
|
|
|
|
public DateTime? Changed { get { return this.changed; } }
|
|
|
|
public DateTime? Created { get { return this.created; } }
|
|
|
|
public bool IsDK
|
|
{
|
|
get { return this.PoC?.StartsWith("DK") ?? false; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// ENI-2
|
|
/// </summary>
|
|
public string EditedBy { get; set; }
|
|
|
|
/// <summary>
|
|
/// ENI-2
|
|
/// </summary>
|
|
public string Shipname { get; set; }
|
|
|
|
/// <summary>
|
|
/// Flag zeigt an ob ein Excelsheet erzeugt werden soll
|
|
/// </summary>
|
|
public bool CreateExcel { get; set; }
|
|
|
|
/// <summary>
|
|
/// Feld um die OTRS Ticketnummer zu speichern
|
|
/// </summary>
|
|
[MaxLength(50)]
|
|
public string TicketNo { get; set; }
|
|
|
|
/// <summary>
|
|
/// Property um in ENI-2 den "gelockten" Zustand zu speichern (wird nicht persistiert), "threeway":
|
|
/// null: nicht in Verwendung, true: vom Anwender gelockt, false: von jmd. anderem gelocked
|
|
/// </summary>
|
|
public bool? Locked { get; set; }
|
|
|
|
#region Felder um NSW Statusinformationen zu speichern (abgefragte Daten!)
|
|
|
|
public bool? Cancelled { get; set; }
|
|
|
|
public bool? VisitIdOrTransitIdCancellable { get; set; }
|
|
|
|
/// <summary>
|
|
/// als string serialisierte Enumeration - Liste
|
|
/// </summary>
|
|
public string BlockedNotificationClasses { get; set; }
|
|
|
|
public string OwnNotificationClasses { get; set; }
|
|
|
|
public string FreeNotificationClasses { get; set; }
|
|
|
|
public string StatusCheckErrorCode { get; set; }
|
|
|
|
public string StatusCheckErrorMessage { get; set; }
|
|
|
|
public bool? QueryNSWStatus { get; set; }
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region DatabaseEntity implementation
|
|
|
|
public override void PrepareSave(IDbCommand cmd)
|
|
{
|
|
SqlCommand scmd = cmd as SqlCommand;
|
|
|
|
if (this.VisitId != null) scmd.Parameters.AddWithValue("@P1", this.VisitId);
|
|
else scmd.Parameters.AddWithValue("@P1", DBNull.Value);
|
|
if (this.TransitId != null) scmd.Parameters.AddWithValue("@P2", this.TransitId);
|
|
else scmd.Parameters.AddWithValue("@P2", DBNull.Value);
|
|
if (this.IMO != null) scmd.Parameters.AddWithValue("@P3", this.IMO);
|
|
else scmd.Parameters.AddWithValue("@P3", DBNull.Value);
|
|
if (this.ENI != null) scmd.Parameters.AddWithValue("@P4", this.ENI);
|
|
else scmd.Parameters.AddWithValue("@P4", DBNull.Value);
|
|
if (this.PoC != null) scmd.Parameters.AddWithValue("@P5", this.PoC);
|
|
else scmd.Parameters.AddWithValue("@P5", DBNull.Value);
|
|
if (this.Portname != null) scmd.Parameters.AddWithValue("@P6", this.Portname);
|
|
else scmd.Parameters.AddWithValue("@P6", DBNull.Value);
|
|
if (this.ETA.HasValue) scmd.Parameters.AddWithValue("@P7", this.ETA);
|
|
else scmd.Parameters.AddWithValue("@P7", DBNull.Value);
|
|
if (this.customerId.HasValue) scmd.Parameters.AddWithValue("@P8", this.customerId);
|
|
else scmd.Parameters.AddWithValue("@P8", DBNull.Value);
|
|
if (this.previous.HasValue) scmd.Parameters.AddWithValue("@P9", this.previous);
|
|
else scmd.Parameters.AddWithValue("@P9", DBNull.Value);
|
|
if (this.next.HasValue) scmd.Parameters.AddWithValue("@P10", this.next);
|
|
else scmd.Parameters.AddWithValue("@P10", DBNull.Value);
|
|
scmd.Parameters.AddWithValue("@P11", this.IsTransit ? 1 : 0);
|
|
if (this.wetris_zz_56_datensatz_id.HasValue) scmd.Parameters.AddWithValue("@P12", this.wetris_zz_56_datensatz_id);
|
|
else scmd.Parameters.AddWithValue("@P12", DBNull.Value);
|
|
scmd.Parameters.AddWithValue("@P13", this.BSMDStatusInternal);
|
|
scmd.Parameters.AddWithValue("@P14", this.InitialHIS);
|
|
scmd.Parameters.AddWithNullableValue("@P15", this.HerbergFormGuid);
|
|
scmd.Parameters.AddWithNullableValue("@P16", this.HerbergFormTemplateGuid);
|
|
scmd.Parameters.AddWithNullableValue("@P17", this.HerbergReportType);
|
|
scmd.Parameters.AddWithNullableValue("@P18", this.HerbergEmailContactReportingVessel);
|
|
scmd.Parameters.AddWithNullableValue("@P19", this.HerbergEmail24HrsContact);
|
|
scmd.Parameters.AddWithNullableValue("@P20", this.ETAKielCanal);
|
|
scmd.Parameters.AddWithNullableValue("@P21", this.HerbergRevDate);
|
|
scmd.Parameters.AddWithValue("@P22", this.ReportStatus);
|
|
scmd.Parameters.AddWithNullableValue("@P23", this.SietasSheetVersion);
|
|
scmd.Parameters.AddWithValue("@P24", this.Incoming ? 1 : 0);
|
|
scmd.Parameters.AddWithNullableValue("@P25", this.DefaultReportingPartyId);
|
|
scmd.Parameters.AddWithValue("@P26", this.CreateExcel ? 1 : 0);
|
|
scmd.Parameters.AddWithNullableValue("@P27", this.EditedBy);
|
|
scmd.Parameters.AddWithNullableValue("@P28", this.TicketNo);
|
|
scmd.Parameters.AddWithNullableValue("@P29", this.Cancelled);
|
|
scmd.Parameters.AddWithNullableValue("@P30", this.VisitIdOrTransitIdCancellable);
|
|
scmd.Parameters.AddWithNullableValue("@P31", this.BlockedNotificationClasses);
|
|
scmd.Parameters.AddWithNullableValue("@P32", this.FreeNotificationClasses);
|
|
scmd.Parameters.AddWithNullableValue("@P33", this.OwnNotificationClasses);
|
|
scmd.Parameters.AddWithNullableValue("@P34", this.StatusCheckErrorCode);
|
|
scmd.Parameters.AddWithNullableValue("@P35", this.StatusCheckErrorMessage);
|
|
scmd.Parameters.AddWithNullableValue("@P36", this.QueryNSWStatus);
|
|
|
|
if (this.IsNew)
|
|
{
|
|
this.CreateId();
|
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
|
string query = string.Format("INSERT INTO {0} (Id, VisitId, TransitId, IMO, ENI, PoC, Portname, ETA, CustomerId, " +
|
|
"Previous, Next, IsTransit, Wetris_zz_56_datensatz_id, BSMDStatus, InitialHIS, HerbergFormGuid, " +
|
|
"HerbergFormTemplateGuid, HerbergReportType, HerbergEmailcontactReportingVessel, HerbergEmail24HrsContact, " +
|
|
"ETAKielCanal, HerbergRevDate, ReportStatus, SietasSheetVersion, Incoming, DefaultReportingPartyId, CreateExcel, " +
|
|
"EditedBy, TicketNo, Cancelled, VisitIdOrTransitIdCancellable, BlockedNotificationClasses, FreeNotificationClasses, " +
|
|
"OwnNotificationClasses, StatusCheckErrorCode, StatusCheckErrorMessage, QueryNSWStatus) VALUES " +
|
|
"(@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14, @P15, @P16, @P17, " +
|
|
"@P18, @P19, @P20, @P21, @P22, @P23, @P24, @P25, @P26, @P27, @P28, @P29, @P30, @P31, @P32, @P33, @P34, @P35, @P36)",
|
|
this.Tablename);
|
|
scmd.CommandText = query;
|
|
}
|
|
else
|
|
{
|
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
|
string query = string.Format("UPDATE {0} SET VisitId = @P1, TransitId = @P2, IMO = @P3, ENI = @P4, Poc = @P5, " +
|
|
"Portname = @P6, ETA = @P7, CustomerId = @P8, Previous = @P9, Next = @P10, IsTransit = @P11, " +
|
|
"Wetris_zz_56_datensatz_id = @P12, BSMDStatus = @P13, InitialHIS = @P14, HerbergFormGuid = @P15, " +
|
|
"HerbergFormTemplateGuid = @P16, HerbergReportType = @P17, HerbergEmailContactReportingVessel = @P18, " +
|
|
"HerbergEmail24HrsContact = @P19, ETAKielCanal = @P20, HerbergRevDate = @P21, ReportStatus = @P22, " +
|
|
"SietasSheetVersion = @P23, Incoming = @P24, DefaultReportingPartyId = @P25, CreateExcel = @P26, EditedBy = @P27, " +
|
|
"TicketNo = @P28, Cancelled = @P29, VisitIdOrTransitIdCancellable = @P30, BlockedNotificationClasses = @P31, " +
|
|
"FreeNotificationClasses = @P32, OwnNotificationClasses = @P33, StatusCheckErrorCode = @P34, StatusCheckErrorMessage = @P35, " +
|
|
"QueryNSWStatus = @P36 WHERE Id = @ID", this.Tablename);
|
|
scmd.CommandText = query;
|
|
}
|
|
}
|
|
|
|
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
|
{
|
|
StringBuilder sb = new StringBuilder(
|
|
string.Format("SELECT [{0}].[Id], [{0}].[VisitId], [{0}].[TransitId], [{0}].[IMO], [{0}].[ENI], [{0}].[PoC], [{0}].[Portname], " +
|
|
"[{0}].[ETA], [{0}].[CustomerId], [{0}].[Previous], [{0}].[Next], [{0}].[IsTransit], [{0}].[Wetris_zz_56_datensatz_id], [{0}].[BSMDStatus], " +
|
|
"[{0}].[InitialHIS], [{0}].[HerbergFormGuid], [{0}].[HerbergFormTemplateGuid], [{0}].[HerbergReportType], [{0}].[HerbergEmailContactReportingVessel], " +
|
|
"[{0}].[HerbergEmail24HrsContact], [{0}].[ETAKielCanal], [{0}].[HerbergRevDate], [{0}].[ReportStatus], [{0}].[SietasSheetVersion], [{0}].[Incoming], " +
|
|
"[{0}].[DefaultReportingPartyId], [{0}].[Created], [{0}].[Changed], [{0}].[CreateExcel], [{0}].[EditedBy], [{0}].[TicketNo], " +
|
|
"[{0}].[Cancelled], [{0}].[VisitIdOrTransitIdCancellable], [{0}].[BlockedNotificationClasses], [{0}].[FreeNotificationClasses], " +
|
|
"[{0}].[OwnNotificationClasses], [{0}].[StatusCheckErrorCode], [{0}].[StatusCheckErrorMessage], [{0}].[QueryNSWStatus] FROM {0} ",
|
|
this.Tablename));
|
|
|
|
switch (filter)
|
|
{
|
|
case Message.LoadFilter.WETRIS_SHIP_ID:
|
|
{
|
|
sb.Append("WHERE Wetris_zz_56_datensatz_id = @WETRIS");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@WETRIS", criteria[0]);
|
|
break;
|
|
}
|
|
case Message.LoadFilter.HERBERG_FORMGUID:
|
|
{
|
|
sb.Append("WHERE HerbergFormGuid = @HFG");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@HFG", criteria[0]);
|
|
break;
|
|
}
|
|
case Message.LoadFilter.BSMDSTATUS:
|
|
{
|
|
sb.Append("WHERE BSMDStatus = @STATUS ORDER BY ETA DESC");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@STATUS", criteria[0]);
|
|
break;
|
|
}
|
|
case Message.LoadFilter.REPORTSTATUS:
|
|
{
|
|
sb.Append("WHERE ReportStatus = @REPORTSTATUS");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@REPORTSTATUS", criteria[0]);
|
|
break;
|
|
}
|
|
case Message.LoadFilter.BY_ID:
|
|
{
|
|
sb.Append("WHERE Id = @ID");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@ID", criteria[0]);
|
|
break;
|
|
}
|
|
case Message.LoadFilter.IMO_ETA_POC:
|
|
{
|
|
sb.Append("WHERE (IMO = @IMO AND ETA = @ETA AND Portname = @POC)");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@IMO", criteria[0]);
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@ETA", criteria[1]);
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@POC", criteria[2]);
|
|
break;
|
|
}
|
|
case Message.LoadFilter.BY_VISITID:
|
|
{
|
|
sb.Append("WHERE VisitId = @VISITID");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@VISITID", criteria[0]);
|
|
break;
|
|
}
|
|
case Message.LoadFilter.BY_TRANSITID:
|
|
{
|
|
sb.Append("WHERE TransitId = @TRANSITID");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@TRANSITID", criteria[0]);
|
|
break;
|
|
}
|
|
case Message.LoadFilter.CREATE_EXCEL:
|
|
{
|
|
sb.Append("WHERE CreateExcel = 1");
|
|
break;
|
|
}
|
|
case Message.LoadFilter.QUERY_NSW_STATUS:
|
|
{
|
|
sb.Append("WHERE QueryNSWStatus = 1");
|
|
break;
|
|
}
|
|
case Message.LoadFilter.SEARCH_CORE_FILTERS:
|
|
{
|
|
// object ist jetzt ein dict aus filtertyp und filterparameter
|
|
bool moreThanOne = false;
|
|
|
|
Dictionary<SearchFilterType, string> searchDict = criteria[0] as Dictionary<SearchFilterType, string>;
|
|
if (searchDict != null && (searchDict.Count > 0))
|
|
{
|
|
if(searchDict.ContainsKey(SearchFilterType.FILTER_SHIPNAME))
|
|
{
|
|
// perform STAT join
|
|
sb.Append(" JOIN MessageHeader mh ON MessageCore.Id = mh.MessageCoreId JOIN STAT ON mh.Id = STAT.MessageHeaderId");
|
|
}
|
|
|
|
sb.Append(" WHERE ");
|
|
foreach (SearchFilterType key in searchDict.Keys)
|
|
{
|
|
if (moreThanOne) sb.Append(" AND ");
|
|
switch (key)
|
|
{
|
|
case SearchFilterType.FILTER_ETA:
|
|
uint? from = null, to = null;
|
|
string[] elems = searchDict[key].Split(':');
|
|
if (!elems[0].IsNullOrEmpty()) from = UInt32.Parse(elems[0]);
|
|
if (!elems[1].IsNullOrEmpty()) to = UInt32.Parse(elems[1]);
|
|
|
|
if (from.HasValue && !to.HasValue)
|
|
{
|
|
sb.Append(" (ETA > @SEARCHFROM) ");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@SEARCHFROM", from.Value.FromUnixTimeStamp());
|
|
}
|
|
if(to.HasValue && !from.HasValue)
|
|
{
|
|
sb.Append(" (ETA < @SEARCHTO) ");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@SEARCHTO", to.Value.FromUnixTimeStamp());
|
|
|
|
}
|
|
if(from.HasValue && to.HasValue)
|
|
{
|
|
sb.Append(" (ETA > @SEARCHFROM AND ETA < @SEARCHTO) ");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@SEARCHFROM", from.Value.FromUnixTimeStamp());
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@SEARCHTO", to.Value.FromUnixTimeStamp());
|
|
}
|
|
|
|
break;
|
|
case SearchFilterType.FILTER_ID:
|
|
sb.Append(" (VisitId LIKE @SEARCH_ID OR TransitId LIKE @SEARCH_ID) ");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@SEARCH_ID", string.Format("%{0}%", searchDict[key]));
|
|
break;
|
|
case SearchFilterType.FILTER_IMO:
|
|
sb.Append(" IMO = @SEARCH_IMO ");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@SEARCH_IMO", searchDict[key]);
|
|
break;
|
|
case SearchFilterType.FILTER_PORT:
|
|
{
|
|
sb.Append("( ");
|
|
int paramCnt = 0;
|
|
foreach (string param in searchDict[key].SimpleSplit())
|
|
{
|
|
string paramName = string.Format("@SEARCH_PORT{0}", paramCnt);
|
|
if (paramCnt > 0) sb.Append(" OR ");
|
|
sb.AppendFormat(" Portname LIKE {0} OR PoC LIKE {0} ", paramName);
|
|
((SqlCommand)cmd).Parameters.AddWithValue(paramName, string.Format("%{0}%", param));
|
|
paramCnt++;
|
|
|
|
}
|
|
sb.Append(") ");
|
|
}
|
|
break;
|
|
case SearchFilterType.FILTER_SHIPNAME:
|
|
{
|
|
sb.Append(" [STAT].[ShipName] LIKE @SHIPNAME ");
|
|
((SqlCommand)cmd).Parameters.AddWithValue("@SHIPNAME", string.Format("%{0}%", searchDict[key]));
|
|
}
|
|
break;
|
|
case SearchFilterType.FILTER_TICKETNO:
|
|
|
|
break;
|
|
}
|
|
if (!moreThanOne) moreThanOne = true;
|
|
}
|
|
}
|
|
sb.Append(" ORDER BY ETA DESC");
|
|
break;
|
|
}
|
|
case Message.LoadFilter.ALL:
|
|
default:
|
|
sb.Append(" ORDER BY ETA DESC");
|
|
break;
|
|
}
|
|
|
|
cmd.CommandText = sb.ToString();
|
|
}
|
|
|
|
public override List<DatabaseEntity> LoadList(IDataReader reader)
|
|
{
|
|
List<DatabaseEntity> result = new List<DatabaseEntity>();
|
|
while(reader.Read())
|
|
{
|
|
MessageCore core = new MessageCore();
|
|
core.id = reader.GetGuid(0);
|
|
if (!reader.IsDBNull(1)) core.VisitId = reader.GetString(1);
|
|
if (!reader.IsDBNull(2)) core.TransitId = reader.GetString(2);
|
|
if (!reader.IsDBNull(3)) core.IMO = reader.GetString(3);
|
|
if (!reader.IsDBNull(4)) core.ENI = reader.GetString(4);
|
|
if (!reader.IsDBNull(5)) core.PoC = reader.GetString(5);
|
|
if (!reader.IsDBNull(6)) core.Portname = reader.GetString(6);
|
|
if (!reader.IsDBNull(7)) core.ETA = reader.GetDateTime(7);
|
|
if (!reader.IsDBNull(8)) core.customerId = reader.GetGuid(8);
|
|
if (!reader.IsDBNull(9)) core.previous = reader.GetGuid(9);
|
|
if (!reader.IsDBNull(10)) core.next = reader.GetGuid(10);
|
|
core.IsTransit = reader.GetBoolean(11);
|
|
if (!reader.IsDBNull(12)) core.wetris_zz_56_datensatz_id = reader.GetInt32(12);
|
|
core.BSMDStatusInternal = (BSMDStatus) Enum.ToObject(typeof(BSMDStatus), reader.GetByte(13));
|
|
core.InitialHIS = (Message.NSWProvider) Enum.ToObject(typeof(Message.NSWProvider), reader.GetByte(14));
|
|
if (!reader.IsDBNull(15)) core.HerbergFormGuid = reader.GetGuid(15);
|
|
if (!reader.IsDBNull(16)) core.HerbergFormTemplateGuid = reader.GetGuid(16);
|
|
if (!reader.IsDBNull(17)) core.HerbergReportType = reader.GetString(17);
|
|
if (!reader.IsDBNull(18)) core.HerbergEmailContactReportingVessel = reader.GetString(18);
|
|
if (!reader.IsDBNull(19)) core.HerbergEmail24HrsContact = reader.GetString(19);
|
|
if (!reader.IsDBNull(20)) core.ETAKielCanal = reader.GetDateTime(20);
|
|
if (!reader.IsDBNull(21)) core.HerbergRevDate = reader.GetDateTime(21);
|
|
if (!reader.IsDBNull(22)) core.ReportStatus = (ReportStatusEnum) Enum.ToObject(typeof(ReportStatusEnum), reader.GetByte(22));
|
|
if (!reader.IsDBNull(23)) core.SietasSheetVersion = reader.GetString(23);
|
|
if (!reader.IsDBNull(24)) core.Incoming = reader.GetBoolean(24);
|
|
if (!reader.IsDBNull(25)) core.DefaultReportingPartyId = reader.GetGuid(25);
|
|
if (!reader.IsDBNull(26)) core.created = reader.GetDateTime(26);
|
|
if (!reader.IsDBNull(27)) core.changed = reader.GetDateTime(27);
|
|
if (!reader.IsDBNull(28)) core.CreateExcel = reader.GetBoolean(28);
|
|
if (!reader.IsDBNull(29)) core.EditedBy = reader.GetString(29);
|
|
if (!reader.IsDBNull(30)) core.TicketNo = reader.GetString(30);
|
|
if (!reader.IsDBNull(31)) core.Cancelled = reader.GetBoolean(31);
|
|
if (!reader.IsDBNull(32)) core.VisitIdOrTransitIdCancellable = reader.GetBoolean(32);
|
|
if (!reader.IsDBNull(33)) core.BlockedNotificationClasses = reader.GetString(33);
|
|
if (!reader.IsDBNull(34)) core.FreeNotificationClasses = reader.GetString(34);
|
|
if (!reader.IsDBNull(35)) core.OwnNotificationClasses = reader.GetString(35);
|
|
if (!reader.IsDBNull(36)) core.StatusCheckErrorCode = reader.GetString(36);
|
|
if (!reader.IsDBNull(37)) core.StatusCheckErrorMessage = reader.GetString(37);
|
|
if (!reader.IsDBNull(38)) core.QueryNSWStatus = reader.GetBoolean(38);
|
|
|
|
result.Add(core);
|
|
}
|
|
reader.Close();
|
|
return result;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region public methods
|
|
|
|
public Message CreateMessage(Message.NotificationClass notificationClass)
|
|
{
|
|
// hier wird keine Validierung gemacht, ob die Messageklasse schon vorhanden ist!!
|
|
Message result = new Message();
|
|
result.MessageNotificationClass = notificationClass;
|
|
result.MessageCoreId = this.Id;
|
|
result.MessageCore = this;
|
|
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Definition: Eine Liste von Meldeklassen enthält dann Daten, wenn für irgendeine Meldeklasse außer
|
|
/// VISIT/TRANSIT ein Element vorhanden ist
|
|
/// </summary>
|
|
public static bool HasMessageData(List<Message> messages)
|
|
{
|
|
foreach(Message message in messages)
|
|
{
|
|
if ((message.MessageNotificationClass != Message.NotificationClass.VISIT) &&
|
|
(message.MessageNotificationClass != Message.NotificationClass.TRANSIT))
|
|
if (message.Elements.Count > 0)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region display override
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Format("{0} - {1}", this.IMO, this.ETA);
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|