Version 3.9.2

Diverse Korrekturen für Go-Live, gelöschte-ID Bug gefunden (war den Core als stat. Dictionary Key Objekt zu behalten und später nicht mehr neu zu laden, so überschrieb der "alte" Core die neue Version mit der Visit-Id.
This commit is contained in:
Daniel Schick 2017-12-05 17:48:57 +00:00
parent f6caab44f8
commit 695c07a5f7
25 changed files with 236 additions and 92 deletions

View File

@ -22,6 +22,7 @@
<Label Name="labelStatusTransmitter" Content="?" FontWeight="Bold" /> <Label Name="labelStatusTransmitter" Content="?" FontWeight="Bold" />
<Label Content="Report:" /> <Label Content="Report:" />
<Label Name="labelStatusReport" Content="?" FontWeight="Bold" /> <Label Name="labelStatusReport" Content="?" FontWeight="Bold" />
<Button Name="refreshButton" Content="{x:Static p:Resources.textRefresh}" Margin="4" Background="Transparent" Click="refreshButton_Click"/>
</StackPanel> </StackPanel>
<local:ENIDataGrid Grid.Row="1" <local:ENIDataGrid Grid.Row="1"
Margin="2,4,2,2" x:Name="dataGridStatus" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Margin="2,4,2,2" x:Name="dataGridStatus" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"

View File

@ -55,11 +55,12 @@ namespace ENI2.Controls
ServiceControllerStatus transmitter = (ServiceControllerStatus)serverStatus.Transmitter; ServiceControllerStatus transmitter = (ServiceControllerStatus)serverStatus.Transmitter;
this.labelStatusTransmitter.Content = transmitter.ToString(); this.labelStatusTransmitter.Content = transmitter.ToString();
//this.dataGridStatus.Items.Refresh();
entries.BubbleSort();
}); });
} }
public class StatusEntry public class StatusEntry : IComparable
{ {
private static Dictionary<string, string> guidIdDict = new Dictionary<string, string>(); private static Dictionary<string, string> guidIdDict = new Dictionary<string, string>();
@ -118,8 +119,20 @@ namespace ENI2.Controls
return result; return result;
} }
public static void ClearIds() { guidIdDict.Clear(); }
public int CompareTo(object obj)
{
if(obj is StatusEntry)
return -(Timestamp.CompareTo(((StatusEntry)obj).Timestamp));
return 0;
}
} }
private void refreshButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
StatusEntry.ClearIds();
}
} }
} }

View File

@ -390,53 +390,56 @@ namespace ENI2
} }
// NOA_NOD vor ATA vor ATD Versendereihenfolge sicherstellen // NOA_NOD vor ATA vor ATD Versendereihenfolge sicherstellen
bool noa_nod_queued_or_sent = false; if ((this.Core.InitialHIS == Message.NSWProvider.DUDR) || (this.Core.InitialHIS == Message.NSWProvider.DUDR_TEST))
bool ata_queued_or_sent = false;
foreach(Message aMessage in this._messages)
{ {
if(aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) bool noa_nod_queued_or_sent = false;
bool ata_queued_or_sent = false;
foreach (Message aMessage in this._messages)
{ {
if ((aMessage.SendSuccess ?? false) || (aMessage.InternalStatus == Message.BSMDStatus.TOSEND)) if (aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD)
noa_nod_queued_or_sent = true;
}
if (aMessage.MessageNotificationClass == Message.NotificationClass.ATA)
{
if ((aMessage.SendSuccess ?? false) || (aMessage.InternalStatus == Message.BSMDStatus.TOSEND))
ata_queued_or_sent = true;
}
}
foreach(Message aMessage in this._messages)
{
if((aMessage.MessageNotificationClass == Message.NotificationClass.ATA) && (aMessage.InternalStatus == Message.BSMDStatus.TOSEND))
{
if(!noa_nod_queued_or_sent)
{ {
aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED; if ((aMessage.SendSuccess ?? false) || (aMessage.InternalStatus == Message.BSMDStatus.TOSEND))
aMessage.ChangedBy = ""; noa_nod_queued_or_sent = true;
aMessage.StatusInfo = string.Format("Validation error: NOA_NOD must be sent before ATA"); }
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); if (aMessage.MessageNotificationClass == Message.NotificationClass.ATA)
{
if ((aMessage.SendSuccess ?? false) || (aMessage.InternalStatus == Message.BSMDStatus.TOSEND))
ata_queued_or_sent = true;
} }
} }
if ((aMessage.MessageNotificationClass == Message.NotificationClass.ATD) && (aMessage.InternalStatus == Message.BSMDStatus.TOSEND)) foreach (Message aMessage in this._messages)
{ {
if (!noa_nod_queued_or_sent) if ((aMessage.MessageNotificationClass == Message.NotificationClass.ATA) && (aMessage.InternalStatus == Message.BSMDStatus.TOSEND))
{ {
aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED; if (!noa_nod_queued_or_sent)
aMessage.ChangedBy = ""; {
aMessage.StatusInfo = string.Format("Validation error: NOA_NOD must be sent before ATD"); aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED;
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); aMessage.ChangedBy = "";
aMessage.StatusInfo = string.Format("Validation error: NOA_NOD must be sent before ATA");
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage);
}
} }
if(!ata_queued_or_sent) if ((aMessage.MessageNotificationClass == Message.NotificationClass.ATD) && (aMessage.InternalStatus == Message.BSMDStatus.TOSEND))
{ {
aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED; if (!noa_nod_queued_or_sent)
aMessage.ChangedBy = ""; {
aMessage.StatusInfo = string.Format("Validation error: ATA must be sent before ATD"); aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED;
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); aMessage.ChangedBy = "";
aMessage.StatusInfo = string.Format("Validation error: NOA_NOD must be sent before ATD");
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage);
}
if (!ata_queued_or_sent)
{
aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED;
aMessage.ChangedBy = "";
aMessage.StatusInfo = string.Format("Validation error: ATA must be sent before ATD");
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage);
}
} }
} }
} }
} }

View File

@ -36,7 +36,7 @@
<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage> <WebPage>publish.html</WebPage>
<ApplicationRevision>1</ApplicationRevision> <ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>3.9.0.%2a</ApplicationVersion> <ApplicationVersion>3.9.2.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut> <CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -49,18 +49,24 @@ namespace ENI2.Util
if(entity.IsTransit) if(entity.IsTransit)
{ {
if ((!watchedEntity.TransitId.IsNullOrEmpty()) && !entity.TransitId.Equals(watchedEntity.TransitId)) if (!entity.TransitId.IsNullOrEmpty())
{ {
OnVisitTransitIdUpdated(entity); if ((watchedEntity.TransitId.IsNullOrEmpty()) && !entity.TransitId.Equals(watchedEntity.TransitId))
watchedEntity.TransitId = entity.TransitId; {
OnVisitTransitIdUpdated(entity);
watchedEntity.TransitId = entity.TransitId;
}
} }
} }
else else
{ {
if ((!watchedEntity.VisitId.IsNullOrEmpty()) && !entity.VisitId.Equals(watchedEntity.VisitId)) if (!entity.VisitId.IsNullOrEmpty())
{ {
OnVisitTransitIdUpdated(entity); if ((watchedEntity.VisitId.IsNullOrEmpty()) && !entity.VisitId.Equals(watchedEntity.VisitId))
watchedEntity.VisitId = entity.VisitId; {
OnVisitTransitIdUpdated(entity);
watchedEntity.VisitId = entity.VisitId;
}
} }
} }

Binary file not shown.

View File

@ -472,13 +472,13 @@ namespace bsmd.ReportGenerator
#endregion #endregion
#region LADG #region LADG
/*
if((message != null) && (message.MessageNotificationClass == Message.NotificationClass.LADG)) if((message != null) && (message.MessageNotificationClass == Message.NotificationClass.LADG))
{ {
BSMDDocument.CreateLADGTable(document, message); BSMDDocument.CreateLADGTable(document, message);
return; return;
} }
*/
#endregion #endregion
if (messageParagraph.MessageText != null) // komplette Nachricht (z.B. STAT) if (messageParagraph.MessageText != null) // komplette Nachricht (z.B. STAT)
@ -661,19 +661,19 @@ namespace bsmd.ReportGenerator
table.Borders.Visible = true; table.Borders.Visible = true;
Column column = table.AddColumn(); Column column = table.AddColumn();
column.Width = Unit.FromCentimeter(1); column.Width = Unit.FromCentimeter(0.8);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(2); column.Width = Unit.FromCentimeter(2);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(2); column.Width = Unit.FromCentimeter(3);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(2); column.Width = Unit.FromCentimeter(1.2);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(9); column.Width = Unit.FromCentimeter(9);
Row hRow = table.AddRow(); Row hRow = table.AddRow();
hRow.Cells[1].AddParagraph("LoCode"); hRow.Cells[1].AddParagraph("Port");
hRow.Cells[2].AddParagraph("Date of departure"); hRow.Cells[2].AddParagraph("Date of departure");
hRow.Cells[3].AddParagraph("Crew members joined"); hRow.Cells[3].AddParagraph("Crew members joined");
hRow.Cells[4].AddParagraph("Names of joining crew"); hRow.Cells[4].AddParagraph("Names of joining crew");
@ -681,19 +681,19 @@ namespace bsmd.ReportGenerator
for (int i = 0; i < mdh.PortOfCallLast30Days.Count; i++) for (int i = 0; i < mdh.PortOfCallLast30Days.Count; i++)
{ {
Row row = table.AddRow(); Row row = table.AddRow();
BSMDDocument.SetPoCLast30Days((i + 1), ((PortOfCallLast30Days) mdh.PortOfCallLast30Days[i]), row); BSMDDocument.SetPoCLast30Days(((PortOfCallLast30Days) mdh.PortOfCallLast30Days[i]), row);
} }
} }
} }
private static void SetPoCLast30Days(int p, PortOfCallLast30Days portOfCallLast30Days, Row row) private static void SetPoCLast30Days(PortOfCallLast30Days portOfCallLast30Days, Row row)
{ {
row.Cells[0].AddParagraph(p.ToString()); row.Cells[0].AddParagraph(portOfCallLast30Days.Identifier);
row.Cells[1].AddParagraph(portOfCallLast30Days.PortOfCallLast30DaysLocode ?? ""); row.Cells[1].AddParagraph(portOfCallLast30Days.PortOfCallLast30DaysLocode ?? "");
row.Cells[2].AddParagraph(portOfCallLast30Days.PortOfCallLast30DaysDateOfDeparture.HasValue ? row.Cells[2].AddParagraph(portOfCallLast30Days.PortOfCallLast30DaysDateOfDeparture.HasValue ?
portOfCallLast30Days.PortOfCallLast30DaysDateOfDeparture.Value.ToShortDateString() : ""); portOfCallLast30Days.PortOfCallLast30DaysDateOfDeparture.Value.ToShortDateString() : "");
row.Cells[3].AddParagraph(portOfCallLast30Days.PortOfCallLast30DaysCrewMembersJoined.HasValue ? row.Cells[3].AddParagraph(portOfCallLast30Days.PortOfCallLast30DaysCrewMembersJoined.HasValue ?
portOfCallLast30Days.PortOfCallLast30DaysCrewMembersJoined.Value ? "True" : "False" : ""); portOfCallLast30Days.PortOfCallLast30DaysCrewMembersJoined.Value ? "Yes" : "No" : "");
for (int i = 0; i < portOfCallLast30Days.CrewJoinedShip.Count; i++) for (int i = 0; i < portOfCallLast30Days.CrewJoinedShip.Count; i++)
{ {
row.Cells[4].AddParagraph(portOfCallLast30Days.CrewJoinedShip[i].PortOfCallLast30DaysCrewJoinedShipName ?? ""); row.Cells[4].AddParagraph(portOfCallLast30Days.CrewJoinedShip[i].PortOfCallLast30DaysCrewJoinedShipName ?? "");
@ -888,8 +888,8 @@ namespace bsmd.ReportGenerator
row.Cells[0].AddParagraph("Valid exemption?"); row.Cells[0].AddParagraph("Valid exemption?");
row.Cells[1].AddParagraph("Confirmation of correctness"); row.Cells[1].AddParagraph("Confirmation of correctness");
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph(was.WasteDisposalValidExemption ?? false ? "YES" : "NO"); row.Cells[0].AddParagraph(was.WasteDisposalValidExemption ?? false ? "Yes" : "No");
row.Cells[1].AddParagraph(was.ConfirmationOfCorrectness ?? false ? "YES" : "NO"); row.Cells[1].AddParagraph(was.ConfirmationOfCorrectness ?? false ? "Yes" : "No");
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("Last port where waste or cargo residues were discharged"); row.Cells[0].AddParagraph("Last port where waste or cargo residues were discharged");
@ -897,7 +897,7 @@ namespace bsmd.ReportGenerator
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph(was.LastWasteDisposalPort ?? ""); row.Cells[0].AddParagraph(was.LastWasteDisposalPort ?? "");
if(was.LastWasteDisposalDate.HasValue) if(was.LastWasteDisposalDate.HasValue)
row.Cells[1].AddParagraph(was.LastWasteDisposalDate.ToString()); row.Cells[1].AddParagraph(was.LastWasteDisposalDate?.ToShortDateString());
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("Name of waste disposal service provider"); row.Cells[0].AddParagraph("Name of waste disposal service provider");
row.Cells[1].AddParagraph("Waste disposal order (all, some, none)"); row.Cells[1].AddParagraph("Waste disposal order (all, some, none)");
@ -935,40 +935,61 @@ namespace bsmd.ReportGenerator
row.Cells[6].AddParagraph("Estimated waste/cargo residues amount generated between port of call and next port"); row.Cells[6].AddParagraph("Estimated waste/cargo residues amount generated between port of call and next port");
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("1 Oil Sludge"); row.Cells[0].AddParagraph("1100 Oily residues (sludge)");
GetWasteForIndex(1, was, row); GetWasteForIndex(1100, was, row);
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("2 Oil Bilgewater"); row.Cells[0].AddParagraph("1200 Oily bilge water");
GetWasteForIndex(2, was, row); GetWasteForIndex(1200, was, row);
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("3 Oil other"); row.Cells[0].AddParagraph("1300 Waste oil - others");
GetWasteForIndex(3, was, row); GetWasteForIndex(1300, was, row);
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("4 Garbage Foodwaste"); row.Cells[0].AddParagraph("2100 Food waste");
GetWasteForIndex(4, was, row); GetWasteForIndex(2100, was, row);
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("5 Garbage plastic"); row.Cells[0].AddParagraph("2200 Plastic");
GetWasteForIndex(5, was, row); GetWasteForIndex(2200, was, row);
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("6 Garbage other"); row.Cells[0].AddParagraph("2300 Domestic wastes");
GetWasteForIndex(6, was, row); GetWasteForIndex(2300, was, row);
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("7 Sewage"); row.Cells[0].AddParagraph("2311 Cooking oil");
GetWasteForIndex(7, was, row); GetWasteForIndex(2311, was, row);
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("8 Cargo associated waste"); row.Cells[0].AddParagraph("2308 Incinerator ashes");
GetWasteForIndex(8, was, row); GetWasteForIndex(2308, was, row);
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("9 Cargo residues"); row.Cells[0].AddParagraph("2600 Operational wastes");
GetWasteForIndex(9, was, row); GetWasteForIndex(2600, was, row);
row = table.AddRow();
row.Cells[0].AddParagraph("2309 Animal carcass(es)");
GetWasteForIndex(2309, was, row);
row = table.AddRow();
row.Cells[0].AddParagraph("3000 Sewage");
GetWasteForIndex(3000, was, row);
row = table.AddRow();
row.Cells[0].AddParagraph("5100 Cargo residues - Marpol Annex I");
GetWasteForIndex(5100, was, row);
row = table.AddRow();
row.Cells[0].AddParagraph("5200 Cargo residues - Marpol Annex II");
GetWasteForIndex(5200, was, row);
row = table.AddRow();
row.Cells[0].AddParagraph("5300 Cargo residues - Marpol Annex ");
GetWasteForIndex(5300, was, row);
} }
private static void GetWasteForIndex(int index, WAS was, Row row) private static void GetWasteForIndex(int index, WAS was, Row row)
@ -1055,6 +1076,7 @@ namespace bsmd.ReportGenerator
/// <param name="propertyName">Name des Felds (ohne Klassenname)</param> /// <param name="propertyName">Name des Felds (ohne Klassenname)</param>
/// <param name="value">Aktueller Wert / Wert aus der DB</param> /// <param name="value">Aktueller Wert / Wert aus der DB</param>
/// <returns>ggf. ersetzter Wert</returns> /// <returns>ggf. ersetzter Wert</returns>
private static string DatabaseEntity_ReportReplacer(string propertyName, string value) private static string DatabaseEntity_ReportReplacer(string propertyName, string value)
{ {
@ -1063,6 +1085,10 @@ namespace bsmd.ReportGenerator
string result = value; string result = value;
// ACHTUNG! Die Name (propertyName) sind die bereits in report.db *ersetzten* Namen, d.h. ändert man dort
// wieder etwas funktioniert es ggf. hier nicht mehr. Das ist leider aufwändig zu ändern, man müsste die Report
// Erzeugung komplett umbauen
switch(propertyName) switch(propertyName)
{ {
case "PackageType": case "PackageType":
@ -1080,10 +1106,32 @@ namespace bsmd.ReportGenerator
} }
} }
break; break;
case "Ship Type":
if (LocalizedLookup.getVesselTypes().ContainsKey(value))
result = string.Format("{0} - {1}", value, LocalizedLookup.getVesselTypes()[value]);
break;
default: default:
break; break;
} }
if(propertyName.Contains("flag", StringComparison.OrdinalIgnoreCase))
if (LocalizedLookup.getNationalities().ContainsKey(value))
result = LocalizedLookup.getNationalities()[value];
if(propertyName.Contains("port", StringComparison.OrdinalIgnoreCase))
{
string portName = LocodeDB.PortNameFromLocode(value);
if (!portName.IsNullOrEmpty())
{
result = string.Format("{0} - {1}", value, portName);
}
}
if (propertyName.Contains("nst2007", StringComparison.OrdinalIgnoreCase))
if (LocalizedLookup.getCargoCodesNST().ContainsKey(value))
result = LocalizedLookup.getCargoCodesNST()[value];
return result; return result;
} }

View File

@ -241,7 +241,8 @@ namespace bsmd.ReportGenerator
{ {
if (aMessage.InternalStatus == Message.BSMDStatus.REPORT) if (aMessage.InternalStatus == Message.BSMDStatus.REPORT)
{ {
reportMessages.Add(aMessage); if ((aMessage.MessageNotificationClass != Message.NotificationClass.VISIT) && (aMessage.MessageNotificationClass != Message.NotificationClass.TRANSIT))
reportMessages.Add(aMessage);
aMessage.InternalStatus = Message.BSMDStatus.PREPARE; aMessage.InternalStatus = Message.BSMDStatus.PREPARE;
DBManager.Instance.Save(aMessage); DBManager.Instance.Save(aMessage);
sb.Append(aMessage.MessageNotificationClassDisplay); sb.Append(aMessage.MessageNotificationClassDisplay);
@ -262,7 +263,7 @@ namespace bsmd.ReportGenerator
Dictionary<string, string> coverInfos = new Dictionary<string, string>(); Dictionary<string, string> coverInfos = new Dictionary<string, string>();
coverInfos.Add("Ship", DBManager.Instance.GetShipNameFromCore(reportCore)); coverInfos.Add("Ship", DBManager.Instance.GetShipNameFromCore(reportCore));
coverInfos.Add("ETA", reportCore.ETA_NOA_NOD.ToString()); coverInfos.Add("ETA", reportCore.ETA_NOA_NOD.HasValue ? reportCore.ETA_NOA_NOD.Value.ToLocalTime().ToString() : "");
coverInfos.Add("Port of call", reportCore.Portname); coverInfos.Add("Port of call", reportCore.Portname);
coverInfos.Add("Visit-ID", reportCore.DisplayId); coverInfos.Add("Visit-ID", reportCore.DisplayId);
coverInfos.Add("Class", classes); coverInfos.Add("Class", classes);

View File

@ -314,6 +314,8 @@ namespace bsmd.database
public virtual string GetDisplayValue(PropertyInfo property) public virtual string GetDisplayValue(PropertyInfo property)
{ {
bool isDouble = (property.PropertyType == typeof(Nullable<double>)); bool isDouble = (property.PropertyType == typeof(Nullable<double>));
bool isDateTime = (property.PropertyType == typeof(Nullable<DateTime>));
object propValue = property.GetValue(this, null); object propValue = property.GetValue(this, null);
if (propValue == null) return ""; if (propValue == null) return "";
string value = propValue.ToString(); string value = propValue.ToString();
@ -321,6 +323,17 @@ namespace bsmd.database
{ {
value = ((double)propValue).ToString("N2"); value = ((double)propValue).ToString("N2");
} }
else if(isDateTime)
{
if(Attribute.IsDefined(property, typeof(DateOnlyAttribute)))
{
value = ((DateTime)propValue).ToShortDateString();
}
else
{
value = ((DateTime)propValue).ToLocalTime().ToString(); // perform UTC-LocalTime Conversion
}
}
else else
{ {
if(ReportReplacer != null) if(ReportReplacer != null)

View File

@ -14,6 +14,7 @@ using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using log4net; using log4net;
using System.Linq; using System.Linq;
using System.Collections;
namespace bsmd.database namespace bsmd.database
{ {
@ -152,5 +153,22 @@ namespace bsmd.database
return str.Substring(0, maxLen); return str.Substring(0, maxLen);
} }
public static void BubbleSort(this IList o)
{
for (int i = o.Count - 1; i >= 0; i--)
{
for (int j = 1; j <= i; j++)
{
object o1 = o[j - 1];
object o2 = o[j];
if (((IComparable)o1).CompareTo(o2) > 0)
{
o.Remove(o1);
o.Insert(j, o1);
}
}
}
}
} }
} }

View File

@ -113,6 +113,7 @@ namespace bsmd.database
[ShowReport] [ShowReport]
[MaxLength(11)] [MaxLength(11)]
[ENI2Validation] [ENI2Validation]
[Validation(ValidationCode.DOT_NO_COMMA)]
public string Flashpoint_CEL { get; set; } public string Flashpoint_CEL { get; set; }
[ShowReport] [ShowReport]

View File

@ -67,6 +67,7 @@ namespace bsmd.database
[ShowReport] [ShowReport]
[MaxLength(10)] [MaxLength(10)]
[ENI2Validation] [ENI2Validation]
[Validation(ValidationCode.DOT_NO_COMMA)]
public string Flashpoint_CEL { get; set; } public string Flashpoint_CEL { get; set; }
[ShowReport] [ShowReport]

View File

@ -51,6 +51,7 @@ namespace bsmd.database
[ShowReport] [ShowReport]
[MaxLength(10)] [MaxLength(10)]
[ENI2Validation] [ENI2Validation]
[Validation(ValidationCode.DOT_NO_COMMA)]
public string Flashpoint_CEL { get; set; } public string Flashpoint_CEL { get; set; }
[ShowReport] [ShowReport]

View File

@ -154,6 +154,7 @@ namespace bsmd.database
[ShowReport] [ShowReport]
[LookupName("MDH.DateOfIssue")] [LookupName("MDH.DateOfIssue")]
[ENI2Validation] [ENI2Validation]
[DateOnly]
public DateTime? DateOfIssue { get; set; } public DateTime? DateOfIssue { get; set; }
[ShowReport] [ShowReport]

View File

@ -66,6 +66,7 @@ namespace bsmd.database
[ShowReport] [ShowReport]
[LookupName("PRE72H.DateOfLastExpandedInspection")] [LookupName("PRE72H.DateOfLastExpandedInspection")]
[ENI2Validation] [ENI2Validation]
[DateOnly]
public DateTime? DateOfLastExpandedInspection { get; set; } public DateTime? DateOfLastExpandedInspection { get; set; }
[ShowReport] [ShowReport]

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("schick Informatik")] [assembly: AssemblyCompany("schick Informatik")]
[assembly: AssemblyProduct("BSMD NSW interface")] [assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("3.9.0")] [assembly: AssemblyInformationalVersion("3.9.2")]
[assembly: AssemblyCopyright("Copyright © 2014-2017 schick Informatik")] [assembly: AssemblyCopyright("Copyright © 2014-2017 schick Informatik")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]

View File

@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.9.0.*")] [assembly: AssemblyVersion("3.9.2.*")]

View File

@ -306,6 +306,22 @@ namespace bsmd.database
} }
} }
break; break;
case ValidationCode.DOT_NO_COMMA:
{
if(!value.IsNullOrEmpty() && (value.Contains(",")))
{
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
}
break;
}
case ValidationCode.VESSEL_TYPE:
{
if((value.Length == 0) || ((STAT.VesselTypeDict != null) && !STAT.VesselTypeDict.ContainsKey(value)))
{
errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, property.Name, value, entity.Title, identifier, entity.Tablename));
}
break;
}
default: default:
break; break;
} }

View File

@ -113,6 +113,7 @@ namespace bsmd.database
[Validation2(ValidationCode.NOT_NULL)] [Validation2(ValidationCode.NOT_NULL)]
[LookupName("SEC.ISSCDateOfExpiration")] [LookupName("SEC.ISSCDateOfExpiration")]
[ENI2Validation] [ENI2Validation]
[DateOnly]
public DateTime? ISSCDateOfExpiration { get; set; } public DateTime? ISSCDateOfExpiration { get; set; }
[ShowReport] [ShowReport]

View File

@ -102,7 +102,7 @@ namespace bsmd.database
} }
[ShowReport] [ShowReport]
[Validation(ValidationCode.NOT_NULL)] [Validation(ValidationCode.VESSEL_TYPE)]
[LookupName("STAT.ShipType")] [LookupName("STAT.ShipType")]
[MaxLength(5)] [MaxLength(5)]
[ENI2Validation] [ENI2Validation]

View File

@ -18,6 +18,12 @@ namespace bsmd.database
public ShowReportAttribute() { } public ShowReportAttribute() { }
} }
[AttributeUsage(AttributeTargets.Property)]
public class DateOnlyAttribute : Attribute
{
public DateOnlyAttribute() { }
}
[AttributeUsage(AttributeTargets.Property)] [AttributeUsage(AttributeTargets.Property)]
public class ReportDisplayNameAttribute : Attribute public class ReportDisplayNameAttribute : Attribute
{ {

View File

@ -34,6 +34,8 @@ namespace bsmd.database
IMPLAUSIBLE_ZZUKN, IMPLAUSIBLE_ZZUKN,
LOCODE_NOPORT, LOCODE_NOPORT,
LOCODE_SSN, LOCODE_SSN,
DOT_NO_COMMA,
VESSEL_TYPE,
POSITION_COUNT = 22, POSITION_COUNT = 22,
STRING_UNNUMBER = 23, STRING_UNNUMBER = 23,
STRING_IMOCLASS = 24, STRING_IMOCLASS = 24,

View File

@ -48,7 +48,7 @@ namespace bsmd.database
public bool? WasteDisposalValidExemption { get; set; } public bool? WasteDisposalValidExemption { get; set; }
[ShowReport] [ShowReport]
[Validation2(ValidationCode.NOT_NULL)] [Validation2(ValidationCode.LOCODE)]
[LookupName("WAS.LastWasteDisposalPort")] [LookupName("WAS.LastWasteDisposalPort")]
[MaxLength(5)] [MaxLength(5)]
[ENI2Validation] [ENI2Validation]
@ -64,6 +64,7 @@ namespace bsmd.database
[Validation2(ValidationCode.NOT_NULL)] [Validation2(ValidationCode.NOT_NULL)]
[LookupName("WAS.LastWasteDisposalDate")] [LookupName("WAS.LastWasteDisposalDate")]
[ENI2Validation] [ENI2Validation]
[DateOnly]
public DateTime? LastWasteDisposalDate { get; set; } public DateTime? LastWasteDisposalDate { get; set; }
[ShowReport] [ShowReport]

View File

@ -52,8 +52,9 @@ namespace bsmd.hisnord
if (theResult.code > 0) if (theResult.code > 0)
{ {
core.BSMDStatusInternal = MessageCore.BSMDStatus.FAILURE; MessageCore reloadCore = DBManager.Instance.GetMessageCoreById(core.Id.Value);
DBManager.Instance.Save(core); reloadCore.BSMDStatusInternal = MessageCore.BSMDStatus.FAILURE;
DBManager.Instance.Save(reloadCore);
message.InternalStatus = Message.BSMDStatus.SEND_FAILED; message.InternalStatus = Message.BSMDStatus.SEND_FAILED;
DBManager.Instance.Save(message); DBManager.Instance.Save(message);
@ -734,7 +735,8 @@ namespace bsmd.hisnord
SERV serv = message.Elements[i] as SERV; SERV serv = message.Elements[i] as SERV;
hn_serv.Service[i] = new service(); hn_serv.Service[i] = new service();
hn_serv.Service[i].ServiceBeneficiary = serv.ServiceBeneficiary; hn_serv.Service[i].ServiceBeneficiary = serv.ServiceBeneficiary;
hn_serv.Service[i].ServiceName = serv.ServiceName; if(!serv.ServiceName.IsNullOrEmpty())
hn_serv.Service[i].ServiceName = serv.ServiceName;
hn_serv.Service[i].ServiceInvoiceRecipient = serv.ServiceInvoiceRecipient; hn_serv.Service[i].ServiceInvoiceRecipient = serv.ServiceInvoiceRecipient;
} }
@ -1328,7 +1330,8 @@ namespace bsmd.hisnord
hn_pas.Passenger[i].PassengerPlaceOfBirth = pas.PassengerPlaceOfBirth; hn_pas.Passenger[i].PassengerPlaceOfBirth = pas.PassengerPlaceOfBirth;
hn_pas.Passenger[i].PassengerPortOfDisembarkation = pas.PassengerPortOfDisembarkation; hn_pas.Passenger[i].PassengerPortOfDisembarkation = pas.PassengerPortOfDisembarkation;
hn_pas.Passenger[i].PassengerPortOfEmbarkation = pas.PassengerPortOfEmbarkation; hn_pas.Passenger[i].PassengerPortOfEmbarkation = pas.PassengerPortOfEmbarkation;
hn_pas.Passenger[i].PassengerVisaNumber = pas.PassengerVisaNumber; if(!pas.PassengerVisaNumber.IsNullOrEmpty())
hn_pas.Passenger[i].PassengerVisaNumber = pas.PassengerVisaNumber;
} }
items1ChoiceType.Add(Items1ChoiceType.PAS); items1ChoiceType.Add(Items1ChoiceType.PAS);
@ -1524,16 +1527,23 @@ namespace bsmd.hisnord
{ {
AGNT agnt = message.Elements[0] as AGNT; AGNT agnt = message.Elements[0] as AGNT;
global::agnt hn_agnt = new global::agnt(); global::agnt hn_agnt = new global::agnt();
hn_agnt.AgentCity = agnt.AgentCity; if(!agnt.AgentCity.IsNullOrEmpty())
hn_agnt.AgentCity = agnt.AgentCity;
hn_agnt.AgentCompanyName = agnt.AgentCompanyName; hn_agnt.AgentCompanyName = agnt.AgentCompanyName;
hn_agnt.AgentCountry = agnt.AgentCountry; if(!agnt.AgentCountry.IsNullOrEmpty())
hn_agnt.AgentEMail = agnt.AgentEMail; hn_agnt.AgentCountry = agnt.AgentCountry;
hn_agnt.AgentFax = agnt.AgentFax; if(!agnt.AgentEMail.IsNullOrEmpty())
hn_agnt.AgentFirstName = agnt.AgentFirstName; hn_agnt.AgentEMail = agnt.AgentEMail;
if(!agnt.AgentFax.IsNullOrEmpty())
hn_agnt.AgentFax = agnt.AgentFax;
if(!agnt.AgentFirstName.IsNullOrEmpty())
hn_agnt.AgentFirstName = agnt.AgentFirstName;
hn_agnt.AgentLastName = agnt.AgentLastName; hn_agnt.AgentLastName = agnt.AgentLastName;
hn_agnt.AgentPhone = agnt.AgentPhone; hn_agnt.AgentPhone = agnt.AgentPhone;
hn_agnt.AgentPostalCode = agnt.AgentPostalCode; if(!agnt.AgentPostalCode.IsNullOrEmpty())
hn_agnt.AgentStreetAndNumber = agnt.AgentStreetAndNumber; hn_agnt.AgentPostalCode = agnt.AgentPostalCode;
if(!agnt.AgentStreetAndNumber.IsNullOrEmpty())
hn_agnt.AgentStreetAndNumber = agnt.AgentStreetAndNumber;
items1ChoiceType.Add(Items1ChoiceType.AGNT); items1ChoiceType.Add(Items1ChoiceType.AGNT);
items1.Add(hn_agnt); items1.Add(hn_agnt);
} }

Binary file not shown.