Änderungen Version 5.7
This commit is contained in:
parent
97bf74721a
commit
849578d7a2
@ -291,7 +291,7 @@ namespace ENI2.DetailViewControls
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -305,27 +305,37 @@ namespace ENI2.DetailViewControls
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.FieldCount < 2)
|
||||
if (reader.FieldCount < 3)
|
||||
{
|
||||
throw new InvalidDataException("Sheet must have at least 2 Columns of data");
|
||||
throw new InvalidDataException("Sheet must have at least 3 Columns of data");
|
||||
}
|
||||
PortOfCallLast30Days poc30 = new PortOfCallLast30Days();
|
||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
||||
if (!reader.IsDBNull(0)) poc30.PortOfCallLast30DaysLocode = reader.GetString(0);
|
||||
if (!reader.IsDBNull(1)) poc30.PortOfCallLast30DaysDateOfDeparture = reader.GetDateTime(1);
|
||||
// if (DateTime.TryParse(reader.GetString(1), out DateTime dateOfDep))
|
||||
// poc30.PortOfCallLast30DaysDateOfDeparture = dateOfDep;
|
||||
if (!reader.IsDBNull(2) && !reader.GetString(2).IsNullOrEmpty()) poc30.PortOfCallLast30DaysCrewMembersJoined = true;
|
||||
|
||||
for (int colIndex = 2; (colIndex < reader.FieldCount) && !reader.IsDBNull(colIndex); colIndex++)
|
||||
string boolString = "";
|
||||
if (!reader.IsDBNull(2)) boolString = reader.GetString(2);
|
||||
poc30.PortOfCallLast30DaysCrewMembersJoined = (boolString.Equals("y", StringComparison.OrdinalIgnoreCase) || (boolString.Equals("yes", StringComparison.OrdinalIgnoreCase)) ||
|
||||
(boolString.Equals("j", StringComparison.OrdinalIgnoreCase)));
|
||||
|
||||
if(reader.FieldCount > 3)
|
||||
{
|
||||
string crewName = reader.GetString(colIndex);
|
||||
if (crewName.IsNullOrEmpty()) break;
|
||||
PortOfCallLast30DaysCrewJoinedShip poc30Crew = new PortOfCallLast30DaysCrewJoinedShip();
|
||||
poc30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewName;
|
||||
poc30Crew.PortOfCallLast30Days = poc30;
|
||||
poc30.CrewJoinedShip.Add(poc30Crew);
|
||||
}
|
||||
string allNewCrew = reader.GetString(3)?.Trim();
|
||||
if(!allNewCrew.IsNullOrEmpty())
|
||||
{
|
||||
string[] crewNames = allNewCrew.Split(',', ';');
|
||||
for(int i=0;i<crewNames.Length;i++)
|
||||
{
|
||||
string crewName = crewNames[i].Trim();
|
||||
if (crewName.IsNullOrEmpty()) continue;
|
||||
PortOfCallLast30DaysCrewJoinedShip poc30Crew = new PortOfCallLast30DaysCrewJoinedShip();
|
||||
poc30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewName;
|
||||
poc30Crew.PortOfCallLast30Days = poc30;
|
||||
poc30.CrewJoinedShip.Add(poc30Crew);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
poc30.MDH = this._mdh;
|
||||
this._mdh.PortOfCallLast30Days.Add(poc30);
|
||||
|
||||
@ -249,7 +249,7 @@ namespace ENI2.DetailViewControls
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,14 @@
|
||||
SelectionMode="Single" AutoGenerateColumns="False" Margin="5,5,5,0" x:Name="dataGridMessageHistories"
|
||||
MouseDoubleClick="DataGridViolations_MouseDoubleClick" CanUserAddRows="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textType}" Binding="{Binding EntityName}" IsReadOnly="True" Width="0.05*" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textType}" Binding="{Binding EntityName}" IsReadOnly="True" Width="0.05*" >
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Background" Value="{Binding GroupColorBrush}" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textTimestamp}" Binding="{Binding Created}" IsReadOnly="True" Width="0.1*" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textReportingParty}" Binding="{Binding ReportingPartyName}" IsReadOnly="True" Width="0.15*" />
|
||||
</DataGrid.Columns>
|
||||
|
||||
@ -4,17 +4,11 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using bsmd.database;
|
||||
using ENI2.Controls;
|
||||
using log4net;
|
||||
@ -29,11 +23,22 @@ namespace ENI2.EditControls
|
||||
|
||||
private static readonly ILog _log = LogManager.GetLogger(typeof(MessageHistoryDialog));
|
||||
|
||||
private readonly Dictionary<Guid, Brush> groupColorDict = new Dictionary<Guid, Brush>();
|
||||
|
||||
public MessageHistoryDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += (o, e) =>
|
||||
{
|
||||
// "color-code" (Group) the message histories
|
||||
|
||||
foreach(MessageHistory mh in this.MessageHistories)
|
||||
{
|
||||
if (!groupColorDict.ContainsKey(mh.EntityId))
|
||||
groupColorDict[mh.EntityId] = new SolidColorBrush(Util.UIHelper.GetRandomBrightColor());
|
||||
mh.GroupColorBrush = groupColorDict[mh.EntityId];
|
||||
}
|
||||
|
||||
this.dataGridMessageHistories.ItemsSource = this.MessageHistories;
|
||||
|
||||
this.dataGridMessageHistories.ContextMenu = new ContextMenu();
|
||||
@ -94,7 +99,7 @@ namespace ENI2.EditControls
|
||||
foreach (Message aMessage in this.Messages)
|
||||
{
|
||||
if (aMessage.MessageNotificationClassDisplay.Equals(selectedHistory.EntityName) ||
|
||||
(aMessage.MessageNotificationClassDisplay.Equals("BKRA") && selectedHistory.EntityName.Equals("BRKA")) ||
|
||||
(aMessage.MessageNotificationClassDisplay.Equals("BKRA") && selectedHistory.EntityName.Equals("BRKA")) || // blöder Schreibfehler beachten
|
||||
(aMessage.MessageNotificationClassDisplay.Equals("BKRD") && selectedHistory.EntityName.Equals("BRKD"))
|
||||
)
|
||||
{
|
||||
|
||||
@ -7,6 +7,7 @@ using System;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace ENI2.Util
|
||||
@ -15,6 +16,7 @@ namespace ENI2.Util
|
||||
{
|
||||
|
||||
private static bool isBusy;
|
||||
private static readonly Random r = new Random();
|
||||
|
||||
public static void SetBusyState()
|
||||
{
|
||||
@ -37,8 +39,7 @@ namespace ENI2.Util
|
||||
|
||||
private static void dispatcherTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
DispatcherTimer timer = sender as DispatcherTimer;
|
||||
if(timer != null)
|
||||
if (sender is DispatcherTimer timer)
|
||||
{
|
||||
SetBusyState(false);
|
||||
timer.Stop();
|
||||
@ -50,5 +51,10 @@ namespace ENI2.Util
|
||||
return (bool)typeof(Window).GetField("_showingAsDialog", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(window);
|
||||
}
|
||||
|
||||
public static Color GetRandomBrightColor()
|
||||
{
|
||||
return Color.FromRgb((byte) r.Next(150, 255), (byte) r.Next(150, 255), (byte) r.Next(150, 255));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@ -795,7 +795,7 @@ namespace bsmd.database
|
||||
}
|
||||
|
||||
// 3. MessageHistory Element speichern
|
||||
// TODO: das könnte auch in einem Background Thread passieren, da der Wert erst irgendwann gelesen wird und aktuell nicht relevant ist
|
||||
/// TODO: das könnte auch in einem Background Thread passieren, da der Wert erst irgendwann gelesen wird und aktuell nicht relevant ist
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
mh.PrepareSave(cmd);
|
||||
|
||||
@ -6,8 +6,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace bsmd.database
|
||||
{
|
||||
@ -38,6 +37,11 @@ namespace bsmd.database
|
||||
|
||||
public int Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Helper property for display grid
|
||||
/// </summary>
|
||||
public Brush GroupColorBrush { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ENI Grid helper property
|
||||
/// </summary>
|
||||
|
||||
@ -31,7 +31,7 @@ namespace bsmd.database
|
||||
[ShowReport]
|
||||
[MaxLength(99)]
|
||||
[ENI2Validation]
|
||||
[Validation(ValidationCode.NOT_NULL_MAX_LEN, 99)]
|
||||
[Validation(ValidationCode.STRING_MAXLEN, 99)]
|
||||
public string WasteDisposalServiceProviderName { get; set; }
|
||||
|
||||
[Obsolete]
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\ENI-2\ENI2\ENI2\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
|
||||
@ -19,7 +19,7 @@ namespace bsmd.dbh
|
||||
|
||||
public class Request
|
||||
{
|
||||
private static ILog _log = LogManager.GetLogger(typeof(Request));
|
||||
private static readonly ILog _log = LogManager.GetLogger(typeof(Request));
|
||||
|
||||
public static bool SendCancelCore(MessageCore core, bool useTest)
|
||||
{
|
||||
@ -31,7 +31,7 @@ namespace bsmd.dbh
|
||||
return false;
|
||||
}
|
||||
|
||||
RootType rootType = RootType.CANCEL;
|
||||
const RootType rootType = RootType.CANCEL;
|
||||
|
||||
Dbh_Osis_Answ_Ws client = new Dbh_Osis_Answ_Ws();
|
||||
if (useTest)
|
||||
@ -57,7 +57,7 @@ namespace bsmd.dbh
|
||||
{
|
||||
object[] items = new object[1];
|
||||
DateTime timestamp = DateTime.Now;
|
||||
string version = "3.0";
|
||||
const string version = "3.0";
|
||||
object item = null;
|
||||
string senderReference = core.Id.Value.ToString("N");
|
||||
items[0] = item;
|
||||
@ -76,7 +76,7 @@ namespace bsmd.dbh
|
||||
|
||||
_log.InfoFormat("Send Url: {0}", client.Url);
|
||||
|
||||
RootVersion rootVersion = RootVersion.Item50;
|
||||
const RootVersion rootVersion = RootVersion.Item50;
|
||||
|
||||
string result = client.Root(
|
||||
rootVersion,
|
||||
@ -101,6 +101,10 @@ namespace bsmd.dbh
|
||||
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
client.Dispose();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -150,7 +154,7 @@ namespace bsmd.dbh
|
||||
rp.RPType = (ReportingPartyRPType) message.ReportingParty.ReportingPartyType.Value;
|
||||
|
||||
DateTime timestamp = DateTime.Now;
|
||||
string version = "3.0";
|
||||
const string version = "3.0";
|
||||
object item = null;
|
||||
string senderReference = message.Id.Value.ToString("N");
|
||||
|
||||
@ -219,8 +223,7 @@ namespace bsmd.dbh
|
||||
#region NOA_NOD
|
||||
case Message.NotificationClass.NOA_NOD:
|
||||
{
|
||||
NOA_NOD noa_nod = message.Elements[0] as NOA_NOD;
|
||||
if (noa_nod != null)
|
||||
if (message.Elements[0] is NOA_NOD noa_nod)
|
||||
{
|
||||
RootNOA_NOD rootNoaNod = new RootNOA_NOD();
|
||||
|
||||
@ -233,10 +236,10 @@ namespace bsmd.dbh
|
||||
// rootNoaNod.ETDFromLastPortSpecified = noa_nod.ETDFromLastPort.HasValue;
|
||||
|
||||
rootNoaNod.LastPort = noa_nod.LastPort;
|
||||
rootNoaNod.NextPort = noa_nod.NextPort;
|
||||
rootNoaNod.NextPort = noa_nod.NextPort;
|
||||
|
||||
List<ItemsChoiceType> choiceList = new List<ItemsChoiceType>();
|
||||
List<object> choices = new List<object>();
|
||||
List<object> choices = new List<object>();
|
||||
|
||||
if (message.MessageCore.IsTransit)
|
||||
{
|
||||
@ -272,11 +275,11 @@ namespace bsmd.dbh
|
||||
RootNOA_NODCallPurpose rnncp = new RootNOA_NODCallPurpose();
|
||||
CallPurpose callPurpose = noa_nod.CallPurposes[i] as CallPurpose;
|
||||
rnncp.CallPurposeCode = callPurpose.CallPurposeCode;
|
||||
if(callPurpose.CallPurposeDescription != string.Empty)
|
||||
if (callPurpose.CallPurposeDescription != string.Empty)
|
||||
rnncp.CallPurposeDescription = callPurpose.CallPurposeDescription;
|
||||
choices.Add(rnncp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootNoaNod.Items = choices.ToArray();
|
||||
rootNoaNod.ItemsElementName = choiceList.ToArray();
|
||||
@ -291,8 +294,7 @@ namespace bsmd.dbh
|
||||
|
||||
case Message.NotificationClass.AGNT:
|
||||
{
|
||||
AGNT agnt = message.Elements[0] as AGNT;
|
||||
if (agnt != null)
|
||||
if (message.Elements[0] is AGNT agnt)
|
||||
{
|
||||
RootAGNT rootAGNT = new RootAGNT();
|
||||
rootAGNT.AgentCity = agnt.AgentCity;
|
||||
@ -306,7 +308,7 @@ namespace bsmd.dbh
|
||||
rootAGNT.AgentPostalCode = agnt.AgentPostalCode;
|
||||
rootAGNT.AgentStreetAndNumber = agnt.AgentStreetAndNumber;
|
||||
item = rootAGNT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -315,8 +317,7 @@ namespace bsmd.dbh
|
||||
#region ATA
|
||||
case Message.NotificationClass.ATA:
|
||||
{
|
||||
ATA ata = message.Elements[0] as ATA;
|
||||
if (ata != null)
|
||||
if (message.Elements[0] is ATA ata)
|
||||
{
|
||||
RootATA rootATA = new RootATA();
|
||||
if (ata.ATAPortOfCall.HasValue)
|
||||
@ -330,8 +331,7 @@ namespace bsmd.dbh
|
||||
#region ATD
|
||||
case Message.NotificationClass.ATD:
|
||||
{
|
||||
ATD atd = message.Elements[0] as ATD;
|
||||
if (atd != null)
|
||||
if (message.Elements[0] is ATD atd)
|
||||
{
|
||||
RootATD rootATD = new RootATD();
|
||||
rootATD.ATDPortOfCall = atd.ATDPortOfCall.Value.ToDBHDateString();
|
||||
@ -476,8 +476,7 @@ namespace bsmd.dbh
|
||||
#region BPOL
|
||||
case Message.NotificationClass.BPOL:
|
||||
{
|
||||
BPOL bpol = message.Elements[0] as BPOL;
|
||||
if (bpol != null)
|
||||
if (message.Elements[0] is BPOL bpol)
|
||||
{
|
||||
RootBPOL rootBPOL = new RootBPOL();
|
||||
RootBPOLPortOfItinerary[] poiArray = new RootBPOLPortOfItinerary[bpol.PortOfItineraries.Count];
|
||||
@ -858,6 +857,7 @@ namespace bsmd.dbh
|
||||
if (!mdh.MDHSimplification.HasValue)
|
||||
{
|
||||
_log.ErrorFormat("MDH {0} doesnt have MDHSimplification field set, aborting message", mdh.Id);
|
||||
client.Dispose();
|
||||
return false;
|
||||
}
|
||||
if (mdh.MDHSimplification.Value)
|
||||
@ -873,9 +873,11 @@ namespace bsmd.dbh
|
||||
{ // der blöde Teil
|
||||
|
||||
List<object> mdhItems = new List<object>();
|
||||
List<ItemsChoiceType2> choiceTypes2 = new List<ItemsChoiceType2>();
|
||||
|
||||
choiceTypes2.Add(ItemsChoiceType2.NonAccidentialDeathsDuringVoyage);
|
||||
List<ItemsChoiceType2> choiceTypes2 = new List<ItemsChoiceType2>
|
||||
{
|
||||
ItemsChoiceType2.NonAccidentialDeathsDuringVoyage
|
||||
};
|
||||
|
||||
mdhItems.Add((mdh.NonAccidentalDeathsDuringVoyage ?? false) ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N);
|
||||
|
||||
if (mdh.NonAccidentalDeathsDuringVoyage ?? false)
|
||||
@ -1021,9 +1023,10 @@ namespace bsmd.dbh
|
||||
// ACHTUNG hier ist die Reihenfolge entscheidend! (siehe XSD)
|
||||
|
||||
List<object> wasteItems = new List<object>();
|
||||
List<ItemsChoiceType3> choiceType3s = new List<ItemsChoiceType3>();
|
||||
|
||||
choiceType3s.Add(ItemsChoiceType3.LastWasteDisposalPort);
|
||||
List<ItemsChoiceType3> choiceType3s = new List<ItemsChoiceType3>
|
||||
{
|
||||
ItemsChoiceType3.LastWasteDisposalPort
|
||||
};
|
||||
wasteItems.Add(was.LastWasteDisposalPort);
|
||||
|
||||
if (was.LastWasteDisposalDate.HasValue)
|
||||
@ -1262,8 +1265,10 @@ namespace bsmd.dbh
|
||||
rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue;
|
||||
if (imdgPos.GeneralCargoIBC.HasValue)
|
||||
rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? DBHWebReference.RootSECValidISSCOnBoard.Y : DBHWebReference.RootSECValidISSCOnBoard.N;
|
||||
rootIMDG.ContainerNumber = imdgPos.ContainerNumber;
|
||||
rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber;
|
||||
if(!imdgPos.ContainerNumber.IsNullOrEmpty())
|
||||
rootIMDG.ContainerNumber = imdgPos.ContainerNumber;
|
||||
if(!imdgPos.VehicleLicenseNumber.IsNullOrEmpty())
|
||||
rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber;
|
||||
|
||||
if (imdgPos.StowagePosition.IsNullOrEmpty())
|
||||
{
|
||||
@ -1519,8 +1524,10 @@ namespace bsmd.dbh
|
||||
rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue;
|
||||
if (imdgPos.GeneralCargoIBC.HasValue)
|
||||
rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
|
||||
rootIMDG.ContainerNumber = imdgPos.ContainerNumber;
|
||||
rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber;
|
||||
if(!imdgPos.ContainerNumber.IsNullOrEmpty())
|
||||
rootIMDG.ContainerNumber = imdgPos.ContainerNumber;
|
||||
if(!imdgPos.VehicleLicenseNumber.IsNullOrEmpty())
|
||||
rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber;
|
||||
|
||||
if (imdgPos.StowagePosition.IsNullOrEmpty())
|
||||
{
|
||||
@ -1676,6 +1683,7 @@ namespace bsmd.dbh
|
||||
default:
|
||||
{
|
||||
_log.ErrorFormat("DBH send message: message type {0} not implemented", message.MessageNotificationClass);
|
||||
client.Dispose();
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
@ -1706,7 +1714,7 @@ namespace bsmd.dbh
|
||||
|
||||
_log.InfoFormat("Send Url: {0}", client.Url);
|
||||
|
||||
RootVersion rootVersion = RootVersion.Item50;
|
||||
const RootVersion rootVersion = RootVersion.Item50;
|
||||
|
||||
string result = client.Root(
|
||||
rootVersion,
|
||||
@ -1731,6 +1739,10 @@ namespace bsmd.dbh
|
||||
|
||||
returnval = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
client.Dispose();
|
||||
}
|
||||
|
||||
return returnval;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user