diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config
index 2b0bf49c..9ff3f9c0 100644
--- a/ENI-2/ENI2/ENI2/App.config
+++ b/ENI-2/ENI2/ENI2/App.config
@@ -26,12 +26,12 @@
1000
-
- http://heupferd/bsmd.LockingService/LockingService.svc
+ http://192.168.2.4/LockingService/LockingService.svc
+
-
- Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False
+ Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False
+
diff --git a/ENI-2/ENI2/ENI2/App.xaml.cs b/ENI-2/ENI2/ENI2/App.xaml.cs
index ceac4874..ca028cc9 100644
--- a/ENI-2/ENI2/ENI2/App.xaml.cs
+++ b/ENI-2/ENI2/ENI2/App.xaml.cs
@@ -39,6 +39,11 @@ namespace ENI2
public static ServiceClient LockingServiceClient { get { return _lockingServiceClient; } }
+ public static void RestartLockingService()
+ {
+ _lockingServiceClient = new ServiceClient("BasicHttpBinding_IService", ENI2.Properties.Settings.Default.LockingServerAddress);
+ }
+
public static SplashScreenWindow SplashScreen { get { return _splashScreenWindow; } }
public static Guid? UserId { get { return _userId; } set { _userId = value; } }
@@ -93,6 +98,7 @@ namespace ENI2
{
string errorMessage = string.Format("An unhandled exception occurred: {0}\r\n{1}", e.Exception.Message, e.Exception.StackTrace);
MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ // TODO: Dieser Fehler muss irgendwohin gesendet / gespeichert werden
e.Handled = true;
}
diff --git a/ENI-2/ENI2/ENI2/DetailBaseControl.cs b/ENI-2/ENI2/ENI2/DetailBaseControl.cs
index 9a0485cc..31ef84a3 100644
--- a/ENI-2/ENI2/ENI2/DetailBaseControl.cs
+++ b/ENI-2/ENI2/ENI2/DetailBaseControl.cs
@@ -166,7 +166,7 @@ namespace ENI2
protected void RegisterDateTimePickerChange(Xceed.Wpf.Toolkit.DateTimePicker dateTimePicker, Message.NotificationClass notificationClass)
{
- this._dpDateTimePicker.AddValueChanged(dateTimePicker, this.controlContentChanged);
+ this._dpDateTimePicker.AddValueChanged(dateTimePicker, this.controlContentChanged);
this._controlClassDict[dateTimePicker] = notificationClass;
}
diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs
index 8329016c..ebdde657 100644
--- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs
@@ -200,6 +200,9 @@ namespace ENI2
MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
+
+ Util.UIHelper.SetBusyState();
+
DetailBaseControl currentControl = this.detailView.Children[0] as DetailBaseControl;
if (currentControl != null)
{
@@ -222,7 +225,7 @@ namespace ENI2
private void SaveMessage(Message message)
{
- if (message.IsDirty)
+ if (message.IsDirty || message.IsNew)
{
if ((message.Status == Message.MessageStatus.ACCEPTED) &&
((message.InternalStatus == Message.BSMDStatus.CONFIRMED) || (message.InternalStatus == Message.BSMDStatus.VIOLATION)))
@@ -234,7 +237,24 @@ namespace ENI2
}
message.ChangedBy = string.Format("{0} at {1}", userName, DateTime.Now);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(message);
- message.SaveElements();
+ if (message.MessageNotificationClass == Message.NotificationClass.CREW)
+ {
+ foreach(CREW crew in message.Elements)
+ {
+ if (crew.IsNew || crew.IsDirty) DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(crew);
+ }
+ }
+ else if (message.MessageNotificationClass == Message.NotificationClass.PAS)
+ {
+ foreach(PAS pas in message.Elements)
+ {
+ if(pas.IsNew || pas.IsDirty) DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(pas);
+ }
+ }
+ else
+ {
+ message.SaveElements();
+ }
message.IsDirty = false;
}
}
@@ -245,7 +265,10 @@ namespace ENI2
MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
- foreach(Message message in this._messages)
+
+ Util.UIHelper.SetBusyState();
+
+ foreach (Message message in this._messages)
{
this.SaveMessage(message);
}
@@ -323,6 +346,8 @@ namespace ENI2
this._vViolations.Clear();
// TODO: clear highlighting
+ Util.UIHelper.SetBusyState();
+
RuleEngine ruleEngine = new RuleEngine();
foreach (Message aMessage in _messages)
{
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
index bf7078e0..6ce206c8 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
@@ -214,7 +214,7 @@ namespace ENI2.DetailViewControls
if(!this._pasMessage.Elements.Contains(epd.PAS))
this._pasMessage.Elements.Add(epd.PAS);
this.dataGridPassengerList.Items.Refresh();
- epd.PAS = new PAS();
+ epd.PAS = new PAS();
epd.PAS.MessageHeader = this._pasMessage;
epd.PAS.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.PAS);
@@ -223,7 +223,7 @@ namespace ENI2.DetailViewControls
if (epd.ShowDialog() ?? false)
{
if(!this._pasMessage.Elements.Contains(epd.PAS))
- _pasMessage.Elements.Add(epd.PAS);
+ _pasMessage.Elements.Add(epd.PAS);
this.dataGridPassengerList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.PAS);
}
@@ -258,7 +258,7 @@ namespace ENI2.DetailViewControls
if(!_pasMessage.Elements.Contains(epd.PAS))
_pasMessage.Elements.Add(epd.PAS);
this.dataGridPassengerList.Items.Refresh();
- epd.PAS = new PAS();
+ epd.PAS = new PAS();
epd.PAS.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements);
epd.PAS.MessageHeader = _pasMessage;
this.SublistElementChanged(Message.NotificationClass.PAS);
@@ -268,6 +268,7 @@ namespace ENI2.DetailViewControls
{
if (!_pasMessage.Elements.Contains(epd.PAS))
_pasMessage.Elements.Add(epd.PAS);
+ epd.PAS.IsDirty = true;
this.dataGridPassengerList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.PAS);
}
@@ -349,6 +350,7 @@ namespace ENI2.DetailViewControls
{
if (!_crewMessage.Elements.Contains(ecd.CREW))
_crewMessage.Elements.Add(ecd.CREW);
+ ecd.CREW.IsDirty = true;
this.dataGridCrewList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.CREW);
}
@@ -422,6 +424,7 @@ namespace ENI2.DetailViewControls
if (!reader.IsDBNull(9)) crew.CrewMemberVisaNumber = this.getValueAsString(reader, 9);
crew.MessageHeader = this._crewMessage;
+ crew.IsDirty = true;
crew.Identifier = CREW.GetNewIdentifier(this._crewMessage.Elements);
this._crewMessage.Elements.Add(crew);
importCrew.Add(crew);
@@ -500,6 +503,7 @@ namespace ENI2.DetailViewControls
if (!reader.IsDBNull(11)) pas.PassengerVisaNumber = this.getValueAsString(reader, 11);
pas.MessageHeader = this._pasMessage;
+ pas.IsDirty = true;
pas.Identifier = PAS.GetNewIdentifier(this._pasMessage.Elements);
this._pasMessage.Elements.Add(pas);
importPassenger.Add(pas);
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
index 7cb1cedd..d6aeb453 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
@@ -79,7 +79,7 @@ namespace ENI2.DetailViewControls
this.comboBoxInitialHis.ItemsSource = Util.EnumHelper.GetAllValuesAndDescription(typeof(Message.NSWProvider));
this.comboBoxInitialHis.DataContext = this.Core;
- Binding vtBinding = new Binding();
+ Binding vtBinding = new Binding();
vtBinding.Source = this.Core;
vtBinding.Path = this.Core.IsTransit ? new PropertyPath("TransitId") : new PropertyPath("VisitId");
vtBinding.Mode = BindingMode.TwoWay;
@@ -352,8 +352,11 @@ namespace ENI2.DetailViewControls
public void ShowLockedBy(ReportingParty reportingParty)
{
- this.stackPanelLock.Visibility = Visibility.Visible;
- this.textBlockLockUserName.Text = reportingParty.FirstName + " " + reportingParty.LastName;
+ if (reportingParty != null)
+ {
+ this.stackPanelLock.Visibility = Visibility.Visible;
+ this.textBlockLockUserName.Text = reportingParty.FirstName + " " + reportingParty.LastName;
+ }
}
#endregion
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml
index 73be64e5..ea018d24 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml
@@ -49,7 +49,7 @@
+ AutoGenerateColumns="False" Margin="0,5,0,0" Grid.Row="1">
diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj
index 6be1e466..903e822c 100644
--- a/ENI-2/ENI2/ENI2/ENI2.csproj
+++ b/ENI-2/ENI2/ENI2/ENI2.csproj
@@ -35,8 +35,8 @@
3.5.1.0
true
publish.html
- 1
- 3.8.3.%2a
+ 0
+ 3.8.5.%2a
false
true
true
diff --git a/ENI-2/ENI2/ENI2/SucheControl.xaml.cs b/ENI-2/ENI2/ENI2/SucheControl.xaml.cs
index 296c5137..6681e30d 100644
--- a/ENI-2/ENI2/ENI2/SucheControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/SucheControl.xaml.cs
@@ -11,6 +11,7 @@ using System.Windows.Media;
using bsmd.database;
using System.Windows.Data;
+using log4net;
namespace ENI2
{
@@ -19,9 +20,9 @@ namespace ENI2
///
public partial class SucheControl : UserControl
{
-
private List anmeldungen = new List();
private object searchLock = new object();
+ private ILog _log = LogManager.GetLogger("SucheControl");
#region Construction
@@ -98,7 +99,26 @@ namespace ENI2
if (App.UserId.HasValue)
{
// "locks" dazu abfragen
- LockingServiceReference.CoreLock[] coreLocks = App.LockingServiceClient.GetLocks();
+ LockingServiceReference.CoreLock[] coreLocks = null;
+ bool retry = false;
+ RESTART:
+ try
+ {
+ coreLocks = App.LockingServiceClient.GetLocks();
+ }
+ catch(Exception ex)
+ {
+ // wenn das System lang lief ist der Service deallokiert? Wirft hier eine Exception. Ich würde an der Stelle den Client neu
+ // erzeugen und nochmal probieren, danach darüber laufen lassen..
+ if (!retry)
+ {
+ _log.ErrorFormat("LockingService:GetLocks(): {0}", ex.Message);
+ _log.Info("trying to restart the locking service client");
+ retry = true;
+ App.RestartLockingService();
+ goto RESTART;
+ }
+ }
Dictionary coreLockUpdateDict = new Dictionary();
for (int i = 0; i < coreLocks.Length; i++)
{
diff --git a/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs b/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs
index 0396a2f6..1e3cd2cc 100644
--- a/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs
+++ b/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs
@@ -33,29 +33,29 @@ namespace ENI2.Util
public static byte[] ShipSecurityLevels = { 1, 2, 3 };
public static Dictionary Edifact8025 = new Dictionary {
- {1, "Cargo operations" },
- {2, "Passenger movement" },
- {3, "Taking bunkers" },
- {4, "Changing crew" },
- {5, "Goodwill visit" },
- {6, "Taking supplies" },
- {7, "Repair" },
- {8, "Laid-up" },
- {9, "Awaiting orders" },
- {10, "Miscellaneous" },
- {11, "Crew movement" },
- {12, "Cruise, leisure and recreation" },
- {13, "Under government order" },
- {14, "Quarantine inspection" },
- {15, "Refuge" },
- {16, "Unloading cargo" },
- {17, "Loading cargo" },
- {18, "Repair in dry dock" },
- {19, "Repair in wet dock" },
- {20, "Cargo tank cleaning" },
- {21, "Means of transport customs clearance" },
- {22, "De-gassing" },
- {23, "Waste disposal" }
+ {1, "1 Cargo operations" },
+ {2, "2 Passenger movement" },
+ {3, "3 Taking bunkers" },
+ {4, "4 Changing crew" },
+ {5, "5 Goodwill visit" },
+ {6, "6 Taking supplies" },
+ {7, "7 Repair" },
+ {8, "8 Laid-up" },
+ {9, "9 Awaiting orders" },
+ {10, "10 Miscellaneous" },
+ {11, "11 Crew movement" },
+ {12, "12 Cruise, leisure and recreation" },
+ {13, "13 Under government order" },
+ {14, "14 Quarantine inspection" },
+ {15, "15 Refuge" },
+ {16, "16 Unloading cargo" },
+ {17, "17 Loading cargo" },
+ {18, "18 Repair in dry dock" },
+ {19, "19 Repair in wet dock" },
+ {20, "20 Cargo tank cleaning" },
+ {21, "21 Means of transport customs clearance" },
+ {22, "22 De-gassing" },
+ {23, "23 Waste disposal" }
};
public static string[] vesselClasses =
diff --git a/ENI-2/ENI2/ENI2/Util/UtcToLocalDateTimeConverter.cs b/ENI-2/ENI2/ENI2/Util/UtcToLocalDateTimeConverter.cs
index 67d3a405..cd990de7 100644
--- a/ENI-2/ENI2/ENI2/Util/UtcToLocalDateTimeConverter.cs
+++ b/ENI-2/ENI2/ENI2/Util/UtcToLocalDateTimeConverter.cs
@@ -25,7 +25,10 @@ namespace ENI2.Util
{
DateTime? sourceVal = (DateTime?) value;
if (sourceVal.HasValue)
+ {
+ //if(sourceVal.Value.)
return DateTime.SpecifyKind(sourceVal.Value, DateTimeKind.Utc).ToLocalTime();
+ }
else
return null;
}
diff --git a/nsw/Source/SendNSWMessageService/NSWSendService.cs b/nsw/Source/SendNSWMessageService/NSWSendService.cs
index c088bcc5..3a09fbe5 100644
--- a/nsw/Source/SendNSWMessageService/NSWSendService.cs
+++ b/nsw/Source/SendNSWMessageService/NSWSendService.cs
@@ -143,6 +143,7 @@ namespace SendNSWMessageService
if (!XtraSendLogic.ShouldSendMessage(message))
{
message.InternalStatus = Message.BSMDStatus.SUSPENDED;
+ message.ChangedBy = ""; // zurücksetzen für Overview
DBManager.Instance.Save(message);
continue;
}
@@ -266,7 +267,7 @@ namespace SendNSWMessageService
}
DBManager.Instance.Save(core);
-
+ #region old logic
/*
if ((core.InitialHIS == Message.NSWProvider.DUDR) || (core.InitialHIS == Message.NSWProvider.DUDR_TEST))
{
@@ -475,6 +476,7 @@ namespace SendNSWMessageService
}
}
*/
+ #endregion
}
diff --git a/nsw/Source/bsmd.ReportGenerator/ReportService.cs b/nsw/Source/bsmd.ReportGenerator/ReportService.cs
index 1ce26e51..204f4681 100644
--- a/nsw/Source/bsmd.ReportGenerator/ReportService.cs
+++ b/nsw/Source/bsmd.ReportGenerator/ReportService.cs
@@ -286,7 +286,7 @@ namespace bsmd.ReportGenerator
List attachments = new List();
attachments.Add(fullPath);
- // BSMDMail.SendNSWReportWithAttachments(subject, attachments, rp.EMail);
+ BSMDMail.SendNSWReportWithAttachments(subject, attachments, rp.UserEMail);
// remove
if (Properties.Settings.Default.DeleteFileAfterSend)
diff --git a/nsw/Source/bsmd.database/DBManager.cs b/nsw/Source/bsmd.database/DBManager.cs
index 5540a2f3..497fe108 100644
--- a/nsw/Source/bsmd.database/DBManager.cs
+++ b/nsw/Source/bsmd.database/DBManager.cs
@@ -1107,11 +1107,17 @@ namespace bsmd.database
reader.Close();
if (!core.ETA_NOA_NOD.HasValue && !core.IsTransit)
- core.ETA_NOA_NOD = core.ETA;
+ {
+ // die Zeit aus MessageCore ist nur ein Datum. Daher verwendet er 00:00 als lokale Zeit, was z.B. nach 01:00 MET zur Anzeige konvertiert wird.
+ // Das darf in diesem Fall nicht sein, der Wert müsste also gefakt lokal gesetzt werden.. ouch hack
+ core.ETA_NOA_NOD = DateTime.SpecifyKind(core.ETA.Value, DateTimeKind.Local).ToUniversalTime();
+ }
if (!core.ETA_NOA_NOD.HasValue && core.IsTransit)
- core.ETA_NOA_NOD = core.ETAKielCanal;
-
+ {
+ core.ETA_NOA_NOD = DateTime.SpecifyKind(core.ETAKielCanal.Value, DateTimeKind.Local).ToUniversalTime();
+ }
+
}
internal void LoadATA(MessageCore core)
diff --git a/nsw/Source/bsmd.database/DatabaseEntity.cs b/nsw/Source/bsmd.database/DatabaseEntity.cs
index 56d91191..090088d3 100644
--- a/nsw/Source/bsmd.database/DatabaseEntity.cs
+++ b/nsw/Source/bsmd.database/DatabaseEntity.cs
@@ -22,7 +22,7 @@ namespace bsmd.database
{
protected Guid? id;
protected string tablename;
- private Guid instance_id = Guid.NewGuid(); // Comparison id in case entity has not been saved
+ private Guid instance_id = Guid.NewGuid(); // Comparison id in case entity has not been saved
#region enum ValidationBlock
diff --git a/nsw/Source/bsmd.database/MessageCore.cs b/nsw/Source/bsmd.database/MessageCore.cs
index af5158f7..11ba4bc0 100644
--- a/nsw/Source/bsmd.database/MessageCore.cs
+++ b/nsw/Source/bsmd.database/MessageCore.cs
@@ -6,13 +6,14 @@ using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Text;
+using log4net;
namespace bsmd.database
{
public class MessageCore : DatabaseEntity, IComparable, IEquatable
{
- #region Fields
+ #region (backing) Fields
private Guid? previous;
private Guid? next;
@@ -21,6 +22,10 @@ namespace bsmd.database
private Guid? customerId;
private int? wetris_zz_56_datensatz_id;
+ private static ILog _log = LogManager.GetLogger("MessageCore");
+
+ private string _visitId;
+ private string _transitId;
#endregion
@@ -87,11 +92,40 @@ namespace bsmd.database
[MaxLength(25)]
[ENI2Validation]
- public string VisitId { get; set; }
+ public string VisitId
+ {
+ get { return this._visitId; }
+ set {
+ if(value.IsNullOrEmpty() && !this._visitId.IsNullOrEmpty())
+ {
+ System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();
+ _log.WarnFormat("Someones resetting the VISIT Id at {0}", st.ToString());
+ }
+ else
+ {
+ this._visitId = value;
+ }
+ }
+ }
[MaxLength(25)]
[ENI2Validation]
- public string TransitId { get; set; }
+ public string TransitId
+ {
+ get { return this._transitId; }
+ set
+ {
+ if (value.IsNullOrEmpty() && !this._transitId.IsNullOrEmpty())
+ {
+ System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();
+ _log.WarnFormat("Someones resetting the TRANSIT Id at {0}", st.ToString());
+ }
+ else
+ {
+ this._transitId = value;
+ }
+ }
+ }
///
/// Display Property für ENI-2
@@ -279,10 +313,8 @@ namespace bsmd.database
{
SqlCommand scmd = cmd as SqlCommand;
- if (this.VisitId != null) scmd.Parameters.AddWithValue("@P1", this.VisitId);
- else scmd.Parameters.AddWithValue("@P1", DBNull.Value);
- if (this.TransitId != null) scmd.Parameters.AddWithValue("@P2", this.TransitId);
- else scmd.Parameters.AddWithValue("@P2", DBNull.Value);
+ scmd.Parameters.AddWithNullableValue("@P1", this.VisitId);
+ scmd.Parameters.AddWithNullableValue("@P2", this.TransitId);
if (this.IMO != null) scmd.Parameters.AddWithValue("@P3", this.IMO);
else scmd.Parameters.AddWithValue("@P3", DBNull.Value);
if (this.ENI != null) scmd.Parameters.AddWithValue("@P4", this.ENI);
diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs
index 7667931a..78ca8c17 100644
--- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs
+++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs
@@ -2,6 +2,6 @@
[assembly: AssemblyCompany("schick Informatik")]
[assembly: AssemblyProduct("BSMD NSW interface")]
-[assembly: AssemblyInformationalVersion("3.8.3")]
+[assembly: AssemblyInformationalVersion("3.8.5")]
[assembly: AssemblyCopyright("Copyright © 2014-2017 schick Informatik")]
[assembly: AssemblyTrademark("")]
\ No newline at end of file
diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs
index 34faefdc..f5822467 100644
--- a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs
+++ b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs
@@ -1,4 +1,4 @@
using System.Reflection;
-[assembly: AssemblyVersion("3.8.3.*")]
+[assembly: AssemblyVersion("3.8.5.*")]
diff --git a/nsw/Source/bsmd.database/ValidationCondition.cs b/nsw/Source/bsmd.database/ValidationCondition.cs
index 64509234..62e0c157 100644
--- a/nsw/Source/bsmd.database/ValidationCondition.cs
+++ b/nsw/Source/bsmd.database/ValidationCondition.cs
@@ -58,6 +58,12 @@ namespace bsmd.database
message = "";
bool conditionResult = false;
+ // Aus der List an Messages muss (irgendwie :-) ein Dictionary aufgebaut werden, mit dem man aus den Namen der Fieldnames auf
+ // den Wert bzw. die Liste an Werten (bei Listenklassen) kommt. Das ValidationField "weiß" schon ob es eine Listenklasse ist.
+
+ // das hier muss noch früher rein damit es nicht für jede Regel erneut erzeugt wird
+ ValidationRule.PrepareNameLookupDict(core, messages);
+
try
{
// Bedingungen validieren
@@ -65,53 +71,17 @@ namespace bsmd.database
foreach (ValidationCondition condition in cGroup.Conditions)
{
object[] otherargs = null;
-
- // den aktuellen Wert bestimmen
+
if(!ValidationRule.ValidationFieldDict.ContainsKey(condition.FieldName))
- {
- // TODO: Warnung absetzen
+ {
continue;
}
- ValidationField vf = ValidationRule.ValidationFieldDict[condition.FieldName];
-
- // Wert aus den Daten auslesen
-
- // Dabei muss unterschieden werden: 1. skalarer Wert
- // 2. Wert eines Listenelements
- //
-
- // als Rückgabe würde dann benötigt der Name des Property, die beteiligte Klasse und natürlich der Identifier (Index) wenn es eine Listenposition war
-
-
- //if(vf.)
- //object value = vf.PropertyInfo.GetValue()
-
-
-
- switch(condition.ConditionOperator)
- {
- case ConditionOperatorEnum.EQUAL:
-
- break;
- case ConditionOperatorEnum.NOT_EQUAL:
-
- break;
- case ConditionOperatorEnum.LESS:
-
- break;
- case ConditionOperatorEnum.GREATER:
-
- break;
- case ConditionOperatorEnum.NULL:
-
- break;
- case ConditionOperatorEnum.NOT_NULL:
-
- break;
- }
-
+ ValidationField aFailedField = null;
+ bool conditionValid = condition.Evaluate(core, messages, out aFailedField);
+ if (!conditionValid && aFailedField != null)
+ failedFieldList.Add(aFailedField);
string errorMessage = cGroup.ErrorMessage;
@@ -214,6 +184,54 @@ namespace bsmd.database
#endregion
+
+ private bool Evaluate(MessageCore core, List messages, out ValidationField failedField)
+ {
+ bool result = false;
+ failedField = null;
+
+ if(ValidationRule.ValidationFieldDict.ContainsKey(this.FieldName))
+ {
+ // den Wert aus der Nachrichtenklasse lesen
+ ValidationField aValField = ValidationRule.ValidationFieldDict[this.FieldName];
+ // object value = aValField.PropertyInfo.GetValue()
+
+ // check type and evaluate with operator (local prop)
+
+ switch (this.ConditionOperator)
+ {
+ case ConditionOperatorEnum.EQUAL:
+
+ break;
+ case ConditionOperatorEnum.NOT_EQUAL:
+
+ break;
+ case ConditionOperatorEnum.LESS:
+
+ break;
+ case ConditionOperatorEnum.GREATER:
+
+ break;
+ case ConditionOperatorEnum.NULL:
+
+ break;
+ case ConditionOperatorEnum.NOT_NULL:
+
+ break;
+ }
+
+ // if failed set failedField to aValField
+
+ // else set result to true
+
+ }
+
+ return result;
+ }
+
+
+ #region hier ist das alte audius Zeugs
+
///
/// evaluate logical group operator
///
@@ -306,6 +324,8 @@ namespace bsmd.database
#endregion
+ #endregion
+
#region ICloneable implementation
public object Clone()
@@ -482,7 +502,6 @@ namespace bsmd.database
#endregion
-
#region struct KeyValuePairS
[Serializable]
diff --git a/nsw/Source/bsmd.database/ValidationRule.cs b/nsw/Source/bsmd.database/ValidationRule.cs
index b0b64816..e854e46b 100644
--- a/nsw/Source/bsmd.database/ValidationRule.cs
+++ b/nsw/Source/bsmd.database/ValidationRule.cs
@@ -14,6 +14,7 @@ namespace bsmd.database
{
private static List _validationFields = null;
private static Dictionary _validationFieldDict = null;
+ private static Dictionary _lookupDict = null;
public ValidationRule()
{
@@ -141,6 +142,40 @@ namespace bsmd.database
}
+ #endregion
+
+ #region public static methods
+
+ public static object GetValueFromData(ValidationField field, Dictionary dataDict)
+ {
+
+ // hier könnte auch ein List