5.2.1: Korrekturen für "Copy Data".. zurückspielen der historisierten Daten

This commit is contained in:
Daniel Schick 2019-06-17 08:34:59 +00:00
parent bd688e65ea
commit effc270724
45 changed files with 606 additions and 83 deletions

View File

@ -26,12 +26,12 @@
<value>1000</value> <value>1000</value>
</setting> </setting>
<setting name="LockingServerAddress" serializeAs="String"> <setting name="LockingServerAddress" serializeAs="String">
<value>http://192.168.2.4/LockingService/LockingService.svc</value> <!--value>http://192.168.2.4/LockingService/LockingService.svc</value-->
<!--value>http://heupferd/bsmd.LockingService/LockingService.svc</value--> <value>http://heupferd/bsmd.LockingService/LockingService.svc</value>
</setting> </setting>
<setting name="ConnectionString" serializeAs="String"> <setting name="ConnectionString" serializeAs="String">
<value>Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False</value> <!--value>Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False</value-->
<!--value>Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=E:\DATA\DB\NSW.MDF;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False</value--> <value>Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=E:\DATA\DB\NSW.MDF;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False</value>
</setting> </setting>
</ENI2.Properties.Settings> </ENI2.Properties.Settings>
</applicationSettings> </applicationSettings>

View File

@ -11,6 +11,7 @@ using System.Windows.Input;
using System; using System;
using System.Net; using System.Net;
using ENI2.LockingServiceReference; using ENI2.LockingServiceReference;
using ENI2.Util;
using System.Threading; using System.Threading;
namespace ENI2 namespace ENI2
@ -84,6 +85,50 @@ namespace ENI2
RuleEngine.RegisterPortAreaChecker(LocalizedLookup.PortAreaExists); RuleEngine.RegisterPortAreaChecker(LocalizedLookup.PortAreaExists);
RuleEngine.RegisterNationalityChecker(LocalizedLookup.CheckNationality); RuleEngine.RegisterNationalityChecker(LocalizedLookup.CheckNationality);
// Register expandable Properties
// WAS
TypeDecorationManager.AddExpandableObjectConverter(typeof(WAS));
TypeDecorationManager.AddExpandableObjectConverter(typeof(Waste));
TypeDecorationManager.AddExpandableIListConverter<Waste>(typeof(IList<Waste>));
// NOA_NOD
TypeDecorationManager.AddExpandableObjectConverter(typeof(NOA_NOD));
TypeDecorationManager.AddExpandableObjectConverter(typeof(CallPurpose));
TypeDecorationManager.AddExpandableIListConverter<CallPurpose>(typeof(IList<CallPurpose>));
// SEC
TypeDecorationManager.AddExpandableObjectConverter(typeof(SEC));
TypeDecorationManager.AddExpandableObjectConverter(typeof(LastTenPortFacilitiesCalled));
TypeDecorationManager.AddExpandableIListConverter<LastTenPortFacilitiesCalled>(typeof(IList<LastTenPortFacilitiesCalled>));
TypeDecorationManager.AddExpandableObjectConverter(typeof(ShipToShipActivitiesDuringLastTenPortFacilitiesCalled));
TypeDecorationManager.AddExpandableIListConverter<ShipToShipActivitiesDuringLastTenPortFacilitiesCalled>(typeof(IList<ShipToShipActivitiesDuringLastTenPortFacilitiesCalled>));
// MDH
TypeDecorationManager.AddExpandableObjectConverter(typeof(MDH));
TypeDecorationManager.AddExpandableObjectConverter(typeof(SanitaryMeasuresDetail));
TypeDecorationManager.AddExpandableIListConverter<SanitaryMeasuresDetail>(typeof(IList<SanitaryMeasuresDetail>));
TypeDecorationManager.AddExpandableObjectConverter(typeof(StowawaysJoiningLocation));
TypeDecorationManager.AddExpandableIListConverter<StowawaysJoiningLocation>(typeof(IList<StowawaysJoiningLocation>));
TypeDecorationManager.AddExpandableObjectConverter(typeof(PortOfCallLast30Days));
TypeDecorationManager.AddExpandableIListConverter<PortOfCallLast30Days>(typeof(IList<PortOfCallLast30Days>));
TypeDecorationManager.AddExpandableObjectConverter(typeof(PortOfCallLast30DaysCrewJoinedShip));
TypeDecorationManager.AddExpandableIListConverter<PortOfCallLast30Days>(typeof(IList<PortOfCallLast30DaysCrewJoinedShip>));
TypeDecorationManager.AddExpandableObjectConverter(typeof(InfectedArea));
TypeDecorationManager.AddExpandableIListConverter<InfectedArea>(typeof(IList<InfectedArea>));
// BPOL
TypeDecorationManager.AddExpandableObjectConverter(typeof(BPOL));
TypeDecorationManager.AddExpandableObjectConverter(typeof(PortOfItinerary));
TypeDecorationManager.AddExpandableIListConverter<PortOfItinerary>(typeof(IList<PortOfItinerary>));
// HAZ
TypeDecorationManager.AddExpandableObjectConverter(typeof(HAZ));
TypeDecorationManager.AddExpandableObjectConverter(typeof(IMDGPosition));
TypeDecorationManager.AddExpandableIListConverter<IMDGPosition>(typeof(IList<IMDGPosition>));
TypeDecorationManager.AddExpandableObjectConverter(typeof(IBCPosition));
TypeDecorationManager.AddExpandableIListConverter<IBCPosition>(typeof(IList<IBCPosition>));
TypeDecorationManager.AddExpandableObjectConverter(typeof(IGCPosition));
TypeDecorationManager.AddExpandableIListConverter<IGCPosition>(typeof(IList<IGCPosition>));
TypeDecorationManager.AddExpandableObjectConverter(typeof(IMSBCPosition));
TypeDecorationManager.AddExpandableIListConverter<IMSBCPosition>(typeof(IList<IMSBCPosition>));
TypeDecorationManager.AddExpandableObjectConverter(typeof(MARPOL_Annex_I_Position));
TypeDecorationManager.AddExpandableIListConverter<MARPOL_Annex_I_Position>(typeof(IList<MARPOL_Annex_I_Position>));
// Connect to locking service (if enabled) // Connect to locking service (if enabled)
try try
{ {

View File

@ -376,24 +376,25 @@ namespace ENI2
} }
message.ChangedBy = string.Format("{0} at {1}", userName, DateTime.Now); message.ChangedBy = string.Format("{0} at {1}", userName, DateTime.Now);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(message); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(message);
if (message.MessageNotificationClass == Message.NotificationClass.CREW)
{ //if (message.MessageNotificationClass == Message.NotificationClass.CREW)
foreach(CREW crew in message.Elements) //{
{ // foreach(CREW crew in message.Elements)
if (crew.IsNew || crew.IsDirty) DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(crew); // {
} // if (crew.IsNew || crew.IsDirty) DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(crew);
} // }
else if (message.MessageNotificationClass == Message.NotificationClass.PAS) //}
{ //else if (message.MessageNotificationClass == Message.NotificationClass.PAS)
foreach(PAS pas in message.Elements) //{
{ // foreach(PAS pas in message.Elements)
if(pas.IsNew || pas.IsDirty) DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(pas); // {
} // if(pas.IsNew || pas.IsDirty) DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(pas);
} // }
else //}
{ //else
//{
message.SaveElements(); message.SaveElements();
} //}
message.IsDirty = false; message.IsDirty = false;
if(message.MessageNotificationClass == Message.NotificationClass.ATA) if(message.MessageNotificationClass == Message.NotificationClass.ATA)

View File

@ -191,7 +191,7 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class // are you sure dialog is in base class
_bpol.PortOfItineraries.Remove(poi); _bpol.PortOfItineraries.Remove(poi);
DBManager.Instance.Delete(poi); DBManager.Instance.Delete(poi);
DatabaseEntity.ResetIdentifiers(_bpol.PortOfItineraries); DatabaseEntity.ResetIdentifiers(new List<DatabaseEntity>(_bpol.PortOfItineraries));
this.SublistElementChanged(Message.NotificationClass.BPOL); this.SublistElementChanged(Message.NotificationClass.BPOL);
this.dataGridPortOfItinerary.Items.Refresh(); this.dataGridPortOfItinerary.Items.Refresh();
} }
@ -475,7 +475,7 @@ namespace ENI2.DetailViewControls
}; };
if (ofd.ShowDialog() ?? false) if (ofd.ShowDialog() ?? false)
{ {
FileStream stream = null; FileStream stream;
try try
{ {
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read); stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
@ -549,7 +549,7 @@ namespace ENI2.DetailViewControls
}; };
if (ofd.ShowDialog() ?? false) if (ofd.ShowDialog() ?? false)
{ {
FileStream stream = null; FileStream stream;
try try
{ {
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read); stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);

View File

@ -23,7 +23,7 @@ namespace ENI2.DetailViewControls
private Message _servMessage; private Message _servMessage;
private Message _ladgMessage; private Message _ladgMessage;
private static string[] shippingAreas = { private static readonly string[] shippingAreas = {
Properties.Resources.textShippingAreaNORTHBALTIC, Properties.Resources.textShippingAreaNORTHBALTIC,
Properties.Resources.textShippingAreaEUROPE, Properties.Resources.textShippingAreaEUROPE,
Properties.Resources.textShippingAreaOverseas Properties.Resources.textShippingAreaOverseas
@ -185,8 +185,7 @@ namespace ENI2.DetailViewControls
private void DataGridLADG_DeleteRequested(DatabaseEntity obj) private void DataGridLADG_DeleteRequested(DatabaseEntity obj)
{ {
LADG ladg = obj as LADG; if (obj is LADG ladg)
if (ladg != null)
{ {
// are you sure dialog is in base class // are you sure dialog is in base class
this._ladgMessage.Elements.Remove(ladg); this._ladgMessage.Elements.Remove(ladg);
@ -267,8 +266,7 @@ namespace ENI2.DetailViewControls
private void DataGridSERV_DeleteRequested(DatabaseEntity obj) private void DataGridSERV_DeleteRequested(DatabaseEntity obj)
{ {
SERV serv = obj as SERV; if (obj is SERV serv)
if (serv != null)
{ {
// are you sure dialog is in base class // are you sure dialog is in base class
_servMessage.Elements.Remove(serv); _servMessage.Elements.Remove(serv);

View File

@ -34,8 +34,8 @@
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion> <MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage> <WebPage>publish.html</WebPage>
<ApplicationRevision>4</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>5.2.0.%2a</ApplicationVersion> <ApplicationVersion>5.2.1.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut> <CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>
@ -338,6 +338,7 @@
<Compile Include="Util\EnumHelper.cs" /> <Compile Include="Util\EnumHelper.cs" />
<Compile Include="Util\EnumToBooleanConverter.cs" /> <Compile Include="Util\EnumToBooleanConverter.cs" />
<Compile Include="Util\EnumToCollectionConverter.cs" /> <Compile Include="Util\EnumToCollectionConverter.cs" />
<Compile Include="Util\ExpandableListConverter.cs" />
<Compile Include="Util\GlobalStructures.cs" /> <Compile Include="Util\GlobalStructures.cs" />
<Compile Include="Util\HighlightService.cs" /> <Compile Include="Util\HighlightService.cs" />
<Compile Include="Util\InverseBooleanConverter.cs" /> <Compile Include="Util\InverseBooleanConverter.cs" />

View File

@ -93,7 +93,10 @@ namespace ENI2.EditControls
Message targetMessage = null; Message targetMessage = null;
foreach (Message aMessage in this.Messages) foreach (Message aMessage in this.Messages)
{ {
if (aMessage.MessageNotificationClassDisplay.Equals(selectedHistory.EntityName)) if (aMessage.MessageNotificationClassDisplay.Equals(selectedHistory.EntityName) ||
(aMessage.MessageNotificationClassDisplay.Equals("BKRA") && selectedHistory.EntityName.Equals("BRKA")) ||
(aMessage.MessageNotificationClassDisplay.Equals("BKRD") && selectedHistory.EntityName.Equals("BRKD"))
)
{ {
targetMessage = aMessage; targetMessage = aMessage;
break; break;
@ -106,8 +109,10 @@ namespace ENI2.EditControls
// Fallunterscheidung: a) ISublistElement oder nicht? Falls ja müssen die anderen Elemente zusammengesucht werden // Fallunterscheidung: a) ISublistElement oder nicht? Falls ja müssen die anderen Elemente zusammengesucht werden
if(Message.IsListClass(targetMessage.MessageNotificationClass)) // Meldeklasse ist also z.B. LADG, CREW, PAS.. if(Message.IsListClass(targetMessage.MessageNotificationClass)) // Meldeklasse ist also z.B. LADG, CREW, PAS..
{ {
foreach (DatabaseEntity oldElement in targetMessage.Elements) foreach (DatabaseEntity oldElement in targetMessage.Elements)
DBManager.Instance.Delete(oldElement); DBManager.Instance.Delete(oldElement);
targetMessage.Elements.Clear();
foreach (DatabaseEntity element in selectedHistory.GetGroup(this.MessageHistories)) foreach (DatabaseEntity element in selectedHistory.GetGroup(this.MessageHistories))
{ {
targetMessage.Elements.Add(element); targetMessage.Elements.Add(element);

View File

@ -8,12 +8,12 @@
xmlns:p="clr-namespace:ENI2.Properties" xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" mc:Ignorable="d"
Title="SimplePropertyViewDialog" Height="640" Width="480" WindowStyle="ToolWindow" ResizeMode="NoResize" Title="SimplePropertyViewDialog" Height="640" Width="480" WindowStyle="ToolWindow" ResizeMode="CanResize"
Background="White"> Background="White">
<Grid> <Grid>
<xctk:PropertyGrid Name="propertyGrid" ShowPreview="False" ShowSummary="True" IsReadOnly="True" IsCategorized="True" <xctk:PropertyGrid Name="propertyGrid" ShowPreview="False" ShowSummary="True" IsReadOnly="True" IsCategorized="True"
HideInheritedProperties="True" Width="460" Height="560" ShowSearchBox="False" ShowSortOptions="False" /> HideInheritedProperties="True" ShowSearchBox="True" ShowSortOptions="True" />
</Grid> </Grid>
</enictrl:EditWindowBase> </enictrl:EditWindowBase>

View File

@ -0,0 +1,145 @@
// Copyright (c) 2019 schick Informatik
// Description: Hilfsklasse zur Darstellung von untergeordneten Listen
// im XCeed PropertyGrid
// Idee von der 2. Antwort hier:
// https://stackoverflow.com/questions/36286530/xceed-wpf-propertygrid-show-item-for-expanded-collection
using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
using System.Collections;
namespace ENI2.Util
{
#region class ENIExpandableIListConverter<T>
public class ENIExpandableIListConverter<T> : ExpandableObjectConverter
{
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
if (value is IList<T>)
{
IList<T> list = value as IList<T>;
PropertyDescriptorCollection propDescriptions = new PropertyDescriptorCollection(null);
IEnumerator enumerator = list.GetEnumerator();
int counter = -1;
while (enumerator.MoveNext())
{
counter++;
propDescriptions.Add(new ListItemPropertyDescriptor<T>(list, counter));
}
return propDescriptions;
}
else
{
return base.GetProperties(context, value, attributes);
}
}
}
#endregion
#region class ListItemPropertyDescriptor
public class ListItemPropertyDescriptor<T> : PropertyDescriptor
{
private readonly IList<T> _owner;
private readonly int index;
public ListItemPropertyDescriptor(IList<T> owner, int index) : base("[" + index + "]", null)
{
this._owner = owner;
this.index = index;
}
public override AttributeCollection Attributes
{
get
{
var attributes = TypeDescriptor.GetAttributes(GetValue(null), false);
//If the Xceed expandable object attribute is not applied then apply it
if (!attributes.OfType<ExpandableObjectAttribute>().Any())
{
attributes = AddAttribute(new ExpandableObjectAttribute(), attributes);
}
//set the xceed order attribute
return AddAttribute(new PropertyOrderAttribute(index), attributes);
}
}
private AttributeCollection AddAttribute(Attribute newAttribute, AttributeCollection oldAttributes)
{
Attribute[] newAttributes = new Attribute[oldAttributes.Count + 1];
oldAttributes.CopyTo(newAttributes, 1);
newAttributes[0] = newAttribute;
return new AttributeCollection(newAttributes);
}
public override bool CanResetValue(object component)
{
return false;
}
public override object GetValue(object component)
{
return Value;
}
private T Value
=> _owner[index];
public override void ResetValue(object component)
{
throw new NotImplementedException();
}
public override void SetValue(object component, object value)
{
_owner[index] = (T)value;
}
public override bool ShouldSerializeValue(object component)
{
return false;
}
public override Type ComponentType
=> _owner.GetType();
public override bool IsReadOnly
=> false;
public override Type PropertyType
=> Value?.GetType();
}
#endregion
#region class TypeDecorationManager
public static class TypeDecorationManager
{
public static void AddExpandableObjectConverter(Type T)
{
TypeDescriptor.AddAttributes(T, new TypeConverterAttribute(typeof(ExpandableObjectConverter)));
TypeDescriptor.AddAttributes(T, new ExpandableObjectAttribute());
}
public static void AddExpandableIListConverter<I>(Type T)
{
TypeDescriptor.AddAttributes(T, new TypeConverterAttribute(typeof(ENIExpandableIListConverter<I>)));
TypeDescriptor.AddAttributes(T, new ExpandableObjectAttribute());
}
}
#endregion
}

Binary file not shown.

View File

@ -29,5 +29,7 @@ AIS
User Mapping nach Backup-Restore der Datenbank wiederherstellen: (ausgeführt auf der importierten DB) User Mapping nach Backup-Restore der Datenbank wiederherstellen: (ausgeführt auf der importierten DB)
exec sp_change_users_login 'UPDATE_ONE', 'aisuser', 'aisuser' exec sp_change_users_login 'UPDATE_ONE', 'aisuser', 'aisuser'
exec sp_change_users_login 'REPORT' exec sp_change_users_login 'REPORT'
delete from aisposreport WHERE [Timestamp] < DATEADD(day, -3, GETDATE())

View File

@ -11,6 +11,7 @@ using System;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
@ -37,6 +38,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[Browsable(false)]
public string SublistCollectionKey { get { return "bkra"; } } public string SublistCollectionKey { get { return "bkra"; } }
#endregion #endregion

View File

@ -11,14 +11,16 @@ using System;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using Newtonsoft.Json;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<BPOL>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<BPOL>))]
public class BPOL : DatabaseEntity, ISublistContainer public class BPOL : DatabaseEntity, ISublistContainer
{ {
private ObservableCollection<DatabaseEntity> poi = new ObservableCollection<DatabaseEntity>();
public BPOL() public BPOL()
{ {
this.tablename = "[dbo].[BPOL]"; this.tablename = "[dbo].[BPOL]";
@ -36,7 +38,7 @@ namespace bsmd.database
[ENI2Validation] [ENI2Validation]
public bool? CruiseShip { get; set; } public bool? CruiseShip { get; set; }
public ObservableCollection<DatabaseEntity> PortOfItineraries { get { return this.poi; } } public ObservableCollection<PortOfItinerary> PortOfItineraries { get; private set; } = new ObservableCollection<PortOfItinerary>();
#endregion #endregion
@ -135,6 +137,8 @@ namespace bsmd.database
return null; return null;
} }
[Browsable(false)]
[JsonIgnore]
public int NumberOfExcelRows public int NumberOfExcelRows
{ {
get { return 1; } get { return 1; }
@ -198,7 +202,7 @@ namespace bsmd.database
{ {
BPOL bpol = this.MemberwiseClone() as BPOL; BPOL bpol = this.MemberwiseClone() as BPOL;
bpol.id = null; bpol.id = null;
bpol.poi = new ObservableCollection<DatabaseEntity>(); bpol.PortOfItineraries = new ObservableCollection<PortOfItinerary>();
foreach (PortOfItinerary po in this.PortOfItineraries) foreach (PortOfItinerary po in this.PortOfItineraries)
{ {

View File

@ -11,6 +11,7 @@ using System;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
@ -37,6 +38,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[Browsable(false)]
public string SublistCollectionKey { get { return "bkrd"; } } public string SublistCollectionKey { get { return "bkrd"; } }
#endregion #endregion

View File

@ -12,9 +12,13 @@ using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<CallPurpose>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<CallPurpose>))]
public class CallPurpose : DatabaseEntity, ISublistElement public class CallPurpose : DatabaseEntity, ISublistElement
{ {
@ -26,6 +30,7 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public NOA_NOD NOA_NOD { get; set; } public NOA_NOD NOA_NOD { get; set; }
[ShowReport] [ShowReport]
@ -65,7 +70,7 @@ namespace bsmd.database
} }
else else
{ {
scmd.Parameters.AddWithValue(@"ID", this.Id); scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET CallPurposeCode = @P2, CallPurposeDescription = @P3, Identifier = @P4 " + scmd.CommandText = string.Format("UPDATE {0} SET CallPurposeCode = @P2, CallPurposeDescription = @P3, Identifier = @P4 " +
"WHERE Id = @ID", this.Tablename); "WHERE Id = @ID", this.Tablename);
} }
@ -119,5 +124,5 @@ namespace bsmd.database
#endregion #endregion
} }
} }

View File

@ -773,9 +773,9 @@ namespace bsmd.database
mh.EntityValues = JsonConvert.SerializeObject(entity); mh.EntityValues = JsonConvert.SerializeObject(entity);
if (ReportingParty.CurrentReportingParty != null) if (ReportingParty.CurrentReportingParty != null)
mh.ReportingPartyId = ReportingParty.CurrentReportingParty.Id.Value; mh.ReportingPartyId = ReportingParty.CurrentReportingParty.Id.Value;
if (entity is ISublistElement) if (entity is ISublistElement sublistElement)
{ {
string stringIdentifier = ((ISublistElement)entity).Identifier; string stringIdentifier = (sublistElement).Identifier;
Regex re = new Regex(@"\d+"); Regex re = new Regex(@"\d+");
Match m = re.Match(stringIdentifier); Match m = re.Match(stringIdentifier);
if (m.Success) if (m.Success)
@ -819,7 +819,8 @@ namespace bsmd.database
{ typeof(TIEFD), typeof(TIEFD).Name }, { typeof(TIEFD), typeof(TIEFD).Name },
{ typeof(TOWA), typeof(TOWA).Name }, { typeof(TOWA), typeof(TOWA).Name },
{ typeof(TOWD), typeof(TOWD).Name }, { typeof(TOWD), typeof(TOWD).Name },
{ typeof(WAS), typeof(WAS).Name } { typeof(WAS), typeof(WAS).Name },
{ typeof(BPOL), typeof(BPOL).Name }
}; };
} }

View File

@ -18,6 +18,7 @@ using System.Xml.Serialization;
using System.IO; using System.IO;
using Newtonsoft.Json; using Newtonsoft.Json;
using log4net; using log4net;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
@ -55,9 +56,11 @@ namespace bsmd.database
/// Nachrichtentyp der abgeleiteten Meldeklassen /// Nachrichtentyp der abgeleiteten Meldeklassen
/// </summary> /// </summary>
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public Message.NotificationClass MessageNotificationClass { get; set; } public Message.NotificationClass MessageNotificationClass { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public string MessageNotificationClassDisplay public string MessageNotificationClassDisplay
{ {
get get
@ -70,35 +73,42 @@ namespace bsmd.database
/// Referenz zur eigentlichen Schiffankunft /// Referenz zur eigentlichen Schiffankunft
/// </summary> /// </summary>
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public MessageCore MessageCore { get; set; } public MessageCore MessageCore { get; set; }
/// <summary> /// <summary>
/// gemeinschaftliche Daten /// gemeinschaftliche Daten
/// </summary> /// </summary>
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public Message MessageHeader { get; set; } public Message MessageHeader { get; set; }
/// <summary> /// <summary>
/// SQL Table name to construct queries /// SQL Table name to construct queries
/// </summary> /// </summary>
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public virtual string Tablename { get { return this.tablename; } } public virtual string Tablename { get { return this.tablename; } }
/// <summary> /// <summary>
/// primary key /// primary key
/// </summary> /// </summary>
[JsonIgnore]
[Browsable(false)]
public Guid? Id { get { return this.id; } } public Guid? Id { get { return this.id; } }
/// <summary> /// <summary>
/// IsNew Flag /// IsNew Flag
/// </summary> /// </summary>
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public bool IsNew { get { return !this.id.HasValue; } } public bool IsNew { get { return !this.id.HasValue; } }
/// <summary> /// <summary>
/// Flag zeigt an ob das Objekt geändert wurde /// Flag zeigt an ob das Objekt geändert wurde
/// </summary> /// </summary>
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public bool IsDirty { get; set; } public bool IsDirty { get; set; }
#endregion #endregion
@ -314,6 +324,7 @@ namespace bsmd.database
#region IMessageParagraph implementation #region IMessageParagraph implementation
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public virtual string Title public virtual string Title
{ {
get get
@ -324,12 +335,14 @@ namespace bsmd.database
} }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public virtual string Subtitle public virtual string Subtitle
{ {
get { return string.Empty; } get { return string.Empty; }
} }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public virtual bool ShowChildrenAsTable public virtual bool ShowChildrenAsTable
{ {
get { return false; } get { return false; }
@ -339,6 +352,7 @@ namespace bsmd.database
/// must be overridden if it must make sense /// must be overridden if it must make sense
/// </summary> /// </summary>
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public virtual List<KeyValuePair<string, string>> MessageText public virtual List<KeyValuePair<string, string>> MessageText
{ {
get { get {
@ -399,6 +413,7 @@ namespace bsmd.database
} }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public virtual List<IMessageParagraph> ChildParagraphs { get { return null; } } public virtual List<IMessageParagraph> ChildParagraphs { get { return null; } }
#endregion #endregion

View File

@ -7,12 +7,17 @@
// //
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved. // Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data.SqlClient; using System.Data.SqlClient;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<HAZ>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<HAZ>))]
public class HAZ : DatabaseEntity, ISublistContainer public class HAZ : DatabaseEntity, ISublistContainer
{ {
@ -82,6 +87,8 @@ namespace bsmd.database
[ENI2Validation] [ENI2Validation]
public string TransmissionType { get; set; } public string TransmissionType { get; set; }
[Browsable(false)]
[JsonIgnore]
public bool HasPositions public bool HasPositions
{ {
get get
@ -98,6 +105,8 @@ namespace bsmd.database
/// <summary> /// <summary>
/// Hilfsstruktur für Packagetype Darstellung (IMDG) im ENI-2 /// Hilfsstruktur für Packagetype Darstellung (IMDG) im ENI-2
/// </summary> /// </summary>
[JsonIgnore]
[Browsable(false)]
public static Dictionary<string, string> PackageTypes { get; set; } public static Dictionary<string, string> PackageTypes { get; set; }
#endregion #endregion
@ -324,6 +333,8 @@ namespace bsmd.database
return null; return null;
} }
[Browsable(false)]
[JsonIgnore]
public int NumberOfExcelRows { get { return 0; } } public int NumberOfExcelRows { get { return 0; } }
public IGCPosition GetIGCPositionWithIdentifier(string identifier) public IGCPosition GetIGCPositionWithIdentifier(string identifier)
@ -434,7 +445,7 @@ namespace bsmd.database
{ {
MessageParagraph containerParagraph = new MessageParagraph(); MessageParagraph containerParagraph = new MessageParagraph();
containerParagraph.Title = "IMDGPositions"; containerParagraph.Title = "IMDGPositions";
List<IMessageParagraph> sublist = new List<IMessageParagraph>(); //List<IMessageParagraph> sublist = new List<IMessageParagraph>();
foreach (IMessageParagraph imp in this.IMDGPositions) foreach (IMessageParagraph imp in this.IMDGPositions)
containerParagraph.ChildParagraphs.Add(imp); containerParagraph.ChildParagraphs.Add(imp);
allChildParagraphs.Add(containerParagraph); allChildParagraphs.Add(containerParagraph);
@ -444,7 +455,7 @@ namespace bsmd.database
{ {
MessageParagraph containerParagraph = new MessageParagraph(); MessageParagraph containerParagraph = new MessageParagraph();
containerParagraph.Title = "IBCPositions"; containerParagraph.Title = "IBCPositions";
List<IMessageParagraph> sublist = new List<IMessageParagraph>(); //List<IMessageParagraph> sublist = new List<IMessageParagraph>();
foreach (IMessageParagraph imp in this.IBCPositions) foreach (IMessageParagraph imp in this.IBCPositions)
containerParagraph.ChildParagraphs.Add(imp); containerParagraph.ChildParagraphs.Add(imp);
allChildParagraphs.Add(containerParagraph); allChildParagraphs.Add(containerParagraph);
@ -454,7 +465,7 @@ namespace bsmd.database
{ {
MessageParagraph containerParagraph = new MessageParagraph(); MessageParagraph containerParagraph = new MessageParagraph();
containerParagraph.Title = "IGCPositions"; containerParagraph.Title = "IGCPositions";
List<IMessageParagraph> sublist = new List<IMessageParagraph>(); //List<IMessageParagraph> sublist = new List<IMessageParagraph>();
foreach (IMessageParagraph imp in this.IGCPositions) foreach (IMessageParagraph imp in this.IGCPositions)
containerParagraph.ChildParagraphs.Add(imp); containerParagraph.ChildParagraphs.Add(imp);
allChildParagraphs.Add(containerParagraph); allChildParagraphs.Add(containerParagraph);
@ -464,7 +475,7 @@ namespace bsmd.database
{ {
MessageParagraph containerParagraph = new MessageParagraph(); MessageParagraph containerParagraph = new MessageParagraph();
containerParagraph.Title = "IMSBCPositions"; containerParagraph.Title = "IMSBCPositions";
List<IMessageParagraph> sublist = new List<IMessageParagraph>(); //List<IMessageParagraph> sublist = new List<IMessageParagraph>();
foreach (IMessageParagraph imp in this.IMSBCPositions) foreach (IMessageParagraph imp in this.IMSBCPositions)
containerParagraph.ChildParagraphs.Add(imp); containerParagraph.ChildParagraphs.Add(imp);
allChildParagraphs.Add(containerParagraph); allChildParagraphs.Add(containerParagraph);
@ -474,7 +485,7 @@ namespace bsmd.database
{ {
MessageParagraph containerParagraph = new MessageParagraph(); MessageParagraph containerParagraph = new MessageParagraph();
containerParagraph.Title = "MARPOLPositions"; containerParagraph.Title = "MARPOLPositions";
List<IMessageParagraph> sublist = new List<IMessageParagraph>(); //List<IMessageParagraph> sublist = new List<IMessageParagraph>();
foreach (IMessageParagraph imp in this.MARPOLPositions) foreach (IMessageParagraph imp in this.MARPOLPositions)
containerParagraph.ChildParagraphs.Add(imp); containerParagraph.ChildParagraphs.Add(imp);
allChildParagraphs.Add(containerParagraph); allChildParagraphs.Add(containerParagraph);

View File

@ -9,6 +9,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Reflection; using System.Reflection;
@ -17,6 +18,9 @@ using Newtonsoft.Json;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<IBCPosition>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<IBCPosition>))]
public class IBCPosition : DatabaseEntity, ISublistElement public class IBCPosition : DatabaseEntity, ISublistElement
{ {
@ -58,6 +62,7 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public HAZ HAZ { get; set; } public HAZ HAZ { get; set; }
[ShowReport] [ShowReport]
@ -158,6 +163,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public string SublistCollectionKey { get { return "ibc"; } } public string SublistCollectionKey { get { return "ibc"; } }
#endregion #endregion

View File

@ -9,12 +9,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<IGCPosition>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<IGCPosition>))]
public class IGCPosition : DatabaseEntity, ISublistElement public class IGCPosition : DatabaseEntity, ISublistElement
{ {
@ -26,6 +30,7 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public HAZ HAZ { get; set; } public HAZ HAZ { get; set; }
[ShowReport] [ShowReport]
@ -75,6 +80,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public string SublistCollectionKey { get { return "igc"; } } public string SublistCollectionKey { get { return "igc"; } }
#endregion #endregion
@ -106,7 +112,7 @@ namespace bsmd.database
} }
else else
{ {
scmd.Parameters.AddWithValue(@"ID", this.Id); scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET UNNumber = @P2, IMOClass = @P3, ProductName = @P4, " + scmd.CommandText = string.Format("UPDATE {0} SET UNNumber = @P2, IMOClass = @P3, ProductName = @P4, " +
"Quantity_KGM = @P5, StowagePosition = @P6, PortOfLoading = @P7, PortOfDischarge = @P8, Remarks = @P9, " + "Quantity_KGM = @P5, StowagePosition = @P6, PortOfLoading = @P7, PortOfDischarge = @P8, Remarks = @P9, " +
"Identifier = @P10 WHERE ID = @ID", this.Tablename); "Identifier = @P10 WHERE ID = @ID", this.Tablename);

View File

@ -9,6 +9,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Text; using System.Text;
@ -17,6 +18,9 @@ using Newtonsoft.Json;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<IMDGPosition>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<IMDGPosition>))]
public class IMDGPosition : DatabaseEntity, ISublistElement public class IMDGPosition : DatabaseEntity, ISublistElement
{ {
public IMDGPosition() public IMDGPosition()
@ -27,6 +31,7 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public HAZ HAZ { get; set; } public HAZ HAZ { get; set; }
[ShowReport] [ShowReport]
@ -326,7 +331,7 @@ namespace bsmd.database
} }
else else
{ {
scmd.Parameters.AddWithValue(@"ID", this.Id); scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET UNNumber = @P2, PackingGroup = @P3, ProperShippingName = @P4, " + scmd.CommandText = string.Format("UPDATE {0} SET UNNumber = @P2, PackingGroup = @P3, ProperShippingName = @P4, " +
"IMOClass = @P5, CompatibilityGroup = @P6, TechnicalName = @P7, NetExplosiveMass_KGM = @P8, " + "IMOClass = @P5, CompatibilityGroup = @P6, TechnicalName = @P7, NetExplosiveMass_KGM = @P8, " +
"Flashpoint_CEL = @P9, Class7NuclideName = @P10, Class7MaxActivity_BQL = @P11, Class7Category = @P12, " + "Flashpoint_CEL = @P9, Class7NuclideName = @P10, Class7MaxActivity_BQL = @P11, Class7Category = @P12, " +
@ -454,7 +459,7 @@ namespace bsmd.database
if (!this.Flashpoint_CEL.IsNullOrEmpty()) if (!this.Flashpoint_CEL.IsNullOrEmpty())
{ {
string pattern = @"^[<>]?\-?[0-9]+(\.[0-9]+)?$"; const string pattern = @"^[<>]?\-?[0-9]+(\.[0-9]+)?$";
Regex regex = new Regex(pattern); Regex regex = new Regex(pattern);
if (!regex.IsMatch(this.Flashpoint_CEL)) if (!regex.IsMatch(this.Flashpoint_CEL))
@ -463,7 +468,7 @@ namespace bsmd.database
if(!this.IMOClass.IsNullOrEmpty()) if(!this.IMOClass.IsNullOrEmpty())
{ {
string pattern = @"^[1-9]{1}(\.[1-9]{1}([A-Z]{1})?)?$"; const string pattern = @"^[1-9]{1}(\.[1-9]{1}([A-Z]{1})?)?$";
Regex regex = new Regex(pattern); Regex regex = new Regex(pattern);
if (!regex.IsMatch(this.IMOClass)) if (!regex.IsMatch(this.IMOClass))

View File

@ -9,12 +9,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<IMSBCPosition>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<IMSBCPosition>))]
public class IMSBCPosition : DatabaseEntity, ISublistElement public class IMSBCPosition : DatabaseEntity, ISublistElement
{ {
@ -26,6 +30,7 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public HAZ HAZ { get; set; } public HAZ HAZ { get; set; }
[ShowReport] [ShowReport]
@ -80,6 +85,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public string SublistCollectionKey { get { return "imsbc"; } } public string SublistCollectionKey { get { return "imsbc"; } }
#endregion #endregion

View File

@ -9,12 +9,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<InfectedArea>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<InfectedArea>))]
public class InfectedArea : DatabaseEntity, ISublistElement public class InfectedArea : DatabaseEntity, ISublistElement
{ {
@ -26,6 +30,7 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public MDH MDH { get; set; } public MDH MDH { get; set; }
[ShowReport] [ShowReport]
@ -40,6 +45,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public string SublistCollectionKey { get { return "infectedarea"; } } public string SublistCollectionKey { get { return "infectedarea"; } }
#endregion #endregion

View File

@ -12,9 +12,13 @@ using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<LastTenPortFacilitiesCalled>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<LastTenPortFacilitiesCalled>))]
public class LastTenPortFacilitiesCalled : DatabaseEntity, ISublistElement public class LastTenPortFacilitiesCalled : DatabaseEntity, ISublistElement
{ {
@ -26,6 +30,7 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public SEC SEC { get; set; } public SEC SEC { get; set; }
[ShowReport] [ShowReport]
@ -79,6 +84,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public string SublistCollectionKey { get { return "l10pfc"; } } public string SublistCollectionKey { get { return "l10pfc"; } }
#endregion #endregion
@ -191,6 +197,6 @@ namespace bsmd.database
#endregion #endregion
} }
} }

View File

@ -9,6 +9,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -16,6 +17,9 @@ using Newtonsoft.Json;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<MARPOL_Annex_I_Position>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<MARPOL_Annex_I_Position>))]
public class MARPOL_Annex_I_Position : DatabaseEntity, ISublistElement public class MARPOL_Annex_I_Position : DatabaseEntity, ISublistElement
{ {
@ -27,6 +31,7 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public HAZ HAZ { get; set; } public HAZ HAZ { get; set; }
[ShowReport] [ShowReport]
@ -45,7 +50,7 @@ namespace bsmd.database
{ {
get get
{ {
if (this.FlashpointInformation.HasValue && (this.FlashpointInformation.Value >= 0) && (this.FlashpointInformation.Value < IBCPosition.flashpointInformations.Length)) if (this.FlashpointInformation.HasValue && (this.FlashpointInformation.Value < IBCPosition.flashpointInformations.Length))
return IBCPosition.flashpointInformations[this.FlashpointInformation.Value]; return IBCPosition.flashpointInformations[this.FlashpointInformation.Value];
return ""; return "";
} }
@ -88,6 +93,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public string SublistCollectionKey { get { return "marpol"; } } public string SublistCollectionKey { get { return "marpol"; } }
#endregion #endregion

View File

@ -12,9 +12,13 @@ using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Text; using System.Text;
using System.ComponentModel;
using Newtonsoft.Json;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<MDH>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<MDH>))]
public class MDH : DatabaseEntity, ISublistContainer public class MDH : DatabaseEntity, ISublistContainer
{ {
public MDH() public MDH()
@ -467,6 +471,8 @@ namespace bsmd.database
return null; return null;
} }
[Browsable(false)]
[JsonIgnore]
public int NumberOfExcelRows public int NumberOfExcelRows
{ {
get { return 37; } get { return 37; }
@ -557,6 +563,8 @@ namespace bsmd.database
} }
} }
[Browsable(false)]
[JsonIgnore]
public override List<IMessageParagraph> ChildParagraphs public override List<IMessageParagraph> ChildParagraphs
{ {
get get
@ -669,4 +677,32 @@ namespace bsmd.database
#endregion #endregion
} }
#region class MDHConverter
public class MDHConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, System.Type sourceType)
{
if (sourceType == typeof(string))
{
return true;
}
return base.CanConvertFrom(context, sourceType);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is string)
{
string s = value.ToString();
//s = s.Replace("\\", "");
return JsonConvert.DeserializeObject<MDH>(s);
}
return base.ConvertFrom(context, culture, value);
}
}
#endregion
} }

View File

@ -1,9 +1,13 @@
using System; // Copyright (c) 2015-present schick Informatik
// Description: Container für alle Meldeklassen
using System;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using Newtonsoft.Json;
namespace bsmd.database namespace bsmd.database
{ {
@ -629,6 +633,8 @@ namespace bsmd.database
return null; return null;
} }
[Browsable(false)]
[JsonIgnore]
public int NumberOfExcelRows public int NumberOfExcelRows
{ {
get get

View File

@ -93,29 +93,32 @@ namespace bsmd.database
int selIndex = tmpList.IndexOf(this); int selIndex = tmpList.IndexOf(this);
tmpResult.AddLast(refEntity); tmpResult.AddLast(refEntity);
int myIdentifier = Int32.Parse((sublistElement).Identifier);
// Elemente vor dem ausgewählten Element der Linked List hinzufügen // Elemente vor dem ausgewählten Element der Linked List hinzufügen
int indexIdentifier = myIdentifier; int indexIdentifier = Util.GetNumericIdentifier(sublistElement).Value;
int refIdentifier = indexIdentifier;
for (int tmpIndex = selIndex - 1; (indexIdentifier != 1) && (tmpIndex >= 0); tmpIndex--)
for (int tmpIndex = selIndex - 1; tmpIndex >= 0; tmpIndex--)
{ {
DatabaseEntity prevEntity = tmpList[tmpIndex].CreateObjectFromValues() as DatabaseEntity; DatabaseEntity prevEntity = tmpList[tmpIndex].CreateObjectFromValues() as DatabaseEntity;
indexIdentifier = Int32.Parse(((ISublistElement)prevEntity).Identifier); int nextIdentifier = Util.GetNumericIdentifier((ISublistElement)prevEntity).Value;
if (nextIdentifier >= indexIdentifier) break;
indexIdentifier = nextIdentifier;
tmpResult.AddFirst(prevEntity); tmpResult.AddFirst(prevEntity);
} }
// Elemente nach dem ausgewählten Element hinzufügen (wenn sie zur gleichen Gruppe gehören) // Elemente nach dem ausgewählten Element hinzufügen (wenn sie zur gleichen Gruppe gehören)
if ((tmpList.Count - 1) > selIndex) if ((tmpList.Count - 1) > selIndex)
{ {
DatabaseEntity nextEntity = tmpList[selIndex + 1].CreateObjectFromValues() as DatabaseEntity; indexIdentifier = refIdentifier;
indexIdentifier = Int32.Parse(((ISublistElement)nextEntity).Identifier);
for (int tmpIndex = selIndex + 2; (indexIdentifier != 1) && (tmpIndex < tmpList.Count); tmpIndex++) for (int tmpIndex = selIndex + 2; tmpIndex < tmpList.Count; tmpIndex++)
{ {
tmpResult.AddLast(nextEntity); DatabaseEntity nextEntity = tmpList[tmpIndex].CreateObjectFromValues() as DatabaseEntity;
nextEntity = tmpList[tmpIndex].CreateObjectFromValues() as DatabaseEntity; int nextIdentifier = Util.GetNumericIdentifier((ISublistElement)nextEntity).Value;
indexIdentifier = Int32.Parse(((ISublistElement)nextEntity).Identifier); if (nextIdentifier <= indexIdentifier) break;
indexIdentifier = nextIdentifier;
tmpResult.AddLast(nextEntity);
} }
} }
} }

View File

@ -12,9 +12,14 @@ using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using Newtonsoft.Json;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<NOA_NOD>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<NOA_NOD>))]
public class NOA_NOD : DatabaseEntity, ISublistContainer public class NOA_NOD : DatabaseEntity, ISublistContainer
{ {
public NOA_NOD() public NOA_NOD()
@ -35,7 +40,7 @@ namespace bsmd.database
public DateTime? ETDFromPortOfCall { get; set; } public DateTime? ETDFromPortOfCall { get; set; }
[Validation1(ValidationCode.LIST_EMPTY)] [Validation1(ValidationCode.LIST_EMPTY)]
public ObservableCollection<CallPurpose> CallPurposes { get; } = new ObservableCollection<CallPurpose>(); public ObservableCollection<CallPurpose> CallPurposes { get; set; } = new ObservableCollection<CallPurpose>();
[ShowReport] [ShowReport]
[Validation2(ValidationCode.NOT_NULL)] [Validation2(ValidationCode.NOT_NULL)]
@ -184,6 +189,8 @@ namespace bsmd.database
return null; return null;
} }
[Browsable(false)]
[JsonIgnore]
public int NumberOfExcelRows public int NumberOfExcelRows
{ {
get { return 3; } get { return 3; }
@ -210,6 +217,7 @@ namespace bsmd.database
#region IMessageParagraph implementation #region IMessageParagraph implementation
[Browsable(false)]
public override string Subtitle public override string Subtitle
{ {
get get
@ -218,6 +226,7 @@ namespace bsmd.database
} }
} }
[Browsable(false)]
public override List<IMessageParagraph> ChildParagraphs public override List<IMessageParagraph> ChildParagraphs
{ {
get get
@ -350,5 +359,5 @@ namespace bsmd.database
#endregion #endregion
} }
} }

View File

@ -0,0 +1,74 @@
// Copyright (c) 2015-2017 schick Informatik
// Description: Helper Klasse damit die Deserialisierung richtig funktioniert, auch wenn man
// einen TypeConverter auf die Klasse loslässt..
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.ComponentModel;
namespace bsmd.database
{
public class NoTypeConverterJsonConverter<T> : JsonConverter
{
private static readonly IContractResolver resolver = new NoTypeConverterContractResolver();
private class NoTypeConverterContractResolver : DefaultContractResolver
{
protected override JsonContract CreateContract(Type objectType)
{
if (typeof(T).IsAssignableFrom(objectType))
{
var contract = this.CreateObjectContract(objectType);
contract.Converter = null; // Also null out the converter to prevent infinite recursion.
return contract;
}
return base.CreateContract(objectType);
}
}
public override bool CanConvert(Type objectType)
{
return typeof(T).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
return JsonSerializer.CreateDefault(new JsonSerializerSettings { ContractResolver = resolver }).Deserialize(reader, objectType);
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
JsonSerializer.CreateDefault(new JsonSerializerSettings { ContractResolver = resolver }).Serialize(writer, value);
}
}
#region class MessageClassConverter
public class MessageClassConverter<T> : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, System.Type sourceType)
{
if (sourceType == typeof(string))
{
return true;
}
return base.CanConvertFrom(context, sourceType);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is string)
{
string s = value.ToString();
//s = s.Replace("\\", "");
return JsonConvert.DeserializeObject<T>(s);
}
return base.ConvertFrom(context, culture, value);
}
}
#endregion
}

View File

@ -13,9 +13,13 @@ using System.Text;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<PortOfCallLast30Days>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<PortOfCallLast30Days>))]
public class PortOfCallLast30Days : DatabaseEntity, ISublistElement, ISublistContainer public class PortOfCallLast30Days : DatabaseEntity, ISublistElement, ISublistContainer
{ {
public PortOfCallLast30Days() public PortOfCallLast30Days()
@ -26,9 +30,11 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public MDH MDH { get; set; } public MDH MDH { get; set; }
public List<PortOfCallLast30DaysCrewJoinedShip> CrewJoinedShip { get; private set; } = new List<PortOfCallLast30DaysCrewJoinedShip>(); public List<PortOfCallLast30DaysCrewJoinedShip> CrewJoinedShip { get; private set; } = new List<PortOfCallLast30DaysCrewJoinedShip>();
[ShowReport] [ShowReport]
[Validation2(ValidationCode.LOCODE)] [Validation2(ValidationCode.LOCODE)]
[MaxLength(5)] [MaxLength(5)]
@ -48,6 +54,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public string SublistCollectionKey { get { return "pocl30d"; } } public string SublistCollectionKey { get { return "pocl30d"; } }
/// <summary> /// <summary>
@ -205,6 +212,8 @@ namespace bsmd.database
return null; return null;
} }
[Browsable(false)]
[JsonIgnore]
public int NumberOfExcelRows public int NumberOfExcelRows
{ {
get { return 1; } get { return 1; }

View File

@ -12,9 +12,13 @@ using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<PortOfCallLast30DaysCrewJoinedShip>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<PortOfCallLast30DaysCrewJoinedShip>))]
public class PortOfCallLast30DaysCrewJoinedShip : DatabaseEntity, ISublistElement public class PortOfCallLast30DaysCrewJoinedShip : DatabaseEntity, ISublistElement
{ {

View File

@ -12,9 +12,12 @@ using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<PortOfItinerary>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<PortOfItinerary>))]
public class PortOfItinerary : DatabaseEntity, ISublistElement public class PortOfItinerary : DatabaseEntity, ISublistElement
{ {
@ -26,6 +29,7 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public BPOL BPOL { get; set; } public BPOL BPOL { get; set; }
[ShowReport] [ShowReport]
@ -46,6 +50,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public string SublistCollectionKey { get { return "poi"; } } public string SublistCollectionKey { get { return "poi"; } }
#endregion #endregion
@ -72,7 +77,7 @@ namespace bsmd.database
} }
else else
{ {
scmd.Parameters.AddWithValue(@"ID", this.Id); scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET PortOfItineraryName = @P2, PortOfItineraryETA = @P3, " + scmd.CommandText = string.Format("UPDATE {0} SET PortOfItineraryName = @P2, PortOfItineraryETA = @P3, " +
"PortOfItineraryLocode = @P5, Identifier = @P4 WHERE Id = @ID", this.Tablename); "PortOfItineraryLocode = @P5, Identifier = @P4 WHERE Id = @ID", this.Tablename);
} }

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("5.2.0")] [assembly: AssemblyInformationalVersion("5.2.1")]
[assembly: AssemblyCopyright("Copyright © 2014-2019 schick Informatik")] [assembly: AssemblyCopyright("Copyright © 2014-2019 schick Informatik")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]

View File

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

View File

@ -12,9 +12,14 @@ using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using Newtonsoft.Json;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<SEC>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<SEC>))]
public class SEC : DatabaseEntity, ISublistContainer public class SEC : DatabaseEntity, ISublistContainer
{ {
public SEC() public SEC()
@ -84,6 +89,7 @@ namespace bsmd.database
[ENI2Validation] [ENI2Validation]
public byte? ISSCType { get; set; } public byte? ISSCType { get; set; }
[JsonIgnore]
[ShowReport] [ShowReport]
[ReportDisplayName("ISSC type")] [ReportDisplayName("ISSC type")]
public string ISSCTypeDisplay { get { return Util.GetISSCTypeDisplay(this.ISSCType); } } public string ISSCTypeDisplay { get { return Util.GetISSCTypeDisplay(this.ISSCType); } }
@ -93,6 +99,7 @@ namespace bsmd.database
// [LookupName("SEC.ISSCIssuerType")] // wird manuell gescannt und konvertiert // [LookupName("SEC.ISSCIssuerType")] // wird manuell gescannt und konvertiert
public byte? ISSCIssuerType { get; set; } public byte? ISSCIssuerType { get; set; }
[JsonIgnore]
[ShowReport] [ShowReport]
[ReportDisplayName("ISSC issuer type")] [ReportDisplayName("ISSC issuer type")]
public string ISSCIssuerTypeDisplay { get { return Util.GetISSCIssuerTypeDisplay(this.ISSCIssuerType); } } public string ISSCIssuerTypeDisplay { get { return Util.GetISSCIssuerTypeDisplay(this.ISSCIssuerType); } }
@ -337,6 +344,7 @@ namespace bsmd.database
#region IMessageParagraph implementation #region IMessageParagraph implementation
[Browsable(false)]
public override string Subtitle public override string Subtitle
{ {
get get
@ -358,6 +366,8 @@ namespace bsmd.database
} }
} }
[Browsable(false)]
[JsonIgnore]
int ISublistContainer.NumberOfExcelRows int ISublistContainer.NumberOfExcelRows
{ {
get get
@ -489,5 +499,5 @@ namespace bsmd.database
#endregion #endregion
} }
} }

View File

@ -11,6 +11,8 @@ using System;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
@ -89,6 +91,7 @@ namespace bsmd.database
public string TransportMode { get; set; } public string TransportMode { get; set; }
[ShowReport] [ShowReport]
[JsonIgnore]
public string TransportModeDisplay public string TransportModeDisplay
{ {
get get
@ -145,6 +148,7 @@ namespace bsmd.database
[ENI2Validation] [ENI2Validation]
public string ISMCompanyCountry { get; set; } public string ISMCompanyCountry { get; set; }
[Browsable(false)]
public override string Subtitle public override string Subtitle
{ {
get get
@ -166,8 +170,10 @@ namespace bsmd.database
[ENI2Validation] [ENI2Validation]
public string CertificateOfRegistryNumber { get; set; } public string CertificateOfRegistryNumber { get; set; }
[JsonIgnore]
public static Dictionary<string, string> VesselTypeDict { get; set; } public static Dictionary<string, string> VesselTypeDict { get; set; }
[JsonIgnore]
public static Dictionary<string, string> TransportModeDict { get; set; } public static Dictionary<string, string> TransportModeDict { get; set; }
#endregion #endregion

View File

@ -13,9 +13,13 @@ using System.Collections.Generic;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Data; using System.Data;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<SanitaryMeasuresDetail>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<SanitaryMeasuresDetail>))]
public class SanitaryMeasuresDetail : DatabaseEntity, ISublistElement public class SanitaryMeasuresDetail : DatabaseEntity, ISublistElement
{ {
@ -48,6 +52,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public string SublistCollectionKey { get { return "smd"; } } public string SublistCollectionKey { get { return "smd"; } }
#endregion #endregion
@ -125,4 +130,32 @@ namespace bsmd.database
} }
#region class SanitaryMeasuresDetailConverter
public class SanitaryMeasuresDetailConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, System.Type sourceType)
{
if (sourceType == typeof(string))
{
return true;
}
return base.CanConvertFrom(context, sourceType);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is string)
{
string s = value.ToString();
//s = s.Replace("\\", "");
return JsonConvert.DeserializeObject<SanitaryMeasuresDetail>(s);
}
return base.ConvertFrom(context, culture, value);
}
}
#endregion
} }

View File

@ -12,9 +12,12 @@ using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<ShipToShipActivitiesDuringLastTenPortFacilitiesCalled>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<ShipToShipActivitiesDuringLastTenPortFacilitiesCalled>))]
public class ShipToShipActivitiesDuringLastTenPortFacilitiesCalled : DatabaseEntity, ISublistElement public class ShipToShipActivitiesDuringLastTenPortFacilitiesCalled : DatabaseEntity, ISublistElement
{ {
@ -26,6 +29,7 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public SEC SEC { get; set; } public SEC SEC { get; set; }
[ShowReport] [ShowReport]
@ -74,6 +78,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public string SublistCollectionKey { get { return "s2s"; } } public string SublistCollectionKey { get { return "s2s"; } }
#endregion #endregion
@ -109,7 +114,7 @@ namespace bsmd.database
} }
else else
{ {
scmd.Parameters.AddWithValue(@"ID", this.Id); scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET ShipToShipActivityLocationName = @P2, ShipToShipActivityLocationLoCode = @P3, " + scmd.CommandText = string.Format("UPDATE {0} SET ShipToShipActivityLocationName = @P2, ShipToShipActivityLocationLoCode = @P3, " +
"ShipToShipActivityLocationCoordinatesLatitude = @P4, ShipToShipActivityLocationCoordinatesLongitude = @P5, ShipToShipActivityDateFrom = @P6," + "ShipToShipActivityLocationCoordinatesLatitude = @P4, ShipToShipActivityLocationCoordinatesLongitude = @P5, ShipToShipActivityDateFrom = @P6," +
"ShipToShipActivityDateTo = @P7, ShipToShipActivityType = @P8, ShipToShipActivitySecurityMattersToReport = @P9, Identifier = @P10, " + "ShipToShipActivityDateTo = @P7, ShipToShipActivityType = @P8, ShipToShipActivitySecurityMattersToReport = @P9, Identifier = @P10, " +
@ -210,4 +215,5 @@ namespace bsmd.database
#endregion #endregion
} }
} }

View File

@ -13,9 +13,13 @@ using System.Collections.Generic;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Data; using System.Data;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<StowawaysJoiningLocation>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<StowawaysJoiningLocation>))]
public class StowawaysJoiningLocation : DatabaseEntity, ISublistElement public class StowawaysJoiningLocation : DatabaseEntity, ISublistElement
{ {
@ -27,6 +31,7 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public MDH MDH { get; set; } public MDH MDH { get; set; }
[ShowReport] [ShowReport]

View File

@ -212,6 +212,21 @@ namespace bsmd.database
return result; return result;
} }
public static int? GetNumericIdentifier(ISublistElement element)
{
if (element != null)
{
string stringIdentifier = element.Identifier;
Regex re = new Regex(@"\d+");
Match m = re.Match(stringIdentifier);
if (m.Success)
{
return Int32.Parse(m.Value);
}
}
return null;
}
#region CoordinateTransformation #region CoordinateTransformation
public static double NSWToDecimalDegrees(int nswCoordinate) public static double NSWToDecimalDegrees(int nswCoordinate)

View File

@ -12,9 +12,14 @@ using System.Text;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using Newtonsoft.Json;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<WAS>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<WAS>))]
public class WAS : DatabaseEntity, ISublistContainer public class WAS : DatabaseEntity, ISublistContainer
{ {
public WAS() public WAS()
@ -25,12 +30,16 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore]
public static int[] DKWasteCodes { get; } = { 1100, 1200, 1300, 2100, 2200, 2300, 2311, 2308, 2600, 2300, 2309, 3000, 5100, 5200, 5300, 2300 }; public static int[] DKWasteCodes { get; } = { 1100, 1200, 1300, 2100, 2200, 2300, 2311, 2308, 2600, 2300, 2309, 3000, 5100, 5200, 5300, 2300 };
[JsonIgnore]
public static string[] DKWasteTypes { get; } = { "Waste oils - Sludge", "Waste oils - Bilge water", "Waste oils - Other", "Garbage - Food waste", "Garbage - Plastic", "Garbage - Other", "Garbage - Other - Cooking oil", "Garbage - Other - Incinerator ashes and clinkers", "Operational wastes", "Garbage - Other", "Garbage - Other - Animal carcasses", "Sewage", "Cargo residues - Marpol Annex I - Other", "Cargo residues - Marpol Annex II - Other", "Cargo residues - Marpol Annex V - Other", "Garbage - Other" }; public static string[] DKWasteTypes { get; } = { "Waste oils - Sludge", "Waste oils - Bilge water", "Waste oils - Other", "Garbage - Food waste", "Garbage - Plastic", "Garbage - Other", "Garbage - Other - Cooking oil", "Garbage - Other - Incinerator ashes and clinkers", "Operational wastes", "Garbage - Other", "Garbage - Other - Animal carcasses", "Sewage", "Cargo residues - Marpol Annex I - Other", "Cargo residues - Marpol Annex II - Other", "Cargo residues - Marpol Annex V - Other", "Garbage - Other" };
[JsonIgnore]
public static int[] RequiredCodes { get; } = { 1100, 1200, 1300, 2100, 2200, 2300, 2311, 2308, 2600, 2309, 3000, 5100, 5200, 5300 }; public static int[] RequiredCodes { get; } = { 1100, 1200, 1300, 2100, 2200, 2300, 2311, 2308, 2600, 2309, 3000, 5100, 5200, 5300 };
[JsonIgnore]
public static string[] RequiredTypes { get; } = { "Oily Residues (sludge)", "Oily Bilge Water", "Waste oil - others (specify)", "Food waste", "Plastics", "Domestic wastes", "Cooking oil", "Incinerator ashes", "Operational wastes", "Animal carcass(es)", "Sewage", "Cargo residues - Marpol Annex I", "Cargo residues - Marpol Annex II", "Cargo residues - Marpol Annex V" }; public static string[] RequiredTypes { get; } = { "Oily Residues (sludge)", "Oily Bilge Water", "Waste oil - others (specify)", "Food waste", "Plastics", "Domestic wastes", "Cooking oil", "Incinerator ashes", "Operational wastes", "Animal carcass(es)", "Sewage", "Cargo residues - Marpol Annex I", "Cargo residues - Marpol Annex II", "Cargo residues - Marpol Annex V" };
[ShowReport] [ShowReport]
@ -64,9 +73,10 @@ namespace bsmd.database
[LookupName("WAS.ConfirmationOfSufficiency")] [LookupName("WAS.ConfirmationOfSufficiency")]
[ENI2Validation] [ENI2Validation]
public bool? ConfirmationOfSufficiency { get; set; } public bool? ConfirmationOfSufficiency { get; set; }
public ObservableCollection<Waste> Waste { get; private set; } = new ObservableCollection<Waste>(); public ObservableCollection<Waste> Waste { get; private set; } = new ObservableCollection<Waste>();
[Browsable(false)]
public ObservableCollection<WasteDisposalServiceProvider> WasteDisposalServiceProvider { get; private set; } = new ObservableCollection<WasteDisposalServiceProvider>(); public ObservableCollection<WasteDisposalServiceProvider> WasteDisposalServiceProvider { get; private set; } = new ObservableCollection<WasteDisposalServiceProvider>();
/// <summary> /// <summary>
@ -270,6 +280,8 @@ namespace bsmd.database
return null; return null;
} }
[Browsable(false)]
[JsonIgnore]
public int NumberOfExcelRows public int NumberOfExcelRows
{ {
get { return 15; } get { return 15; }
@ -307,6 +319,8 @@ namespace bsmd.database
#region IMessageParagraph implementation #region IMessageParagraph implementation
[Browsable(false)]
[JsonIgnore]
public override string Subtitle public override string Subtitle
{ {
get get
@ -315,6 +329,8 @@ namespace bsmd.database
} }
} }
[Browsable(false)]
[JsonIgnore]
public override List<IMessageParagraph> ChildParagraphs public override List<IMessageParagraph> ChildParagraphs
{ {
get get
@ -514,5 +530,5 @@ namespace bsmd.database
#endregion #endregion
} }
} }

View File

@ -10,9 +10,13 @@
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel;
namespace bsmd.database namespace bsmd.database
{ {
[TypeConverter(typeof(MessageClassConverter<Waste>))]
[JsonConverter(typeof(NoTypeConverterJsonConverter<Waste>))]
public class Waste : DatabaseEntity, ISublistElement public class Waste : DatabaseEntity, ISublistElement
{ {
@ -24,9 +28,11 @@ namespace bsmd.database
#region Properties #region Properties
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public WAS WAS { get; set; } public WAS WAS { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
[ShowReport] [ShowReport]
public string WasteTypeDisplay public string WasteTypeDisplay
{ {
@ -128,6 +134,7 @@ namespace bsmd.database
public string Identifier { get; set; } public string Identifier { get; set; }
[JsonIgnore] [JsonIgnore]
[Browsable(false)]
public string SublistCollectionKey { get { return "waste"; } } public string SublistCollectionKey { get { return "waste"; } }
[JsonIgnore] [JsonIgnore]
@ -261,5 +268,5 @@ namespace bsmd.database
#endregion #endregion
} }
} }

View File

@ -81,6 +81,7 @@
<Compile Include="LookupNameAttribute.cs" /> <Compile Include="LookupNameAttribute.cs" />
<Compile Include="MARPOL_Annex_I_Position.cs" /> <Compile Include="MARPOL_Annex_I_Position.cs" />
<Compile Include="MessageHistory.cs" /> <Compile Include="MessageHistory.cs" />
<Compile Include="NoTypeConverterJsonConverter.cs" />
<Compile Include="PortArea.cs" /> <Compile Include="PortArea.cs" />
<Compile Include="Properties\AssemblyProductInfo.cs" /> <Compile Include="Properties\AssemblyProductInfo.cs" />
<Compile Include="Properties\AssemblyProjectInfo.cs" /> <Compile Include="Properties\AssemblyProjectInfo.cs" />

View File

@ -5,7 +5,7 @@ extensions: .cs .cpp .h
extensions: .aspx .ascx extensions: .aspx .ascx
<%-- <%--
Copyright (c) 2015-2017 schick Informatik Copyright (c) 2015-present schick Informatik
--%> --%>
extensions: .vb extensions: .vb
'Sample license text. 'Sample license text.